SMACC
Loading...
Searching...
No Matches
Public Member Functions | List of all members
smacc::SmaccStateMachineBase< DerivedStateMachine, InitialStateType > Struct Template Reference

State Machine. More...

#include <smacc_state_machine_base.h>

Inheritance diagram for smacc::SmaccStateMachineBase< DerivedStateMachine, InitialStateType >:
Inheritance graph
Collaboration diagram for smacc::SmaccStateMachineBase< DerivedStateMachine, InitialStateType >:
Collaboration graph

Public Member Functions

 SmaccStateMachineBase (my_context ctx, SignalDetector *signalDetector)
 
virtual ~SmaccStateMachineBase ()
 
virtual void reset () override
 
virtual void stop () override
 
virtual void eStop () override
 
virtual void initiate_impl () override
 
- Public Member Functions inherited from smacc::ISmaccStateMachine
 ISmaccStateMachine (SignalDetector *signalDetector)
 
virtual ~ISmaccStateMachine ()
 
virtual void reset ()
 
virtual void stop ()
 
virtual void eStop ()
 
template<typename TOrthogonal >
TOrthogonal * getOrthogonal ()
 
const std::map< std::string, std::shared_ptr< smacc::ISmaccOrthogonal > > & getOrthogonals () const
 
template<typename SmaccComponentType >
void requiresComponent (SmaccComponentType *&storage)
 
template<typename EventType >
void postEvent (EventType *ev, EventLifeTime evlifetime=EventLifeTime::ABSOLUTE)
 
template<typename EventType >
void postEvent (EventLifeTime evlifetime=EventLifeTime::ABSOLUTE)
 
void getTransitionLogHistory ()
 
template<typename T >
bool getGlobalSMData (std::string name, T &ret)
 
template<typename T >
void setGlobalSMData (std::string name, T value)
 
template<typename StateField , typename BehaviorType >
void mapBehavior ()
 
std::string getStateMachineName ()
 
void state_machine_visualization (const ros::TimerEvent &)
 
std::shared_ptr< SmaccStateInfogetCurrentStateInfo ()
 
void publishTransition (const SmaccTransitionInfo &transitionInfo)
 
virtual void onInitialize ()
 this function should be implemented by the user to create the orthogonals More...
 
bool getTransitionLogHistory (smacc_msgs::SmaccGetTransitionHistory::Request &req, smacc_msgs::SmaccGetTransitionHistory::Response &res)
 
template<typename TSmaccSignal , typename TMemberFunctionPrototype , typename TSmaccObjectType >
boost::signals2::connection createSignalConnection (TSmaccSignal &signal, TMemberFunctionPrototype callback, TSmaccObjectType *object)
 
void disconnectSmaccSignalObject (void *object)
 
template<typename StateType >
void notifyOnStateEntryStart (StateType *state)
 
template<typename StateType >
void notifyOnStateEntryEnd (StateType *state)
 
template<typename StateType >
void notifyOnRuntimeConfigured (StateType *state)
 
template<typename StateType >
void notifyOnStateExitting (StateType *state)
 
template<typename StateType >
void notifyOnStateExited (StateType *state)
 
template<typename StateType >
void notifyOnRuntimeConfigurationFinished (StateType *state)
 
uint64_t getCurrentStateCounter () const
 
ISmaccStategetCurrentState () const
 
const SmaccStateMachineInfogetStateMachineInfo ()
 
template<typename InitialStateType >
void buildStateMachineInfo ()
 
ros::NodeHandle getNode ()
 

Additional Inherited Members

- Protected Member Functions inherited from smacc::ISmaccStateMachine
void checkStateMachineConsistence ()
 
void initializeROS (std::string smshortname)
 
void onInitialized ()
 
template<typename TOrthogonal >
void createOrthogonal ()
 
template<typename T >
bool getParam (std::string param_name, T &param_storage)
 
template<typename T >
void setParam (std::string param_name, T param_val)
 
template<typename T >
bool param (std::string param_name, T &param_val, const T &default_val) const
 
- Protected Attributes inherited from smacc::ISmaccStateMachine
ros::NodeHandle nh_
 
ros::NodeHandle private_nh_
 
ros::Timer timer_
 
ros::Publisher stateMachinePub_
 
ros::Publisher stateMachineStatusPub_
 
ros::Publisher transitionLogPub_
 
ros::ServiceServer transitionHistoryService_
 
std::vector< ISmaccState * > currentState_
 
std::shared_ptr< SmaccStateInfocurrentStateInfo_
 
smacc_msgs::SmaccStatus status_msg_
 
std::map< std::string, std::shared_ptr< smacc::ISmaccOrthogonal > > orthogonals_
 

Detailed Description

template<typename DerivedStateMachine, typename InitialStateType>
struct smacc::SmaccStateMachineBase< DerivedStateMachine, InitialStateType >

State Machine.

Definition at line 17 of file smacc_state_machine_base.h.

Constructor & Destructor Documentation

◆ SmaccStateMachineBase()

template<typename DerivedStateMachine , typename InitialStateType >
smacc::SmaccStateMachineBase< DerivedStateMachine, InitialStateType >::SmaccStateMachineBase ( my_context  ctx,
SignalDetector signalDetector 
)
inline

◆ ~SmaccStateMachineBase()

template<typename DerivedStateMachine , typename InitialStateType >
virtual smacc::SmaccStateMachineBase< DerivedStateMachine, InitialStateType >::~SmaccStateMachineBase ( )
inlinevirtual

Definition at line 26 of file smacc_state_machine_base.h.

27 {
28 //updateCurrentState<InitialStateType>(false);
29 }

Member Function Documentation

◆ eStop()

template<typename DerivedStateMachine , typename InitialStateType >
virtual void smacc::SmaccStateMachineBase< DerivedStateMachine, InitialStateType >::eStop ( )
inlineoverridevirtual

Reimplemented from smacc::ISmaccStateMachine.

Definition at line 44 of file smacc_state_machine_base.h.

45 {
47 this->terminate();
48 }

References smacc::ISmaccStateMachine::eStop().

Here is the call graph for this function:

◆ initiate_impl()

template<typename DerivedStateMachine , typename InitialStateType >
virtual void smacc::SmaccStateMachineBase< DerivedStateMachine, InitialStateType >::initiate_impl ( )
inlineoverridevirtual

Definition at line 50 of file smacc_state_machine_base.h.

51 {
52 // this is before because this creates orthogonals
53 this->onInitialize();
54
55 ROS_INFO("[SmaccStateMachine] Introspecting state machine via typeWalker");
56 this->buildStateMachineInfo<InitialStateType>();
57
58 ROS_INFO("[SmaccStateMachine] initiate_impl");
59 auto shortname = smacc::utils::cleanShortTypeName(typeid(DerivedStateMachine));
60
61 this->initializeROS(shortname);
62
63 ROS_INFO("[SmaccStateMachine] Initializing ROS communication mechanisms");
64 this->onInitialized();
65
66 ROS_INFO("[SmaccStateMachine] Initializing state machine");
67 sc::state_machine<DerivedStateMachine, InitialStateType, SmaccAllocator>::initiate();
68 }
void initializeROS(std::string smshortname)
virtual void onInitialize()
this function should be implemented by the user to create the orthogonals
std::string cleanShortTypeName(const std::type_info &tinfo)
Definition: common.cpp:14

References smacc::utils::cleanShortTypeName(), smacc::ISmaccStateMachine::initializeROS(), smacc::ISmaccStateMachine::onInitialize(), and smacc::ISmaccStateMachine::onInitialized().

Here is the call graph for this function:

◆ reset()

template<typename DerivedStateMachine , typename InitialStateType >
virtual void smacc::SmaccStateMachineBase< DerivedStateMachine, InitialStateType >::reset ( )
inlineoverridevirtual

Reimplemented from smacc::ISmaccStateMachine.

Definition at line 31 of file smacc_state_machine_base.h.

32 {
34 this->terminate();
35 smacc::run<DerivedStateMachine>();
36 }

References smacc::ISmaccStateMachine::reset().

Here is the call graph for this function:

◆ stop()

template<typename DerivedStateMachine , typename InitialStateType >
virtual void smacc::SmaccStateMachineBase< DerivedStateMachine, InitialStateType >::stop ( )
inlineoverridevirtual

Reimplemented from smacc::ISmaccStateMachine.

Definition at line 38 of file smacc_state_machine_base.h.

39 {
41 this->terminate();
42 }

References smacc::ISmaccStateMachine::stop().

Here is the call graph for this function:

The documentation for this struct was generated from the following file: