A hierarchical StateMachine which is loaded in the Program Processor. More...
#include <StateMachine.hpp>
A hierarchical StateMachine which is loaded in the Program Processor.
A StateMachine can have children and one parent.
A StateMachine can have children and one parent.
Definition at line 72 of file install/include/rtt/scripting/StateMachine.hpp.
typedef std::vector<StateMachinePtr> RTT::scripting::StateMachine::ChildList |
Definition at line 109 of file rtt/scripting/StateMachine.hpp.
typedef std::vector<StateMachinePtr> RTT::scripting::StateMachine::ChildList |
Definition at line 109 of file install/include/rtt/scripting/StateMachine.hpp.
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> > > RTT::scripting::StateMachine::EventList [protected] |
Definition at line 98 of file rtt/scripting/StateMachine.hpp.
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> > > RTT::scripting::StateMachine::EventList [protected] |
Definition at line 98 of file install/include/rtt/scripting/StateMachine.hpp.
typedef std::map< StateInterface*, EventList > RTT::scripting::StateMachine::EventMap [protected] |
Definition at line 99 of file rtt/scripting/StateMachine.hpp.
typedef std::map< StateInterface*, EventList > RTT::scripting::StateMachine::EventMap [protected] |
Definition at line 99 of file install/include/rtt/scripting/StateMachine.hpp.
typedef std::multimap< StateInterface*, std::pair<ConditionInterface*, int> > RTT::scripting::StateMachine::PreConditionMap [protected] |
Definition at line 92 of file rtt/scripting/StateMachine.hpp.
typedef std::multimap< StateInterface*, std::pair<ConditionInterface*, int> > RTT::scripting::StateMachine::PreConditionMap [protected] |
Definition at line 92 of file install/include/rtt/scripting/StateMachine.hpp.
typedef boost::weak_ptr<StateMachine> RTT::scripting::StateMachine::StateMachineParentPtr [protected] |
Definition at line 101 of file rtt/scripting/StateMachine.hpp.
typedef boost::weak_ptr<StateMachine> RTT::scripting::StateMachine::StateMachineParentPtr [protected] |
Definition at line 101 of file install/include/rtt/scripting/StateMachine.hpp.
typedef std::map< StateInterface*, TransList > RTT::scripting::StateMachine::TransitionMap [protected] |
Definition at line 91 of file rtt/scripting/StateMachine.hpp.
typedef std::map< StateInterface*, TransList > RTT::scripting::StateMachine::TransitionMap [protected] |
Definition at line 91 of file install/include/rtt/scripting/StateMachine.hpp.
typedef std::vector< boost::tuple<ConditionInterface*, StateInterface*, int, int, boost::shared_ptr<ProgramInterface> > > RTT::scripting::StateMachine::TransList [protected] |
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 rtt/scripting/StateMachine.hpp.
typedef std::vector< boost::tuple<ConditionInterface*, StateInterface*, int, int, boost::shared_ptr<ProgramInterface> > > RTT::scripting::StateMachine::TransList [protected] |
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 install/include/rtt/scripting/StateMachine.hpp.
enum RTT::scripting::StateMachine::PrivateStatus [private] |
Definition at line 75 of file rtt/scripting/StateMachine.hpp.
enum RTT::scripting::StateMachine::PrivateStatus [private] |
Definition at line 75 of file install/include/rtt/scripting/StateMachine.hpp.
RTT::StateMachine::~StateMachine | ( | ) | [virtual] |
The destructor is virtual since ParsedStateMachine still inherits this class.
Definition at line 71 of file StateMachine.cpp.
RTT::scripting::StateMachine::StateMachine | ( | StateMachinePtr | parent, | |
const std::string & | name = "Default" | |||
) |
Create a new StateMachine with an optional parent. Set parent to zero for the top state machine. The initial Status of a StateMachine is always inactive.
virtual RTT::scripting::StateMachine::~StateMachine | ( | ) | [virtual] |
The destructor is virtual since ParsedStateMachine still inherits this class.
RTT::scripting::StateMachine::StateMachine | ( | StateMachinePtr | parent, | |
const std::string & | name = "Default" | |||
) |
Create a new StateMachine with an optional parent. Set parent to zero for the top state machine. The initial Status of a StateMachine is always inactive.
bool RTT::scripting::StateMachine::activate | ( | ) |
Start this StateMachine. The Initial state will be entered.
bool RTT::StateMachine::activate | ( | ) |
Start this StateMachine. The Initial state will be entered.
Definition at line 1145 of file StateMachine.cpp.
void RTT::scripting::StateMachine::addChild | ( | StateMachinePtr | child | ) | [inline] |
Definition at line 562 of file rtt/scripting/StateMachine.hpp.
void RTT::scripting::StateMachine::addChild | ( | StateMachinePtr | child | ) | [inline] |
Definition at line 562 of file install/include/rtt/scripting/StateMachine.hpp.
void RTT::scripting::StateMachine::addState | ( | StateInterface * | s | ) |
Add a State. If already present, changes nothing.
void RTT::StateMachine::addState | ( | StateInterface * | s | ) |
Add a State. If already present, changes nothing.
Definition at line 760 of file StateMachine.cpp.
bool RTT::scripting::StateMachine::automatic | ( | ) |
Enter automatic mode: evaluating the transition conditions continuously.
bool RTT::StateMachine::automatic | ( | ) |
Enter automatic mode: evaluating the transition conditions continuously.
Definition at line 209 of file StateMachine.cpp.
void RTT::scripting::StateMachine::changeState | ( | StateInterface * | s, | |
ProgramInterface * | tprog, | |||
bool | stepping = false | |||
) | [protected] |
void RTT::StateMachine::changeState | ( | StateInterface * | s, | |
ProgramInterface * | tprog, | |||
bool | stepping = false | |||
) | [protected] |
Definition at line 408 of file StateMachine.cpp.
int RTT::scripting::StateMachine::checkConditions | ( | StateInterface * | state, | |
bool | stepping = false | |||
) | [protected] |
int RTT::StateMachine::checkConditions | ( | StateInterface * | state, | |
bool | stepping = false | |||
) | [protected] |
Definition at line 691 of file StateMachine.cpp.
bool RTT::scripting::StateMachine::createEventTransition | ( | ServicePtr | sp, | |
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).
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. |
bool RTT::scripting::StateMachine::createEventTransition | ( | ServicePtr | sp, | |
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).
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. |
ProgramInterface* RTT::scripting::StateMachine::currentProgram | ( | ) | const |
Retrieve the current program in execution. Returns null if the StateMachine is not active or no programs are being run.
ProgramInterface * RTT::StateMachine::currentProgram | ( | ) | const |
Retrieve the current program in execution. Returns null if the StateMachine is not active or no programs are being run.
Definition at line 908 of file StateMachine.cpp.
StateInterface* RTT::scripting::StateMachine::currentState | ( | ) | const |
Retrieve the current state of the state machine. Returns null if the StateMachine is not active.
StateInterface * RTT::StateMachine::currentState | ( | ) | const |
Retrieve the current state of the state machine. Returns null if the StateMachine is not active.
Definition at line 903 of file StateMachine.cpp.
bool RTT::scripting::StateMachine::deactivate | ( | ) |
Stop this StateMachine. The current state is left unconditionally.
bool RTT::StateMachine::deactivate | ( | ) |
Stop this StateMachine. The current state is left unconditionally.
Definition at line 1195 of file StateMachine.cpp.
void RTT::scripting::StateMachine::disableEvents | ( | StateInterface * | s | ) | [protected] |
void RTT::StateMachine::disableEvents | ( | StateInterface * | s | ) | [protected] |
Definition at line 491 of file StateMachine.cpp.
void RTT::scripting::StateMachine::disableGlobalEvents | ( | ) | [protected] |
void RTT::StateMachine::disableGlobalEvents | ( | ) | [protected] |
Definition at line 473 of file StateMachine.cpp.
void RTT::scripting::StateMachine::enableEvents | ( | StateInterface * | s | ) | [protected] |
void RTT::StateMachine::enableEvents | ( | StateInterface * | s | ) | [protected] |
Definition at line 477 of file StateMachine.cpp.
void RTT::scripting::StateMachine::enableGlobalEvents | ( | ) | [protected] |
void RTT::StateMachine::enableGlobalEvents | ( | ) | [protected] |
Definition at line 469 of file StateMachine.cpp.
void RTT::scripting::StateMachine::enterState | ( | StateInterface * | s | ) | [protected] |
void RTT::StateMachine::enterState | ( | StateInterface * | s | ) | [protected] |
Definition at line 957 of file StateMachine.cpp.
bool RTT::scripting::StateMachine::eventTransition | ( | StateInterface * | from, | |
ConditionInterface * | c, | |||
ProgramInterface * | p, | |||
StateInterface * | to, | |||
ProgramInterface * | elsep, | |||
StateInterface * | elseto | |||
) | [private] |
Internal use only. Make a transition to state 'to' with transitionprogram 'p' under condition 'c'. if from != current or in transition already, discard transition.
bool RTT::StateMachine::eventTransition | ( | StateInterface * | from, | |
ConditionInterface * | c, | |||
ProgramInterface * | p, | |||
StateInterface * | to, | |||
ProgramInterface * | elsep, | |||
StateInterface * | elseto | |||
) | [private] |
Internal use only. Make a transition to state 'to' with transitionprogram 'p' under condition 'c'. if from != current or in transition already, discard transition.
Definition at line 561 of file StateMachine.cpp.
bool RTT::scripting::StateMachine::execute | ( | ) | [virtual] |
Used by the StateMachineProcessor to execute the next action(s) or state transitions.
Implements RTT::base::ExecutableInterface.
bool RTT::StateMachine::execute | ( | ) | [virtual] |
Used by the StateMachineProcessor to execute the next action(s) or state transitions.
Implements RTT::base::ExecutableInterface.
Definition at line 262 of file StateMachine.cpp.
bool RTT::scripting::StateMachine::executePending | ( | bool | stepping = false |
) |
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. |
bool RTT::StateMachine::executePending | ( | bool | stepping = false |
) |
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 981 of file StateMachine.cpp.
bool RTT::scripting::StateMachine::executeProgram | ( | ProgramInterface *& | cp, | |
bool | stepping | |||
) | [protected] |
bool RTT::StateMachine::executeProgram | ( | ProgramInterface *& | cp, | |
bool | stepping | |||
) | [protected] |
Definition at line 1093 of file StateMachine.cpp.
const ChildList& RTT::scripting::StateMachine::getChildren | ( | ) | const [inline] |
Get a list of all child state machines.
Definition at line 557 of file rtt/scripting/StateMachine.hpp.
const ChildList& RTT::scripting::StateMachine::getChildren | ( | ) | const [inline] |
Get a list of all child state machines.
Definition at line 557 of file install/include/rtt/scripting/StateMachine.hpp.
const std::string& RTT::scripting::StateMachine::getCurrentStateName | ( | ) | const [inline] |
Return name of current state, empty string if not active.
Definition at line 164 of file rtt/scripting/StateMachine.hpp.
const std::string& RTT::scripting::StateMachine::getCurrentStateName | ( | ) | const [inline] |
Return name of current state, empty string if not active.
Definition at line 164 of file install/include/rtt/scripting/StateMachine.hpp.
StateInterface* RTT::scripting::StateMachine::getFinalState | ( | ) | const [inline] |
Retrieve the final state of the state machine.
Definition at line 520 of file rtt/scripting/StateMachine.hpp.
StateInterface* RTT::scripting::StateMachine::getFinalState | ( | ) | const [inline] |
Retrieve the final state of the state machine.
Definition at line 520 of file install/include/rtt/scripting/StateMachine.hpp.
base::ActionInterface* RTT::scripting::StateMachine::getInitCommand | ( | ) | const [inline] |
Definition at line 536 of file rtt/scripting/StateMachine.hpp.
base::ActionInterface* RTT::scripting::StateMachine::getInitCommand | ( | ) | const [inline] |
Definition at line 536 of file install/include/rtt/scripting/StateMachine.hpp.
StateInterface* RTT::scripting::StateMachine::getInitialState | ( | ) | const [inline] |
Retrieve the initial state of the state machine.
Definition at line 513 of file rtt/scripting/StateMachine.hpp.
StateInterface* RTT::scripting::StateMachine::getInitialState | ( | ) | const [inline] |
Retrieve the initial state of the state machine.
Definition at line 513 of file install/include/rtt/scripting/StateMachine.hpp.
int RTT::scripting::StateMachine::getLineNumber | ( | ) | const |
Returns the current program line in execution,
int RTT::StateMachine::getLineNumber | ( | ) | const |
Returns the current program line in execution,
Definition at line 846 of file StateMachine.cpp.
const std::string& RTT::scripting::StateMachine::getName | ( | void | ) | const [inline] |
This method must be overloaded to get a useful hierarchy.
Definition at line 570 of file rtt/scripting/StateMachine.hpp.
const std::string& RTT::scripting::StateMachine::getName | ( | ) | const [inline] |
This method must be overloaded to get a useful hierarchy.
Definition at line 570 of file install/include/rtt/scripting/StateMachine.hpp.
StateMachinePtr RTT::scripting::StateMachine::getParent | ( | ) | const [inline] |
Get the parent, returns zero if no parent.
Definition at line 544 of file rtt/scripting/StateMachine.hpp.
StateMachinePtr RTT::scripting::StateMachine::getParent | ( | ) | const [inline] |
Get the parent, returns zero if no parent.
Definition at line 544 of file install/include/rtt/scripting/StateMachine.hpp.
StateInterface* RTT::scripting::StateMachine::getState | ( | const std::string & | name | ) | const |
Lookup a State by name. Returns null if not found.
StateInterface* RTT::scripting::StateMachine::getState | ( | const std::string & | name | ) | const |
Lookup a State by name. Returns null if not found.
std::vector<std::string> RTT::scripting::StateMachine::getStateList | ( | ) | const |
Get a list of the names of all the present states.
std::vector< std::string > RTT::StateMachine::getStateList | ( | ) | const |
Get a list of the names of all the present states.
Definition at line 750 of file StateMachine.cpp.
Status::StateMachineStatus RTT::scripting::StateMachine::getStatus | ( | ) | const |
Get the status of this state machine.
StateMachine::Status::StateMachineStatus RTT::StateMachine::getStatus | ( | ) | const |
Get the status of this state machine.
Definition at line 123 of file StateMachine.cpp.
std::string RTT::scripting::StateMachine::getStatusStr | ( | ) | const |
Get the status in a readable string format.
string RTT::StateMachine::getStatusStr | ( | ) | const |
Get the status in a readable string format.
Definition at line 127 of file StateMachine.cpp.
virtual std::string RTT::scripting::StateMachine::getText | ( | ) | const [virtual] |
Return the text to which getLineNumber() refers.
Reimplemented in RTT::scripting::ParsedStateMachine, and RTT::scripting::ParsedStateMachine.
string RTT::StateMachine::getText | ( | ) | const [virtual] |
Return the text to which getLineNumber() refers.
Reimplemented in RTT::scripting::ParsedStateMachine, and RTT::scripting::ParsedStateMachine.
Definition at line 863 of file StateMachine.cpp.
void RTT::scripting::StateMachine::handleState | ( | StateInterface * | s | ) | [protected] |
void RTT::StateMachine::handleState | ( | StateInterface * | s | ) | [protected] |
Definition at line 944 of file StateMachine.cpp.
bool RTT::scripting::StateMachine::inError | ( | ) | const [inline] |
Get the error status of this StateMachine.
Definition at line 216 of file rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::inError | ( | ) | const [inline] |
Get the error status of this StateMachine.
Definition at line 216 of file install/include/rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::inFinalState | ( | ) | const [inline] |
Inspect if we are in the final state.
Definition at line 188 of file rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::inFinalState | ( | ) | const [inline] |
Inspect if we are in the final state.
Definition at line 188 of file install/include/rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::inInitialState | ( | ) | const [inline] |
Inspect if we are in the initial state.
Definition at line 181 of file rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::inInitialState | ( | ) | const [inline] |
Inspect if we are in the initial state.
Definition at line 181 of file install/include/rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::inState | ( | const std::string & | state | ) | const [inline] |
Check if the state machine is in a given state.
Definition at line 143 of file rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::inState | ( | const std::string & | state | ) | const [inline] |
Check if the state machine is in a given state.
Definition at line 143 of file install/include/rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::inStrictState | ( | const std::string & | state | ) | const [inline] |
Check if the state machine is in a given state and not in the entry or exit program.
Definition at line 154 of file rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::inStrictState | ( | const std::string & | state | ) | const [inline] |
Check if the state machine is in a given state and not in the entry or exit program.
Definition at line 154 of file install/include/rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::interruptible | ( | ) | const |
Inspect if the StateMachine is interruptible by events. Only the run program may be interrupted, or if no program is currently executed.
bool RTT::StateMachine::interruptible | ( | ) | const |
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 1125 of file StateMachine.cpp.
bool RTT::scripting::StateMachine::inTransition | ( | ) | const |
Inspect if the StateMachine is performing a state transition. A transition is in progress if entry, transition or exit programs are executed.
bool RTT::StateMachine::inTransition | ( | ) | const |
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 1120 of file StateMachine.cpp.
bool RTT::scripting::StateMachine::isActive | ( | void | ) | const [inline] |
Returns true if the state machine is activated.
Definition at line 205 of file rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::isActive | ( | ) | const [inline] |
Returns true if the state machine is activated.
Definition at line 205 of file install/include/rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::isAutomatic | ( | ) | const [inline] |
Query if the state machine is reacting to events and evaluating transition conditions.
Definition at line 227 of file rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::isAutomatic | ( | ) | const [inline] |
Query if the state machine is reacting to events and evaluating transition conditions.
Definition at line 227 of file install/include/rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::isPaused | ( | ) | const [inline] |
Query if the state machine is paused.
Definition at line 232 of file rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::isPaused | ( | ) | const [inline] |
Query if the state machine is paused.
Definition at line 232 of file install/include/rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::isReactive | ( | ) | const [inline] |
Query if the state machine is currently reacting only to events.
Definition at line 221 of file rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::isReactive | ( | ) | const [inline] |
Query if the state machine is currently reacting only to events.
Definition at line 221 of file install/include/rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::isStopped | ( | ) | const [inline] |
Returns true if the state machine is in the final state, after a stop() directive.
Definition at line 211 of file rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::isStopped | ( | ) | const [inline] |
Returns true if the state machine is in the final state, after a stop() directive.
Definition at line 211 of file install/include/rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::isStrictlyActive | ( | ) | const [inline] |
Strictly active, means active and not in a transition.
Definition at line 174 of file rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::isStrictlyActive | ( | ) | const [inline] |
Strictly active, means active and not in a transition.
Definition at line 174 of file install/include/rtt/scripting/StateMachine.hpp.
void RTT::scripting::StateMachine::leaveState | ( | StateInterface * | s | ) | [protected] |
void RTT::StateMachine::leaveState | ( | StateInterface * | s | ) | [protected] |
Definition at line 913 of file StateMachine.cpp.
void RTT::scripting::StateMachine::loading | ( | ) | [virtual] |
Informs this object that it got loaded in an ExecutionEngine. Called by load() after the engine pointer is set.
Reimplemented from RTT::base::ExecutableInterface.
void RTT::StateMachine::loading | ( | ) | [virtual] |
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 81 of file StateMachine.cpp.
StateInterface* RTT::scripting::StateMachine::nextState | ( | ) |
Search from the current state a candidate next state. If none is found, the current state is returned.
StateInterface * RTT::StateMachine::nextState | ( | ) |
Search from the current state a candidate next state. If none is found, the current state is returned.
Definition at line 724 of file StateMachine.cpp.
bool RTT::scripting::StateMachine::pause | ( | ) |
Pause the state machine.
bool RTT::StateMachine::pause | ( | ) |
Pause the state machine.
Definition at line 171 of file StateMachine.cpp.
void RTT::scripting::StateMachine::preconditionSet | ( | StateInterface * | state, | |
ConditionInterface * | cnd, | |||
int | line | |||
) |
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. |
void RTT::StateMachine::preconditionSet | ( | StateInterface * | state, | |
ConditionInterface * | cnd, | |||
int | line | |||
) |
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 867 of file StateMachine.cpp.
bool RTT::scripting::StateMachine::reactive | ( | ) |
Switch to reactive mode from automatic mode.
bool RTT::StateMachine::reactive | ( | ) |
Switch to reactive mode from automatic mode.
Definition at line 225 of file StateMachine.cpp.
bool RTT::scripting::StateMachine::requestFinalState | ( | ) |
Request going to the Final State. This will always proceed.
bool RTT::StateMachine::requestFinalState | ( | ) |
Request going to the Final State. This will always proceed.
Definition at line 390 of file StateMachine.cpp.
bool RTT::scripting::StateMachine::requestInitialState | ( | ) |
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.
bool RTT::StateMachine::requestInitialState | ( | ) |
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 375 of file StateMachine.cpp.
StateInterface* RTT::scripting::StateMachine::requestNextState | ( | bool | stepping = false |
) |
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. |
StateInterface * RTT::StateMachine::requestNextState | ( | bool | stepping = false |
) |
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 608 of file StateMachine.cpp.
StateInterface* RTT::scripting::StateMachine::requestNextStateStep | ( | ) |
Go stepwise through evaluations to find out next state.
StateInterface* RTT::scripting::StateMachine::requestNextStateStep | ( | ) |
Go stepwise through evaluations to find out next state.
bool RTT::scripting::StateMachine::requestState | ( | const std::string & | statename | ) | [inline] |
Request a transition to a given state.
Definition at line 132 of file rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::requestState | ( | const std::string & | statename | ) | [inline] |
Request a transition to a given state.
Definition at line 132 of file install/include/rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::requestStateChange | ( | StateInterface * | s_n | ) |
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 |
bool RTT::StateMachine::requestStateChange | ( | StateInterface * | s_n | ) |
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 777 of file StateMachine.cpp.
bool RTT::scripting::StateMachine::reset | ( | ) |
Reset the state machine from the final state to the initial state and wait for events or requests.
bool RTT::StateMachine::reset | ( | ) |
Reset the state machine from the final state to the initial state and wait for events or requests.
Definition at line 249 of file StateMachine.cpp.
void RTT::scripting::StateMachine::runState | ( | StateInterface * | s | ) | [protected] |
void RTT::StateMachine::runState | ( | StateInterface * | s | ) | [protected] |
Definition at line 930 of file StateMachine.cpp.
void RTT::scripting::StateMachine::setFinalState | ( | StateInterface * | s | ) |
Set the final state of this StateMachine.
void RTT::StateMachine::setFinalState | ( | StateInterface * | s | ) |
Set the final state of this StateMachine.
Definition at line 1135 of file StateMachine.cpp.
void RTT::scripting::StateMachine::setInitCommand | ( | base::ActionInterface * | c | ) | [inline] |
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 531 of file rtt/scripting/StateMachine.hpp.
void RTT::scripting::StateMachine::setInitCommand | ( | base::ActionInterface * | c | ) | [inline] |
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 531 of file install/include/rtt/scripting/StateMachine.hpp.
void RTT::scripting::StateMachine::setInitialState | ( | StateInterface * | s | ) |
Set the initial state of this StateMachine.
void RTT::StateMachine::setInitialState | ( | StateInterface * | s | ) |
Set the initial state of this StateMachine.
Definition at line 1129 of file StateMachine.cpp.
void RTT::scripting::StateMachine::setParent | ( | StateMachinePtr | parent | ) | [inline] |
Definition at line 549 of file rtt/scripting/StateMachine.hpp.
void RTT::scripting::StateMachine::setParent | ( | StateMachinePtr | parent | ) | [inline] |
Definition at line 549 of file install/include/rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::start | ( | ) |
Enter automatic mode: evaluating the transition conditions continuously.
bool RTT::StateMachine::start | ( | ) |
Enter automatic mode: evaluating the transition conditions continuously.
Definition at line 204 of file StateMachine.cpp.
bool RTT::scripting::StateMachine::step | ( | ) |
Execute a single action if the state machine is paused or evaluate the transition conditions if the state machine is reactive.
bool RTT::StateMachine::step | ( | ) |
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.
bool RTT::scripting::StateMachine::stepDone | ( | ) | const [inline] |
When isPaused(), return true if no step is pending, when isReactive(), return isStrictlyActive()
Definition at line 196 of file rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::stepDone | ( | ) | const [inline] |
When isPaused(), return true if no step is pending, when isReactive(), return isStrictlyActive()
Definition at line 196 of file install/include/rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::stop | ( | ) |
Bring the state machine to the safe final state and wait for events or requests.
bool RTT::StateMachine::stop | ( | ) |
Bring the state machine to the safe final state and wait for events or requests.
Definition at line 237 of file StateMachine.cpp.
void RTT::scripting::StateMachine::trace | ( | bool | on_off | ) |
Turn log(Debug) messages on or off to track state transitions.
void RTT::StateMachine::trace | ( | bool | on_off | ) |
Turn log(Debug) messages on or off to track state transitions.
Definition at line 1141 of file StateMachine.cpp.
void RTT::scripting::StateMachine::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.
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. |
void RTT::scripting::StateMachine::transitionSet | ( | StateInterface * | from, | |
StateInterface * | to, | |||
ConditionInterface * | cnd, | |||
int | priority, | |||
int | line | |||
) |
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. |
void RTT::StateMachine::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.
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 881 of file StateMachine.cpp.
void RTT::StateMachine::transitionSet | ( | StateInterface * | from, | |
StateInterface * | to, | |||
ConditionInterface * | cnd, | |||
int | priority, | |||
int | line | |||
) |
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 876 of file StateMachine.cpp.
void RTT::scripting::StateMachine::unloading | ( | ) | [virtual] |
Informs this object that it got unloaded from an ExecutionEngine. Called by unload() before the engine pointer is cleared.
Reimplemented from RTT::base::ExecutableInterface.
Reimplemented in RTT::scripting::ParsedStateMachine, and RTT::scripting::ParsedStateMachine.
void RTT::StateMachine::unloading | ( | ) | [virtual] |
Informs this object that it got unloaded from an ExecutionEngine. Called by unload() before the engine pointer is cleared.
Reimplemented from RTT::base::ExecutableInterface.
Reimplemented in RTT::scripting::ParsedStateMachine, and RTT::scripting::ParsedStateMachine.
Definition at line 105 of file StateMachine.cpp.
std::vector< StateMachinePtr > RTT::scripting::StateMachine::_children [protected] |
Definition at line 100 of file install/include/rtt/scripting/StateMachine.hpp.
std::string RTT::scripting::StateMachine::_name [protected] |
Definition at line 104 of file install/include/rtt/scripting/StateMachine.hpp.
Definition at line 102 of file install/include/rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::checking_precond [private] |
Definition at line 682 of file install/include/rtt/scripting/StateMachine.hpp.
StateInterface * RTT::scripting::StateMachine::current [private] |
The current state the Machine is in. current == 0 means that the state machine is currently inactive.
Definition at line 662 of file install/include/rtt/scripting/StateMachine.hpp.
Definition at line 674 of file install/include/rtt/scripting/StateMachine.hpp.
Definition at line 672 of file install/include/rtt/scripting/StateMachine.hpp.
Definition at line 673 of file install/include/rtt/scripting/StateMachine.hpp.
Definition at line 671 of file install/include/rtt/scripting/StateMachine.hpp.
Definition at line 675 of file install/include/rtt/scripting/StateMachine.hpp.
Definition at line 676 of file install/include/rtt/scripting/StateMachine.hpp.
static std::string RTT::scripting::StateMachine::emptyString [static, private] |
Definition at line 77 of file install/include/rtt/scripting/StateMachine.hpp.
int RTT::scripting::StateMachine::evaluating [private] |
Definition at line 685 of file install/include/rtt/scripting/StateMachine.hpp.
EventMap RTT::scripting::StateMachine::eventMap [protected] |
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 618 of file install/include/rtt/scripting/StateMachine.hpp.
Definition at line 687 of file install/include/rtt/scripting/StateMachine.hpp.
The Final State.
Definition at line 656 of file install/include/rtt/scripting/StateMachine.hpp.
Definition at line 669 of file install/include/rtt/scripting/StateMachine.hpp.
The Initial State.
Definition at line 651 of file install/include/rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::mstep [private] |
Definition at line 683 of file install/include/rtt/scripting/StateMachine.hpp.
bool RTT::scripting::StateMachine::mtrace [private] |
Definition at line 683 of file install/include/rtt/scripting/StateMachine.hpp.
StateInterface * RTT::scripting::StateMachine::next [private] |
The next state the Machine will go to.
Definition at line 667 of file install/include/rtt/scripting/StateMachine.hpp.
std::pair< PreConditionMap::const_iterator, PreConditionMap::const_iterator > RTT::scripting::StateMachine::prec_it [private] |
Definition at line 681 of file install/include/rtt/scripting/StateMachine.hpp.
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 612 of file install/include/rtt/scripting/StateMachine.hpp.
TransList::iterator RTT::scripting::StateMachine::reqend [private] |
Definition at line 679 of file install/include/rtt/scripting/StateMachine.hpp.
TransList::iterator RTT::scripting::StateMachine::reqstep [private] |
Definition at line 678 of file install/include/rtt/scripting/StateMachine.hpp.
Definition at line 105 of file install/include/rtt/scripting/StateMachine.hpp.
TransitionMap RTT::scripting::StateMachine::stateMap [protected] |
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 606 of file install/include/rtt/scripting/StateMachine.hpp.