mc_control::fsm::Executor Class Reference

#include <mc_control/fsm/Executor.h>

Public Member Functions

 Executor ()=default
 
 Executor (const Executor &)=delete
 
 Executor (Executor &&)=delete
 
Executoroperator= (const Executor &)=delete
 
Executoroperator= (Executor &&)=delete
 
void init (Controller &ctl, const mc_rtc::Configuration &config, const std::string &name="", const std::vector< std::string > &category={})
 
bool run (Controller &ctl, bool keep_state)
 
void stop (Controller &ctl)
 
void teardown (Controller &ctl)
 
void interrupt ()
 
bool running () const
 
bool ready () const
 
bool complete () const
 
bool resume (const std::string &state)
 
bool next ()
 
const std::string & state () const
 
const std::string & output () const
 
const std::string & next_state () const
 
bool read_msg (std::string &msg)
 
bool read_write_msg (std::string &msg, std::string &out)
 

Detailed Description

of executing an FSM

The executor can works in two ways:

  • managed: handles transitions through an external trigger
  • self-managed: handles transitions thanks to a TransitionMap

Constructor & Destructor Documentation

◆ Executor() [1/3]

mc_control::fsm::Executor::Executor ( )
default

Executor should not be copied or moved

After init is called, the executor has been added to the GUI/log if it's moved these entries do not refer to an existing object anymore and this will lead to a crash

◆ Executor() [2/3]

mc_control::fsm::Executor::Executor ( const Executor )
delete

◆ Executor() [3/3]

mc_control::fsm::Executor::Executor ( Executor &&  )
delete

Member Function Documentation

◆ complete()

bool mc_control::fsm::Executor::complete ( ) const
inline

Returns true if the executor reached the end of transition map

◆ init()

void mc_control::fsm::Executor::init ( Controller ctl,
const mc_rtc::Configuration config,
const std::string &  name = "",
const std::vector< std::string > &  category = {} 
)

Initialize the executor

Parameters
ctlController using this executor
configConfiguration of the executor
nameName of the executor, empty for the main executor
categoryCategory under which the executor will appear in the GUI, defaults to {"FSM"} for the main executor and {"FSM", name} for other executors

◆ interrupt()

void mc_control::fsm::Executor::interrupt ( )
inline

Trigger an interruption

◆ next()

bool mc_control::fsm::Executor::next ( )

Trigger next state

Returns
False if the FSM is not ready for next state

◆ next_state()

const std::string& mc_control::fsm::Executor::next_state ( ) const
inline

Returns the next state's name

◆ operator=() [1/2]

Executor& mc_control::fsm::Executor::operator= ( const Executor )
delete

◆ operator=() [2/2]

Executor& mc_control::fsm::Executor::operator= ( Executor &&  )
delete

◆ output()

const std::string& mc_control::fsm::Executor::output ( ) const
inline

Returns the latest state's output

◆ read_msg()

bool mc_control::fsm::Executor::read_msg ( std::string &  msg)

Pass message to current state (read-only)

◆ read_write_msg()

bool mc_control::fsm::Executor::read_write_msg ( std::string &  msg,
std::string &  out 
)

Pass message to current state (read-write)

◆ ready()

bool mc_control::fsm::Executor::ready ( ) const
inline

Returns true if the executor is ready for next transition

◆ resume()

bool mc_control::fsm::Executor::resume ( const std::string &  state)

Resume execution to a given state

Interrupt current state execution if needed

◆ run()

bool mc_control::fsm::Executor::run ( Controller ctl,
bool  keep_state 
)

Run the current state

Parameters
ctlController using this executor
keep_stateIf true, keep the state when it finishes its run
Returns
True if the execution is complete

◆ running()

bool mc_control::fsm::Executor::running ( ) const
inline

Returns true if the state is active

◆ state()

const std::string& mc_control::fsm::Executor::state ( ) const
inline

Returns the current state's name

◆ stop()

void mc_control::fsm::Executor::stop ( Controller ctl)

Stop the current stat eif necessary

Parameters
ctlController using this executor

◆ teardown()

void mc_control::fsm::Executor::teardown ( Controller ctl)

Teardown the current state if necessary

Parameters
ctlController using this executor

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