Orocos Real-Time Toolkit
2.9.0
|
State machine created by the scripting engine which represents a parsed state machine. More...
#include <rtt/scripting/ParsedStateMachine.hpp>
Public Types | |
typedef std::vector< StateMachinePtr > | ChildList |
Public Member Functions | |
ParsedStateMachine () | |
virtual | ~ParsedStateMachine () |
ParsedStateMachinePtr | copy (std::map< const base::DataSourceBase *, base::DataSourceBase * > &replacements, bool instantiate=false) const |
Create a copy, set instantiate to 'true' if instantiating a RootMachine. More... | |
void | addParameter (const std::string &name, base::AttributeBase *var) |
base::AttributeBase * | getParameter (const std::string &name) const |
VisibleWritableValuesMap | getParameters () const |
std::vector< std::string > | getParameterNames () const |
void | setName (const std::string &name, bool recursive) |
Set the name of this machine. More... | |
std::string | getText () const |
Return the text to which getLineNumber() refers. More... | |
void | setText (std::string text) |
boost::shared_ptr< StateMachineService > | getService () const |
void | setService (boost::shared_ptr< StateMachineService > tc) |
bool | inState (const std::string &name) |
void | finish () |
Call this function if the state machine is parsed. More... | |
void | trace (bool on_off) |
Turn log(Debug) messages on or off to track state transitions. More... | |
bool | requestState (const std::string &statename) |
Request a transition to a given state. More... | |
bool | inState (const std::string &state) const |
Check if the state machine is in a given state. More... | |
bool | inStrictState (const std::string &state) const |
Check if the state machine is in a given state and not in the entry or exit program. More... | |
const std::string & | getCurrentStateName () const |
Return name of current state, empty string if not active. More... | |
bool | isStrictlyActive () const |
Strictly active, means active and not in a transition. More... | |
bool | inInitialState () const |
Inspect if we are in the initial state. More... | |
bool | inFinalState () const |
Inspect if we are in the final state. More... | |
bool | stepDone () const |
When isPaused(), return true if no step is pending, when isReactive(), return isStrictlyActive() More... | |
bool | isActive () const |
Returns true if the state machine is activated. More... | |
bool | isStopped () const |
Returns true if the state machine is in the final state, after a stop() directive. More... | |
bool | inError () const |
Get the error status of this StateMachine. More... | |
bool | isReactive () const |
Query if the state machine is currently reacting only to events. More... | |
bool | isAutomatic () const |
Query if the state machine is reacting to events and evaluating transition conditions. More... | |
bool | isPaused () const |
Query if the state machine is paused. More... | |
bool | activate () |
Start this StateMachine. More... | |
bool | pause () |
Pause the state machine. More... | |
bool | step () |
Execute a single action if the state machine is paused or evaluate the transition conditions if the state machine is reactive. More... | |
bool | automatic () |
Enter automatic mode: evaluating the transition conditions continuously. More... | |
bool | start () |
Enter automatic mode: evaluating the transition conditions continuously. More... | |
bool | stop () |
Bring the state machine to the safe final state and wait for events or requests. More... | |
bool | reset () |
Reset the state machine from the final state to the initial state and wait for events or requests. More... | |
bool | reactive () |
Switch to reactive mode from automatic mode. More... | |
bool | deactivate () |
Stop this StateMachine. More... | |
bool | execute () |
Used by the StateMachineProcessor to execute the next action(s) or state transitions. More... | |
void | loading () |
Informs this object that it got loaded in an ExecutionEngine. More... | |
StateInterface * | requestNextState (bool stepping=false) |
Search from the current state a candidate next state. More... | |
StateInterface * | requestNextStateStep () |
Go stepwise through evaluations to find out next state. More... | |
bool | requestFinalState () |
Request going to the Final State. More... | |
bool | requestInitialState () |
Request going to the Initial State. More... | |
StateInterface * | nextState () |
Search from the current state a candidate next state. More... | |
std::vector< std::string > | getStateList () const |
Get a list of the names of all the present states. More... | |
StateInterface * | getState (const std::string &name) const |
Lookup a State by name. More... | |
Status::StateMachineStatus | getStatus () const |
Get the status of this state machine. More... | |
std::string | getStatusStr () const |
Get the status in a readable string format. More... | |
void | addState (StateInterface *s) |
Add a State. More... | |
bool | requestStateChange (StateInterface *s_n) |
Request a state transition to a new state. More... | |
bool | executePending (bool stepping=false) |
Execute any pending State (exit, entry, handle) programs. More... | |
void | preconditionSet (StateInterface *state, ConditionInterface *cnd, int line) |
Express a precondition for entering a state. More... | |
void | transitionSet (StateInterface *from, StateInterface *to, ConditionInterface *cnd, int priority, int line) |
Express a possible transition from one state to another under a certain condition. More... | |
void | transitionSet (StateInterface *from, StateInterface *to, ConditionInterface *cnd, boost::shared_ptr< ProgramInterface > transprog, int priority, int line) |
Express a possible transition from one state to another under a certain condition. More... | |
bool | createEventTransition (ServicePtr sp, ExecutionEngine *target_engine, const std::string &ename, std::vector< base::DataSourceBase::shared_ptr > args, StateInterface *from, StateInterface *to, ConditionInterface *guard, boost::shared_ptr< ProgramInterface > transprog, StateInterface *elseto=0, boost::shared_ptr< ProgramInterface > elseprog=boost::shared_ptr< ProgramInterface >()) |
Express a possible transition from one state to another when an Event is fired under a certain condition (guard). More... | |
void | setInitialState (StateInterface *s) |
Set the initial state of this StateMachine. More... | |
void | setFinalState (StateInterface *s) |
Set the final state of this StateMachine. More... | |
StateInterface * | currentState () const |
Retrieve the current state of the state machine. More... | |
ProgramInterface * | currentProgram () const |
Retrieve the current program in execution. More... | |
StateInterface * | getInitialState () const |
Retrieve the initial state of the state machine. More... | |
StateInterface * | getFinalState () const |
Retrieve the final state of the state machine. More... | |
void | setInitCommand (base::ActionInterface *c) |
This was added for extra (non-user visible) initialisation when the StateMachine is activated. More... | |
base::ActionInterface * | getInitCommand () const |
StateMachinePtr | getParent () const |
Get the parent, returns zero if no parent. More... | |
void | setParent (StateMachinePtr parent) |
const ChildList & | getChildren () const |
Get a list of all child state machines. More... | |
void | addChild (StateMachinePtr child) |
const std::string & | getName () const |
This method must be overloaded to get a useful hierarchy. More... | |
int | getLineNumber () const |
Returns the current program line in execution,. More... | |
bool | inTransition () const |
Inspect if the StateMachine is performing a state transition. More... | |
bool | interruptible () const |
Inspect if the StateMachine is interruptible by events. More... | |
void | loaded (ExecutionEngine *ee) |
Called by the ExecutionEngine ee or before synchronous execution to tell this object it is being loaded. More... | |
void | unloaded () |
Called by the ExecutionEngine ee or after synchronous execution to tell this object it is being unloaded. More... | |
bool | isLoaded () |
Returns true if this object is loaded in an ExecutionEngine. More... | |
ExecutionEngine * | getEngine () |
Returns the ExecutionEngine this object is loaded into or null otherwise. More... | |
Protected Types | |
typedef std::vector< boost::tuple< ConditionInterface *, StateInterface *, int, int, boost::shared_ptr< ProgramInterface > > > | TransList |
The key is the current state, the value is the transition condition to another state with a certain priority (int), on a line (int), with a transition program. More... | |
typedef std::map< StateInterface *, TransList > | TransitionMap |
typedef std::multimap< StateInterface *, std::pair< ConditionInterface *, int > > | PreConditionMap |
typedef std::vector< boost::tuple< ServicePtr, std::string, std::vector< base::DataSourceBase::shared_ptr >, StateInterface *, ConditionInterface *, boost::shared_ptr< ProgramInterface >, Handle, StateInterface *, boost::shared_ptr< ProgramInterface > > > | EventList |
typedef std::map< StateInterface *, EventList > | EventMap |
typedef boost::weak_ptr< StateMachine > | StateMachineParentPtr |
Protected Member Functions | |
virtual void | unloading () |
Informs this object that it got unloaded from an ExecutionEngine. More... | |
void | changeState (StateInterface *s, ProgramInterface *tprog, bool stepping=false) |
void | leaveState (StateInterface *s) |
void | enterState (StateInterface *s) |
void | runState (StateInterface *s) |
void | handleState (StateInterface *s) |
bool | executeProgram (ProgramInterface *&cp, bool stepping) |
int | checkConditions (StateInterface *state, bool stepping=false) |
void | enableGlobalEvents () |
void | disableGlobalEvents () |
void | enableEvents (StateInterface *s) |
void | disableEvents (StateInterface *s) |
Protected Attributes | |
std::vector< StateMachinePtr > | _children |
StateMachineParentPtr | _parent |
std::string | _name |
Status::StateMachineStatus | smStatus |
TransitionMap | stateMap |
A map keeping track of all States and conditional transitions between two states. More... | |
PreConditionMap | precondMap |
A map keeping track of all preconditions of a state. More... | |
EventMap | eventMap |
A map keeping track of all events of a state. More... | |
ExecutionEngine * | engine |
State machine created by the scripting engine which represents a parsed state machine.
Definition at line 54 of file ParsedStateMachine.hpp.
|
inherited |
Definition at line 109 of file StateMachine.hpp.
|
protectedinherited |
Definition at line 98 of file StateMachine.hpp.
|
protectedinherited |
Definition at line 99 of file StateMachine.hpp.
|
protectedinherited |
Definition at line 92 of file StateMachine.hpp.
|
protectedinherited |
Definition at line 101 of file StateMachine.hpp.
|
protectedinherited |
Definition at line 91 of file StateMachine.hpp.
|
protectedinherited |
The key is the current state, the value is the transition condition to another state with a certain priority (int), on a line (int), with a transition program.
Definition at line 90 of file StateMachine.hpp.
RTT::ParsedStateMachine::ParsedStateMachine | ( | ) |
Definition at line 209 of file ParsedStateMachine.cpp.
|
virtual |
Definition at line 185 of file ParsedStateMachine.cpp.
|
inherited |
Start this StateMachine.
The Initial state will be entered.
Definition at line 1160 of file StateMachine.cpp.
References RTT::scripting::StateMachine::Status::activating, RTT::scripting::StateMachine::Status::active, RTT::scripting::StateMachine::checkConditions(), RTT::scripting::StateMachine::enableEvents(), RTT::scripting::StateMachine::enableGlobalEvents(), RTT::scripting::StateMachine::enterState(), RTT::base::ActionInterface::execute(), RTT::scripting::StateMachine::executePending(), RTT::scripting::StateMachine::getInitialState(), RTT::scripting::StateMachine::Status::inactive, RTT::scripting::StateMachine::inError(), RTT::base::ActionInterface::readArguments(), RTT::base::ActionInterface::reset(), RTT::scripting::StateMachine::smStatus, RTT::scripting::StateMachine::stateMap, and TRACE.
|
inlineinherited |
Definition at line 564 of file StateMachine.hpp.
Referenced by copy().
void RTT::ParsedStateMachine::addParameter | ( | const std::string & | name, |
base::AttributeBase * | var | ||
) |
Definition at line 228 of file ParsedStateMachine.cpp.
|
inherited |
Add a State.
If already present, changes nothing.
Definition at line 769 of file StateMachine.cpp.
References RTT::scripting::StateMachine::stateMap.
Referenced by RTT::scripting::StateMachine::StateMachine().
|
inherited |
Enter automatic mode: evaluating the transition conditions continuously.
Definition at line 208 of file StateMachine.cpp.
References RTT::scripting::StateMachine::Status::error, RTT::scripting::StateMachine::Status::inactive, RTT::scripting::StateMachine::Status::running, RTT::scripting::StateMachine::runState(), RTT::scripting::StateMachine::smStatus, TRACE, and RTT::scripting::StateMachine::Status::unloaded.
Referenced by RTT::scripting::StateMachine::start().
|
protectedinherited |
Definition at line 409 of file StateMachine.cpp.
References RTT::scripting::StateMachine::disableEvents(), RTT::scripting::StateMachine::Status::error, RTT::scripting::StateInterface::getName(), RTT::scripting::StateMachine::handleState(), RTT::scripting::StateMachine::leaveState(), RTT::scripting::ProgramInterface::reset(), RTT::scripting::StateMachine::runState(), RTT::scripting::StateMachine::smStatus, RTT::scripting::ProgramInterface::start(), RTT::scripting::StateMachine::stateMap, and TRACE.
Referenced by RTT::scripting::StateMachine::createEventTransition(), RTT::scripting::StateMachine::requestNextState(), and RTT::scripting::StateMachine::requestStateChange().
|
protectedinherited |
Definition at line 699 of file StateMachine.cpp.
References RTT::scripting::StateMachine::precondMap.
Referenced by RTT::scripting::StateMachine::activate(), RTT::scripting::StateMachine::createEventTransition(), RTT::scripting::StateMachine::nextState(), RTT::scripting::StateMachine::requestNextState(), and RTT::scripting::StateMachine::requestStateChange().
ParsedStateMachinePtr RTT::ParsedStateMachine::copy | ( | std::map< const base::DataSourceBase *, base::DataSourceBase * > & | replacements, |
bool | instantiate = false |
||
) | const |
Create a copy, set instantiate to 'true' if instantiating a RootMachine.
2a. rewrite ParsedStateMachine::copy to use (1) 2b. remove all old StateMachine in DataSource code ( code is deprecated by StateMachineCommands implementation)
Definition at line 54 of file ParsedStateMachine.cpp.
References RTT::scripting::StateMachine::addChild(), RTT::scripting::ConditionInterface::copy(), RTT::scripting::StateInterface::copy(), RTT::Logger::Debug, RTT::Logger::endl(), and RTT::Logger::log().
Referenced by inState().
|
inherited |
Express a possible transition from one state to another when an Event is fired under a certain condition (guard).
ename | The name of the Event under which a transition should be made |
args | The arguments which the event handler must set upon occurence. |
from | The state which should be left |
to | The state which should be entered |
guard | The Condition under which the transition may succeed |
transprog | The program to be executed between exit of from and entry of to. |
sp | The Service in which ename can be found. |
target_engine | The ExecutionEngine which will execute this StateMachine. |
Definition at line 500 of file StateMachine.cpp.
References RTT::scripting::StateMachine::changeState(), RTT::scripting::StateMachine::checkConditions(), RTT::Debug, RTT::Logger::endl(), RTT::Logger::Error, RTT::Error, RTT::scripting::ConditionInterface::evaluate(), RTT::scripting::StateMachine::eventMap, RTT::base::RunnableInterface::getActivity(), RTT::base::ExecutableInterface::getEngine(), RTT::scripting::StateInterface::getName(), RTT::scripting::StateMachine::inTransition(), RTT::Logger::log(), RTT::scripting::StateMachine::stateMap, RTT::base::ActivityInterface::timeout(), and TRACE.
|
inherited |
Retrieve the current program in execution.
Returns null if the StateMachine is not active or no programs are being run.
Definition at line 922 of file StateMachine.cpp.
|
inherited |
Retrieve the current state of the state machine.
Returns null if the StateMachine is not active.
Definition at line 917 of file StateMachine.cpp.
Referenced by inState(), and RTT::scripting::StateMachine::unloading().
|
inherited |
Stop this StateMachine.
The current state is left unconditionally.
Definition at line 1212 of file StateMachine.cpp.
References RTT::scripting::StateMachine::Status::deactivating, RTT::scripting::StateMachine::disableEvents(), RTT::scripting::StateMachine::disableGlobalEvents(), RTT::scripting::StateMachine::executePending(), RTT::scripting::StateMachine::Status::inactive, RTT::scripting::ProgramInterface::inError(), RTT::scripting::StateMachine::leaveState(), RTT::scripting::StateMachine::smStatus, and TRACE.
|
protectedinherited |
Definition at line 484 of file StateMachine.cpp.
References RTT::scripting::StateMachine::eventMap.
Referenced by RTT::scripting::StateMachine::changeState(), RTT::scripting::StateMachine::deactivate(), and RTT::scripting::StateMachine::disableGlobalEvents().
|
protectedinherited |
Definition at line 466 of file StateMachine.cpp.
References RTT::scripting::StateMachine::disableEvents().
Referenced by RTT::scripting::StateMachine::deactivate().
|
protectedinherited |
Definition at line 470 of file StateMachine.cpp.
References RTT::scripting::StateMachine::eventMap.
Referenced by RTT::scripting::StateMachine::activate(), RTT::scripting::StateMachine::enableGlobalEvents(), and RTT::scripting::StateMachine::executePending().
|
protectedinherited |
Definition at line 462 of file StateMachine.cpp.
References RTT::scripting::StateMachine::enableEvents().
Referenced by RTT::scripting::StateMachine::activate().
|
protectedinherited |
Definition at line 961 of file StateMachine.cpp.
References RTT::scripting::StateMachine::Status::error, RTT::scripting::StateInterface::getEntryProgram(), RTT::scripting::ProgramInterface::reset(), RTT::scripting::StateMachine::smStatus, RTT::scripting::ProgramInterface::start(), and RTT::scripting::StateMachine::stateMap.
Referenced by RTT::scripting::StateMachine::activate(), and RTT::scripting::StateMachine::executePending().
|
virtualinherited |
Used by the StateMachineProcessor to execute the next action(s) or state transitions.
Implements RTT::base::ExecutableInterface.
Definition at line 258 of file StateMachine.cpp.
References RTT::scripting::StateMachine::Status::activating, RTT::scripting::StateMachine::Status::active, RTT::scripting::StateMachine::Status::deactivating, RTT::scripting::StateMachine::Status::error, RTT::scripting::StateMachine::executePending(), RTT::scripting::StateMachine::Status::inactive, RTT::scripting::StateMachine::inTransition(), RTT::scripting::StateMachine::Status::paused, RTT::scripting::StateMachine::requestFinalState(), RTT::scripting::StateMachine::Status::requesting, RTT::scripting::StateMachine::requestInitialState(), RTT::scripting::StateMachine::requestNextState(), RTT::scripting::StateMachine::Status::resetting, RTT::scripting::StateMachine::Status::running, RTT::scripting::StateMachine::smStatus, RTT::scripting::StateMachine::Status::stopped, RTT::scripting::StateMachine::Status::stopping, TRACE, and RTT::scripting::StateMachine::Status::unloaded.
Referenced by RTT::scripting::StateMachine::unloading().
|
inherited |
Execute any pending State (exit, entry, handle) programs.
You must executePending, before calling requestState() or requestNextState(). You should only call requestState() or requestNextState() if executePending returns true.
Due to the pending requests, the currentState() may have changed.
stepping | provide true if the pending programs should be executed one step at a time. |
true | if nothing was pending |
false | if there was some program executing. |
Definition at line 979 of file StateMachine.cpp.
References RTT::scripting::StateMachine::enableEvents(), RTT::scripting::StateMachine::enterState(), RTT::scripting::StateMachine::executeProgram(), RTT::scripting::StateInterface::getName(), RTT::scripting::StateMachine::inError(), RTT::scripting::StateMachine::stateMap, and TRACE.
Referenced by RTT::scripting::StateMachine::activate(), RTT::scripting::StateMachine::deactivate(), RTT::scripting::StateMachine::execute(), and RTT::scripting::StateMachine::requestStateChange().
|
protectedinherited |
Definition at line 1109 of file StateMachine.cpp.
References RTT::scripting::StateMachine::Status::error, RTT::scripting::ProgramInterface::execute(), RTT::scripting::StateMachine::getLineNumber(), RTT::scripting::ProgramInterface::inError(), RTT::scripting::ProgramInterface::isStopped(), RTT::scripting::StateMachine::smStatus, RTT::scripting::ProgramInterface::step(), and TRACE.
Referenced by RTT::scripting::StateMachine::executePending().
void RTT::ParsedStateMachine::finish | ( | ) |
Call this function if the state machine is parsed.
Definition at line 304 of file ParsedStateMachine.cpp.
|
inlineinherited |
Get a list of all child state machines.
Definition at line 559 of file StateMachine.hpp.
Referenced by setName().
|
inlineinherited |
Return name of current state, empty string if not active.
Definition at line 164 of file StateMachine.hpp.
References RTT::scripting::StateInterface::getName().
|
inlineinherited |
Returns the ExecutionEngine this object is loaded into or null otherwise.
Definition at line 117 of file ExecutableInterface.hpp.
Referenced by RTT::scripting::StateMachine::createEventTransition(), RTT::scripting::StateMachine::loading(), RTT::scripting::FunctionGraph::~FunctionGraph(), and RTT::scripting::StateMachine::~StateMachine().
|
inlineinherited |
Retrieve the final state of the state machine.
Definition at line 522 of file StateMachine.hpp.
Referenced by RTT::scripting::StateMachine::unloading().
|
inlineinherited |
Definition at line 538 of file StateMachine.hpp.
|
inlineinherited |
Retrieve the initial state of the state machine.
Definition at line 515 of file StateMachine.hpp.
Referenced by RTT::scripting::StateMachine::activate().
|
inherited |
Returns the current program line in execution,.
Definition at line 861 of file StateMachine.cpp.
References RTT::scripting::StateInterface::getEntryPoint(), and RTT::scripting::ProgramInterface::getLineNumber().
Referenced by RTT::scripting::StateMachine::executeProgram(), and RTT::scripting::StateMachine::unloading().
|
inlineinherited |
This method must be overloaded to get a useful hierarchy.
Definition at line 572 of file StateMachine.hpp.
Referenced by RTT::scripting::StateGraphParser::storeOffset(), and RTT::scripting::StateMachine::unloading().
AttributeBase * RTT::ParsedStateMachine::getParameter | ( | const std::string & | name | ) | const |
Definition at line 236 of file ParsedStateMachine.cpp.
std::vector< std::string > RTT::ParsedStateMachine::getParameterNames | ( | ) | const |
Definition at line 248 of file ParsedStateMachine.cpp.
References RTT::internal::keys().
ParsedStateMachine::VisibleWritableValuesMap RTT::ParsedStateMachine::getParameters | ( | ) | const |
Definition at line 243 of file ParsedStateMachine.cpp.
|
inlineinherited |
Get the parent, returns zero if no parent.
Definition at line 546 of file StateMachine.hpp.
StateMachineServicePtr RTT::ParsedStateMachine::getService | ( | ) | const |
Definition at line 290 of file ParsedStateMachine.cpp.
Referenced by RTT::scripting::StateGraphParser::getParserResult(), setName(), and RTT::scripting::StateGraphParser::~StateGraphParser().
|
inherited |
Lookup a State by name.
Returns null if not found.
Definition at line 775 of file StateMachine.cpp.
References RTT::scripting::StateMachine::stateMap.
|
inherited |
Get a list of the names of all the present states.
Definition at line 759 of file StateMachine.cpp.
References RTT::scripting::StateInterface::getName(), and RTT::scripting::StateMachine::stateMap.
|
inherited |
Get the status of this state machine.
Definition at line 124 of file StateMachine.cpp.
References RTT::scripting::StateMachine::smStatus.
|
inherited |
Get the status in a readable string format.
Definition at line 128 of file StateMachine.cpp.
References RTT::scripting::StateMachine::Status::activating, RTT::scripting::StateMachine::Status::active, RTT::scripting::StateMachine::Status::deactivating, RTT::scripting::StateMachine::Status::error, RTT::scripting::StateMachine::Status::inactive, RTT::scripting::StateMachine::Status::paused, RTT::scripting::StateMachine::Status::requesting, RTT::scripting::StateMachine::Status::resetting, RTT::scripting::StateMachine::Status::running, RTT::scripting::StateMachine::smStatus, RTT::scripting::StateMachine::Status::stopped, RTT::scripting::StateMachine::Status::stopping, and RTT::scripting::StateMachine::Status::unloaded.
|
virtual |
Return the text to which getLineNumber() refers.
Reimplemented from RTT::scripting::StateMachine.
Definition at line 280 of file ParsedStateMachine.cpp.
|
protectedinherited |
Definition at line 950 of file StateMachine.cpp.
References RTT::scripting::StateMachine::Status::error, RTT::scripting::StateInterface::getHandleProgram(), RTT::scripting::ProgramInterface::reset(), RTT::scripting::StateMachine::smStatus, and RTT::scripting::ProgramInterface::start().
Referenced by RTT::scripting::StateMachine::changeState().
|
inlineinherited |
Get the error status of this StateMachine.
Definition at line 216 of file StateMachine.hpp.
Referenced by RTT::scripting::StateMachine::activate(), RTT::scripting::StateMachine::executePending(), and RTT::scripting::StateMachine::requestFinalState().
|
inlineinherited |
Inspect if we are in the final state.
Definition at line 188 of file StateMachine.hpp.
|
inlineinherited |
Inspect if we are in the initial state.
Definition at line 181 of file StateMachine.hpp.
bool RTT::ParsedStateMachine::inState | ( | const std::string & | name | ) |
Definition at line 297 of file ParsedStateMachine.cpp.
References copy(), RTT::scripting::StateMachine::currentState(), and RTT::scripting::StateInterface::getName().
|
inlineinherited |
Check if the state machine is in a given state.
Definition at line 143 of file StateMachine.hpp.
References RTT::scripting::StateInterface::getName().
|
inlineinherited |
Check if the state machine is in a given state and not in the entry or exit program.
Definition at line 154 of file StateMachine.hpp.
References RTT::scripting::StateInterface::getName().
|
inherited |
Inspect if the StateMachine is interruptible by events.
Only the run program may be interrupted, or if no program is currently executed.
Definition at line 1140 of file StateMachine.cpp.
Referenced by RTT::scripting::StateMachine::requestFinalState(), RTT::scripting::StateMachine::requestInitialState(), RTT::scripting::StateMachine::requestNextState(), and RTT::scripting::StateMachine::requestStateChange().
|
inherited |
Inspect if the StateMachine is performing a state transition.
A transition is in progress if entry, transition or exit programs are executed.
Definition at line 1135 of file StateMachine.cpp.
Referenced by RTT::scripting::StateMachine::createEventTransition(), and RTT::scripting::StateMachine::execute().
|
inlineinherited |
Returns true if the state machine is activated.
Definition at line 205 of file StateMachine.hpp.
Referenced by RTT::scripting::StateMachine::unloading().
|
inlineinherited |
Query if the state machine is reacting to events and evaluating transition conditions.
Definition at line 227 of file StateMachine.hpp.
Referenced by RTT::scripting::StateMachine::unloading().
|
inlineinherited |
Returns true if this object is loaded in an ExecutionEngine.
Definition at line 110 of file ExecutableInterface.hpp.
Referenced by RTT::RemoveMsg::done(), RTT::scripting::FunctionGraph::pause(), RTT::ExecutionEngine::removeFunction(), RTT::scripting::FunctionGraph::start(), RTT::scripting::FunctionGraph::step(), RTT::scripting::FunctionGraph::~FunctionGraph(), and RTT::scripting::StateMachine::~StateMachine().
|
inlineinherited |
Query if the state machine is paused.
Definition at line 232 of file StateMachine.hpp.
|
inlineinherited |
Query if the state machine is currently reacting only to events.
Definition at line 221 of file StateMachine.hpp.
Referenced by RTT::scripting::StateMachine::unloading().
|
inlineinherited |
Returns true if the state machine is in the final state, after a stop() directive.
Definition at line 211 of file StateMachine.hpp.
|
inlineinherited |
Strictly active, means active and not in a transition.
Definition at line 174 of file StateMachine.hpp.
|
protectedinherited |
Definition at line 927 of file StateMachine.cpp.
References RTT::scripting::StateMachine::Status::error, RTT::scripting::StateInterface::getExitProgram(), RTT::scripting::ProgramInterface::reset(), RTT::scripting::StateMachine::smStatus, and RTT::scripting::ProgramInterface::start().
Referenced by RTT::scripting::StateMachine::changeState(), and RTT::scripting::StateMachine::deactivate().
|
inlineinherited |
Called by the ExecutionEngine ee or before synchronous execution to tell this object it is being loaded.
The engine pointer is set first and the user's loading() function is called next.
ee | The pointer to the engine calling us. |
Definition at line 73 of file ExecutableInterface.hpp.
Referenced by RTT::scripting::StateInterface::loaded(), and RTT::ExecutionEngine::runFunction().
|
virtualinherited |
Informs this object that it got loaded in an ExecutionEngine.
Called by load() after the engine pointer is set.
Reimplemented from RTT::base::ExecutableInterface.
Definition at line 84 of file StateMachine.cpp.
References RTT::scripting::StateMachine::eventMap, RTT::base::ExecutableInterface::getEngine(), RTT::scripting::StateMachine::Status::inactive, RTT::scripting::StateMachine::smStatus, RTT::scripting::StateMachine::stateMap, and TRACE.
|
inherited |
Search from the current state a candidate next state.
If none is found, the current state is returned.
Definition at line 732 of file StateMachine.cpp.
References RTT::scripting::StateMachine::checkConditions(), and RTT::scripting::StateMachine::stateMap.
|
inherited |
Pause the state machine.
Definition at line 172 of file StateMachine.cpp.
References RTT::scripting::ProgramInterface::execute(), RTT::scripting::StateMachine::Status::inactive, RTT::scripting::ProgramInterface::pause(), RTT::scripting::StateMachine::smStatus, TRACE, and RTT::scripting::StateMachine::Status::unloaded.
|
inherited |
Express a precondition for entering a state.
The precondition will be chained (Logical AND) with any transition to this state. This means that any transition to this state will only succeed if all preconditions hold. If state is the initial state, the preconditions must be true to make actiate() succeed. If state is the final state, they will not be checked upon requestFinalState, since requestFinalState always succeeds.
state | The state for which the preconditions must hold |
cnd | The Pre-Condition under which a transition to this state may succeed |
line | The line number where this precondition was introduced. |
Definition at line 882 of file StateMachine.cpp.
References RTT::scripting::StateMachine::precondMap, and RTT::scripting::StateMachine::stateMap.
|
inherited |
Switch to reactive mode from automatic mode.
Definition at line 224 of file StateMachine.cpp.
References RTT::scripting::StateMachine::Status::active, RTT::scripting::StateMachine::Status::error, RTT::scripting::StateMachine::Status::inactive, RTT::scripting::StateMachine::smStatus, TRACE, and RTT::scripting::StateMachine::Status::unloaded.
|
inherited |
Request going to the Final State.
This will always proceed.
Definition at line 391 of file StateMachine.cpp.
References RTT::scripting::StateMachine::inError(), RTT::scripting::StateMachine::interruptible(), RTT::scripting::StateMachine::requestStateChange(), and TRACE.
Referenced by RTT::scripting::StateMachine::execute(), and RTT::scripting::StateMachine::unloading().
|
inherited |
Request going to the Initial State.
This function will only proceed if the current state is the Final State or the Initial State. If it fails, one can try to requestNextState() which may lead to the initial state anyway if the transition is set. This path is not tried by this function.
Definition at line 376 of file StateMachine.cpp.
References RTT::scripting::StateMachine::interruptible(), RTT::scripting::StateMachine::requestStateChange(), and TRACE.
Referenced by RTT::scripting::StateMachine::execute().
|
inherited |
Search from the current state a candidate next state.
If none is found, the current state is taken. Next, handle the resulting state.
stepping | provide true if the transition evaluations should be executed one at a time. |
Definition at line 616 of file StateMachine.cpp.
References RTT::scripting::StateMachine::changeState(), RTT::scripting::StateMachine::checkConditions(), RTT::scripting::StateMachine::interruptible(), and RTT::scripting::StateMachine::stateMap.
Referenced by RTT::scripting::StateMachine::execute().
|
inherited |
Go stepwise through evaluations to find out next state.
|
inlineinherited |
Request a transition to a given state.
Definition at line 132 of file StateMachine.hpp.
|
inherited |
Request a state transition to a new state.
If the transition is not set by transitionSet(), acquiering the state will fail.
s_n | The state to change to |
true | if the transition is successfull |
false | if the transition is not allowed |
Definition at line 786 of file StateMachine.cpp.
References RTT::scripting::StateMachine::changeState(), RTT::scripting::StateMachine::checkConditions(), RTT::scripting::StateMachine::executePending(), RTT::scripting::StateMachine::interruptible(), and RTT::scripting::StateMachine::stateMap.
Referenced by RTT::scripting::StateMachine::requestFinalState(), and RTT::scripting::StateMachine::requestInitialState().
|
inherited |
Reset the state machine from the final state to the initial state and wait for events or requests.
Definition at line 246 of file StateMachine.cpp.
References RTT::scripting::StateMachine::smStatus, RTT::scripting::StateMachine::Status::stopped, and TRACE.
|
protectedinherited |
Definition at line 939 of file StateMachine.cpp.
References RTT::scripting::StateMachine::Status::error, RTT::scripting::StateInterface::getRunProgram(), RTT::scripting::ProgramInterface::reset(), RTT::scripting::StateMachine::smStatus, and RTT::scripting::ProgramInterface::start().
Referenced by RTT::scripting::StateMachine::automatic(), and RTT::scripting::StateMachine::changeState().
|
inherited |
Set the final state of this StateMachine.
Definition at line 1150 of file StateMachine.cpp.
References RTT::scripting::StateMachine::stateMap.
|
inlineinherited |
This was added for extra (non-user visible) initialisation when the StateMachine is activated.
c | The command to execute upon each activate. c is aggregated by this state machine and deleted in the destructor. |
Definition at line 533 of file StateMachine.hpp.
|
inherited |
Set the initial state of this StateMachine.
Definition at line 1144 of file StateMachine.cpp.
References RTT::scripting::StateMachine::stateMap.
void RTT::ParsedStateMachine::setName | ( | const std::string & | name, |
bool | recursive | ||
) |
Set the name of this machine.
If recurisive == true, this also sets subMachines' names, to the given name + "." + the name they have been instantiated by in this machine.
Definition at line 253 of file ParsedStateMachine.cpp.
References RTT::scripting::StateMachine::_name, RTT::scripting::StateMachine::getChildren(), getService(), and setName().
Referenced by setName().
|
inlineinherited |
Definition at line 551 of file StateMachine.hpp.
void RTT::ParsedStateMachine::setService | ( | boost::shared_ptr< StateMachineService > | tc | ) |
Definition at line 293 of file ParsedStateMachine.cpp.
void RTT::ParsedStateMachine::setText | ( | std::string | text | ) |
Definition at line 285 of file ParsedStateMachine.cpp.
|
inherited |
Enter automatic mode: evaluating the transition conditions continuously.
Definition at line 203 of file StateMachine.cpp.
References RTT::scripting::StateMachine::automatic().
|
inherited |
Execute a single action if the state machine is paused or evaluate the transition conditions if the state machine is reactive.
Definition at line 187 of file StateMachine.cpp.
References RTT::scripting::StateMachine::Status::active, RTT::scripting::StateMachine::Status::paused, RTT::scripting::StateMachine::Status::requesting, RTT::scripting::StateMachine::smStatus, and TRACE.
|
inlineinherited |
When isPaused(), return true if no step is pending, when isReactive(), return isStrictlyActive()
Definition at line 196 of file StateMachine.hpp.
|
inherited |
Bring the state machine to the safe final state and wait for events or requests.
Definition at line 235 of file StateMachine.cpp.
References RTT::scripting::StateMachine::Status::inactive, RTT::scripting::StateMachine::smStatus, TRACE, and RTT::scripting::StateMachine::Status::unloaded.
Referenced by RTT::scripting::StateMachine::unloading().
|
inherited |
Turn log(Debug) messages on or off to track state transitions.
Definition at line 1156 of file StateMachine.cpp.
|
inherited |
Express a possible transition from one state to another under a certain condition.
from | The state which should be left |
to | The state which should be entered |
cnd | The Condition under which the transition may succeed |
priority | The priority of this transition; low number (like -1000) is low priority high number is high priority (like + 1000). Transitions of equal priority are traversed in an unspecified way. |
line | The line number where this transition was introduced. |
Definition at line 891 of file StateMachine.cpp.
|
inherited |
Express a possible transition from one state to another under a certain condition.
from | The state which should be left |
to | The state which should be entered |
cnd | The Condition under which the transition may succeed |
transprog | The program to be executed between exit of from and entry of to. May be null to indicate the empty program. |
priority | The priority of this transition; low number (like -1000) is low priority high number is high priority (like + 1000). Transitions of equal priority are traversed in an unspecified way. |
line | The line number where this transition was introduced. |
Definition at line 896 of file StateMachine.cpp.
References RTT::scripting::StateInterface::getName(), RTT::scripting::StateMachine::stateMap, and TRACE.
|
inlineinherited |
Called by the ExecutionEngine ee or after synchronous execution to tell this object it is being unloaded.
The user's loading() function is called first and the engine pointer is cleared next.
Definition at line 88 of file ExecutableInterface.hpp.
Referenced by RTT::ExecutionEngine::processFunctions(), RTT::ExecutionEngine::removeFunction(), and RTT::ExecutionEngine::~ExecutionEngine().
|
protectedvirtual |
Informs this object that it got unloaded from an ExecutionEngine.
Called by unload() before the engine pointer is cleared.
Reimplemented from RTT::base::ExecutableInterface.
Definition at line 215 of file ParsedStateMachine.cpp.
References RTT::scripting::StateMachine::unloading().
|
protectedinherited |
Definition at line 100 of file StateMachine.hpp.
|
protectedinherited |
Definition at line 104 of file StateMachine.hpp.
Referenced by setName(), and RTT::scripting::StateMachine::~StateMachine().
|
protectedinherited |
Definition at line 102 of file StateMachine.hpp.
|
protectedinherited |
Definition at line 63 of file ExecutableInterface.hpp.
|
protectedinherited |
A map keeping track of all events of a state.
Not all states need to be present as a key in this map.
Definition at line 620 of file StateMachine.hpp.
Referenced by RTT::scripting::StateMachine::createEventTransition(), RTT::scripting::StateMachine::disableEvents(), RTT::scripting::StateMachine::enableEvents(), and RTT::scripting::StateMachine::loading().
|
protectedinherited |
A map keeping track of all preconditions of a state.
Not all states need to be present as a key in this map.
Definition at line 614 of file StateMachine.hpp.
Referenced by RTT::scripting::StateMachine::checkConditions(), and RTT::scripting::StateMachine::preconditionSet().
|
protectedinherited |
Definition at line 105 of file StateMachine.hpp.
Referenced by RTT::scripting::StateMachine::activate(), RTT::scripting::StateMachine::automatic(), RTT::scripting::StateMachine::changeState(), RTT::scripting::StateMachine::deactivate(), RTT::scripting::StateMachine::enterState(), RTT::scripting::StateMachine::execute(), RTT::scripting::StateMachine::executeProgram(), RTT::scripting::StateMachine::getStatus(), RTT::scripting::StateMachine::getStatusStr(), RTT::scripting::StateMachine::handleState(), RTT::scripting::StateMachine::leaveState(), RTT::scripting::StateMachine::loading(), RTT::scripting::StateMachine::pause(), RTT::scripting::StateMachine::reactive(), RTT::scripting::StateMachine::reset(), RTT::scripting::StateMachine::runState(), RTT::scripting::StateMachine::step(), and RTT::scripting::StateMachine::stop().
|
protectedinherited |
A map keeping track of all States and conditional transitions between two states.
Every state of this StateMachine must be] present as a key in this map.
Definition at line 608 of file StateMachine.hpp.
Referenced by RTT::scripting::StateMachine::activate(), RTT::scripting::StateMachine::addState(), RTT::scripting::StateMachine::changeState(), RTT::scripting::StateMachine::createEventTransition(), RTT::scripting::StateMachine::enterState(), RTT::scripting::StateMachine::executePending(), RTT::scripting::StateMachine::getState(), RTT::scripting::StateMachine::getStateList(), RTT::scripting::StateMachine::loading(), RTT::scripting::StateMachine::nextState(), RTT::scripting::StateMachine::preconditionSet(), RTT::scripting::StateMachine::requestNextState(), RTT::scripting::StateMachine::requestStateChange(), RTT::scripting::StateMachine::setFinalState(), RTT::scripting::StateMachine::setInitialState(), and RTT::scripting::StateMachine::transitionSet().