mc_control::fsm::ParallelState Struct Reference

#include <mc_control/fsm/states/Parallel.h>

Inheritance diagram for mc_control::fsm::ParallelState:
Collaboration diagram for mc_control::fsm::ParallelState:

Classes

struct  DelayedState
 

Public Member Functions

void start (Controller &) override
 
bool run (Controller &) override
 
void stop (Controller &) override
 
void teardown (Controller &) override
 
bool read_msg (std::string &msg) override
 
bool read_write_msg (std::string &msg, std::string &out) override
 
std::vector< std::string > states () const
 
std::map< std::string, mc_rtc::Configurationconfigs () const
 
- Public Member Functions inherited from mc_control::fsm::State
virtual ~State ()
 
void configure_ (const mc_rtc::Configuration &config)
 
void start_ (Controller &ctl)
 
void teardown_ (Controller &ctl)
 
const std::string & output () const noexcept
 
const std::string & name ()
 
void name (const std::string &n)
 

Protected Attributes

double time_ = 0
 
std::vector< DelayedStatestates_
 
std::vector< std::string > outputStates_
 
bool finished_first_ = false
 
- Protected Attributes inherited from mc_control::fsm::State
mc_rtc::Configuration add_contacts_config_
 
mc_rtc::Configuration remove_contacts_config_
 
mc_rtc::Configuration add_contacts_after_config_
 
mc_rtc::Configuration remove_contacts_after_config_
 
mc_rtc::Configuration add_collisions_config_
 
mc_rtc::Configuration remove_collisions_config_
 
mc_rtc::Configuration add_collisions_after_config_
 
mc_rtc::Configuration remove_collisions_after_config_
 
mc_rtc::Configuration constraints_config_
 
mc_rtc::Configuration tasks_config_
 
mc_rtc::Configuration remove_posture_task_
 
mc_rtc::Configuration config_
 
std::vector< mc_solver::ConstraintSetPtrconstraints_
 
std::vector< std::pair< mc_tasks::MetaTaskPtr, mc_rtc::Configuration > > tasks_
 
std::vector< mc_tasks::PostureTaskPtrpostures_
 

Additional Inherited Members

- Protected Member Functions inherited from mc_control::fsm::State
void output (const std::string &o)
 
virtual void configure (const mc_rtc::Configuration &config)
 

Detailed Description

Implements parallel states

This states plays multiple states at once. Strictly speaking those states are not played in parallel but rather sequentially.

If this state plays {state_1, ..., state_N}. The state is completed when all state_i::run() function returns true and its output is state_N output.

Configuration entries:

  • states: list of states run by this state
  • delays: delay the start of the given state(s) by the given time (in seconds)
  • configs: for each state in states, configs(state) is used to further configure state

Example:

{ "states": [ "StateA", "StateB", "StateC" ], // Play StateA, StateB and StateC "delays": { "StateA": 1.0 }, // StateA will start one second after StateB and StateC "configs: { "StateB": {} } }

Member Function Documentation

◆ configs()

std::map<std::string, mc_rtc::Configuration> mc_control::fsm::ParallelState::configs ( ) const

◆ read_msg()

bool mc_control::fsm::ParallelState::read_msg ( std::string &  )
overridevirtual

Handle read service call

Reimplemented from mc_control::fsm::State.

◆ read_write_msg()

bool mc_control::fsm::ParallelState::read_write_msg ( std::string &  ,
std::string &   
)
overridevirtual

Handle read/write service call

Reimplemented from mc_control::fsm::State.

◆ run()

bool mc_control::fsm::ParallelState::run ( Controller ctl)
overridevirtual

Called every iteration until it returns true

Implements mc_control::fsm::State.

◆ start()

void mc_control::fsm::ParallelState::start ( Controller ctl)
overridevirtual

Called before the state starts being run

This will be called only once with the state fully configured.

Implements mc_control::fsm::State.

◆ states()

std::vector<std::string> mc_control::fsm::ParallelState::states ( ) const

◆ stop()

void mc_control::fsm::ParallelState::stop ( Controller )
overridevirtual

Called if the state is interrupted

Reimplemented from mc_control::fsm::State.

◆ teardown()

void mc_control::fsm::ParallelState::teardown ( Controller ctl)
overridevirtual

Called right before destruction

Implements mc_control::fsm::State.

Member Data Documentation

◆ finished_first_

bool mc_control::fsm::ParallelState::finished_first_ = false
protected

◆ outputStates_

std::vector<std::string> mc_control::fsm::ParallelState::outputStates_
protected

States used to generate the output. If multiple states output are used, they will generated according to the following pattern: State1: (State1 output), State2: (State2 output)

◆ states_

std::vector<DelayedState> mc_control::fsm::ParallelState::states_
protected

◆ time_

double mc_control::fsm::ParallelState::time_ = 0
protected

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