State Machine
Tools for creating and running general purpose state machines.
state_machine_ros::StateMachineRos Class Reference

#include <StateMachineRos.hpp>

Inheritance diagram for state_machine_ros::StateMachineRos:
Inheritance graph

Public Member Functions

 StateMachineRos (ros::NodeHandle &nodeHandle, state_machine::ContextPtr context, std::string name, const std::set< std::string > &outcomes, bool restartOnExecution)
 
 ~StateMachineRos () override=default
 
- Public Member Functions inherited from state_machine::StateMachine
 StateMachine (ContextPtr context, std::string name, std::set< std::string > outcomes, bool restartOnExecution)
 
 ~StateMachine () override=default
 
void addState (const StatePtr &state, const std::map< std::string, std::string > &transitions)
 
void removeStateByName (const std::string &name) override
 
void clear () override
 
TransitionsgetTransitions ()
 
const TransitionsgetTransitions () const
 
void setInitialStateByName (const std::string &name)
 
bool setInitialStateByNestedName (const NestedName &nestedName) override
 
std::string getInitialStateName () const
 
StatePtr getInitialState () const
 
void getAvailableInitialStateNestedNames (std::set< NestedName > &nestedNames) const override
 
bool isConsistent (std::vector< std::string > &inconsistencies) const override
 
std::string midExecution () override
 
bool requestPauseAfterExecution () override
 
void recallPauseAfterExecution () override
 
bool pauseAfterExecutionRequested () override
 
std::map< NestedName, ProgressgetRunningStates (const bool ignoreBackgroundStates) override
 
- Public Member Functions inherited from state_machine::Container
void addState (const StatePtr &state)
 
bool stateExists (const std::string &name) const
 
StatePtr getState (const std::string &name)
 
std::map< std::string, StatePtrgetStates () const
 
std::set< std::string > getStateNames () const
 
void requestPreempt () override
 
void recallPreempt () override
 
void printStateHierarchy (const bool useNestedNames, const bool useIndentation, const unsigned int indentation) const override
 
- Public Member Functions inherited from state_machine::State
 State (ContextPtr context, std::string name, std::set< std::string > outcomes)
 
virtual ~State ()=default
 
ContextPtr getContext () const
 
void setName (const std::string &name)
 
const std::string & getName () const
 
NestedName getNestedName () const
 
const std::set< std::string > & getOutcomes () const
 
const std::string & getType () const
 
void resetIds ()
 
const std::string & getKeyPrefix () const
 
void setParent (State *parent)
 
StategetParent ()
 
void resetParent ()
 
virtual void loadSettings (const Settings &settings)
 
virtual void saveSettings (Settings &settings) const
 
std::string execute ()
 
bool isRunning () const
 
void requestPause ()
 
void requestResume ()
 
bool isPaused ()
 
void servicePreempt ()
 
bool preemptRequested () const
 
void sleepOnce ()
 
void sleepWhilePaused ()
 
virtual Progress getProgress ()
 
void printStateHierarchy ()
 

Additional Inherited Members

- Public Types inherited from state_machine::StateMachine
using Transitions = std::map< std::string, std::map< std::string, std::string > >
 
- Static Public Member Functions inherited from state_machine::State
static double getTimeStep ()
 
- Protected Member Functions inherited from state_machine::Container
 Container (ContextPtr context, std::string name, std::set< std::string > outcomes)
 
 ~Container () override=default
 
- Protected Member Functions inherited from state_machine::State
void setId ()
 
virtual void preExecution ()
 
virtual void postExecution ()
 
void sleep (const double duration)
 
- Protected Member Functions inherited from state_machine_ros::RosInterface
 RosInterface (ros::NodeHandle &nodeHandle, std::string stateName)
 
virtual ~RosInterface ()=default
 
- Protected Attributes inherited from state_machine::StateMachine
bool restartOnExecution_ = false
 
Transitions transitions_
 
std::string initialStateName_
 
StatePtr runningState_
 
std::atomic< bool > pauseAfterExecutionRequested_
 
- Protected Attributes inherited from state_machine::Container
std::map< std::string, StatePtrstates_
 
- Protected Attributes inherited from state_machine::State
ContextPtr context_
 
std::string name_
 
std::string type_
 
std::set< std::string > outcomes_
 
unsigned int id_ = -1
 
std::string keyPrefix_
 
Stateparent_ = nullptr
 
std::atomic< bool > isRunning_
 
std::atomic< bool > preemptRequested_
 
Progress progress_
 
- Protected Attributes inherited from state_machine_ros::RosInterface
ros::NodeHandle & nodeHandle_
 
const std::string stateName_
 
- Static Protected Attributes inherited from state_machine::State
static std::mutex freeIdMutex_
 
static int freeId_ = 0
 
static double timeStep_ = 0.1
 
static std::atomic< bool > isPaused_
 
- Static Protected Attributes inherited from state_machine_ros::RosInterface
static bool isSimulation_
 

Constructor & Destructor Documentation

◆ StateMachineRos()

state_machine_ros::StateMachineRos::StateMachineRos ( ros::NodeHandle &  nodeHandle,
state_machine::ContextPtr  context,
std::string  name,
const std::set< std::string > &  outcomes,
bool  restartOnExecution 
)

◆ ~StateMachineRos()

state_machine_ros::StateMachineRos::~StateMachineRos ( )
overridedefault

The documentation for this class was generated from the following files: