mc_control::fsm::PythonState Struct Reference

#include <mc_control/fsm/PythonState.h>

Inheritance diagram for mc_control::fsm::PythonState:
Collaboration diagram for mc_control::fsm::PythonState:

Public Member Functions

void configure (const mc_rtc::Configuration &config) override
 
void start (Controller &ctl) override
 
bool run (Controller &ctl) override
 
void teardown (Controller &ctl) override
 
void stop (Controller &ctl) override
 
const std::string & output () const noexcept
 
void output (const std::string &o)
 
- 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)
 
virtual bool read_msg (std::string &)
 
virtual bool read_write_msg (std::string &, std::string &)
 
const std::string & output () const noexcept
 
const std::string & name ()
 
void name (const std::string &n)
 

Public Attributes

std::function< void(const mc_rtc::Configuration &)> configure_ = [](const mc_rtc::Configuration &) {}
 
std::function< void(Controller &)> start_ = [](Controller &) {}
 
std::function< bool(Controller &)> run_ = [](Controller &) { return false; }
 
std::function< void(Controller &)> teardown_ = [](Controller &) {}
 
std::function< void(Controller &)> stop_ = [](Controller &) {}
 
std::function< bool()> handle_python_error
 

Additional Inherited Members

- Protected Member Functions inherited from mc_control::fsm::State
void output (const std::string &o)
 
- 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_
 

Detailed Description

Provides an interface for the Python bindings to fill-out

Member Function Documentation

◆ configure()

void mc_control::fsm::PythonState::configure ( const mc_rtc::Configuration config)
overridevirtual

Called to configure the state.

This is called multiple times:

  • once for every level of state inheritance
  • once with the executor configuration, this is the FSM global executor, the Meta state executor, the Parallel state or any state that handle other states

The default implementation simply loads the provided configuration into the config_ protected members. You can override this behavior to implement a more complex loading logic.

You can access this configuration either via the config_ variable

Reimplemented from mc_control::fsm::State.

◆ output() [1/2]

const std::string& mc_control::fsm::State::output
inlinenoexcept

Returns the output of the state, should only be consulted once run has returned true

◆ output() [2/2]

void mc_control::fsm::State::output
inline

Output setter for derived classes

◆ run()

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

Called every iteration until it returns true

Implements mc_control::fsm::State.

◆ start()

void mc_control::fsm::PythonState::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.

◆ stop()

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

Called if the state is interrupted

Reimplemented from mc_control::fsm::State.

◆ teardown()

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

Called right before destruction

Implements mc_control::fsm::State.

Member Data Documentation

◆ configure_

std::function<void(const mc_rtc::Configuration &)> mc_control::fsm::PythonState::configure_ = [](const mc_rtc::Configuration &) {}

◆ handle_python_error

std::function<bool()> mc_control::fsm::PythonState::handle_python_error

◆ run_

std::function<bool(Controller &)> mc_control::fsm::PythonState::run_ = [](Controller &) { return false; }

◆ start_

std::function<void(Controller &)> mc_control::fsm::PythonState::start_ = [](Controller &) {}

◆ stop_

std::function<void(Controller &)> mc_control::fsm::PythonState::stop_ = [](Controller &) {}

◆ teardown_

std::function<void(Controller &)> mc_control::fsm::PythonState::teardown_ = [](Controller &) {}

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