#include <mc_control/fsm/TransitionMap.h>
Public Types | |
using | origin_t = std::pair< std::string, std::string > |
Public Member Functions | |
std::pair< bool, Transition > | transition (const std::string &state, const std::string &output) const |
std::unordered_set< std::string > | transitions (const std::string &state) const |
void | init (const StateFactory &factory, const mc_rtc::Configuration &config) |
const std::string & | initState () const |
std::ostream & | print (std::ostream &os) const |
This class takes care of reading a transition map from a configuration entry and makes sure it's coherent with the states provided by the StateFactory.
A transition map is formed by entries of the form ["StateName", "OutputName", "NewStateName", "OptionalTriggerType"], e.g.:
If the "DEFAULT" output is present, this transition will be returned in case no other output pattern has been matched.
Valid values for the trigger type are:
using mc_control::fsm::TransitionMap::origin_t = std::pair<std::string, std::string> |
A (state, output) pair is the origin of a transition
void mc_control::fsm::TransitionMap::init | ( | const StateFactory & | factory, |
const mc_rtc::Configuration & | config | ||
) |
Build the map from a Configuration
The following entries are expected in config:
If init is absent, defaults to the first state in transitions
factory | The factory that will provie states |
config | Holds the JSON representation of this transition map |
const std::string& mc_control::fsm::TransitionMap::initState | ( | ) | const |
Returns the initial state value
std::ostream& mc_control::fsm::TransitionMap::print | ( | std::ostream & | os | ) | const |
Print the map
std::pair<bool, Transition> mc_control::fsm::TransitionMap::transition | ( | const std::string & | state, |
const std::string & | output | ||
) | const |
Return a transition given a current state and its ouput
state | The current state |
output | The state's output |
std::unordered_set<std::string> mc_control::fsm::TransitionMap::transitions | ( | const std::string & | state | ) | const |
For a given state, gives all possible next states