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

#include <ConcurrencyRos.hpp>

Inheritance diagram for state_machine_ros::ConcurrencyRos:
Inheritance graph

Public Member Functions

 ConcurrencyRos (ros::NodeHandle &nodeHandle, state_machine::ContextPtr context, std::string name, const std::set< std::string > &outcomes, const std::string &defaultOutcome, const StateOutcomeMapping &stateOutcomeMapping={}, const ChildTerminationCallback &childTerminationCb={}, const TerminationCallback &terminationCb={})
 
 ~ConcurrencyRos () override=default
 
- Public Member Functions inherited from state_machine::Concurrency
 Concurrency (ContextPtr context, std::string name, std::set< std::string > outcomes, std::string defaultOutcome, StateOutcomeMapping stateOutcomeMapping={}, ChildTerminationCallback childTerminationCb={}, TerminationCallback terminationCb={})
 
 ~Concurrency () override=default
 
const std::string & getDefaultOutcome () const
 
const StateOutcomeMappinggetStateOutcomeMapping () const
 
void addState (const StatePtr &state, bool isBackgroundState=false)
 
void removeStateByName (const std::string &name) override
 
void clear () override
 
void getAvailableInitialStateNestedNames (std::set< NestedName > &nestedNames) const override
 
bool setInitialStateByNestedName (const NestedName &nestedName) override
 
bool isConsistent (std::vector< std::string > &inconsistencies) const override
 
std::string midExecution () override
 
bool requestPauseAfterExecution () 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
 
bool isConsistent (std::vector< std::string > &inconsistencies) const override
 
void recallPauseAfterExecution () override
 
bool pauseAfterExecutionRequested () override
 
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::Concurrency
using StateOutcomes = std::map< std::string, std::string >
 
using StateOutcomeMapping = std::vector< std::pair< StateOutcomes, std::string > >
 
using ChildTerminationCallback = std::function< bool(const StateOutcomes &)>
 
using TerminationCallback = std::function< std::string(const StateOutcomes &)>
 
- Static Public Member Functions inherited from state_machine::State
static double getTimeStep ()
 
- Protected Member Functions inherited from state_machine::Concurrency
void executeState (StatePtr state)
 
- 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::Concurrency
std::string defaultOutcome_
 
StateOutcomeMapping stateOutcomeMapping_
 
ChildTerminationCallback childTerminationCb_
 
TerminationCallback terminationCb_
 
std::map< std::string, bool > isBackgroundState_
 
std::mutex stateOutcomesMutex_
 
StateOutcomes stateOutcomes_
 
- 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

◆ ConcurrencyRos()

state_machine_ros::ConcurrencyRos::ConcurrencyRos ( ros::NodeHandle &  nodeHandle,
state_machine::ContextPtr  context,
std::string  name,
const std::set< std::string > &  outcomes,
const std::string &  defaultOutcome,
const StateOutcomeMapping stateOutcomeMapping = {},
const ChildTerminationCallback childTerminationCb = {},
const TerminationCallback terminationCb = {} 
)

◆ ~ConcurrencyRos()

state_machine_ros::ConcurrencyRos::~ConcurrencyRos ( )
overridedefault

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