| Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
StateNode Class ReferenceRecursive data structure - both a state machine controller as well as a node within a state machine itself. More...
Inheritance diagram for StateNode:
![]()
Detailed DescriptionRecursive data structure - both a state machine controller as well as a node within a state machine itself. Override setup() to build your own Transition and StateNode network if you want this node to contain a state machine. Override DoStart() / DoStop() as you would a normal BehaviorBase subclass to have this node add some functionality of its own. You can override setup to create a sub-network, as well as overriding DoStart and DoStop, in the same class. See also the tutorial page on State Machines. There are two StateNode templates in project
Definition at line 30 of file StateNode.h. Member Enumeration DocumentationValues used in a SignalTrans for postStateSuccess and postStateFailure. Definition at line 122 of file StateNode.h. Constructor & Destructor Documentation
constructor, class name from typeid is used as instance name Definition at line 33 of file StateNode.h.
constructor, pass a name to use Definition at line 38 of file StateNode.h.
destructor, removes references to its outgoing transitions (be careful of incoming ones - they're still around!), and calls removeReference() on subnodes Definition at line 7 of file StateNode.cc.
don't call this Member Function Documentation
template<class T >
Adds a StateNode to nodes so it can be automatically dereferenced later, returns what it's passed (for convenience), calls addReference() on node. Also sets the node's parent to Definition at line 58 of file StateNode.h. Referenced by addNode(). Adds a StateNode to nodes so it can be automatically dereferenced later, returns what it's passed (for convenience), calls addReference() on node. Also sets the node's parent to Definition at line 29 of file StateNode.cc.
Adds the specified StateTransition to the transition table. Definition at line 22 of file StateNode.cc.
Override this to provide desired start-up functionality. Reimplemented from BehaviorBase. Definition at line 105 of file StateNode.h. Referenced by DoStartEvent(), and start().
Use with SignalTrans to receive a parameter sent via a DataEvent; will be called in place of regular DoStart(). If this default implementation is called, the child class must not have redefined DoStart(event), so we should call its DoStart(). Definition at line 109 of file StateNode.h. Referenced by startEvent().
template<typename T >
Extract data from a signal sent to this state via DoStartEvent. Definition at line 113 of file StateNode.h.
Returns the const std::vector of sub-nodes so you can read through them if need be. Definition at line 64 of file StateNode.h.
Returns the std::vector of sub-nodes so you can modify them yourself if need be. Definition at line 61 of file StateNode.h. Referenced by EventLogger::spider().
returns pointer to parent as a generic StateNode Definition at line 93 of file StateNode.h. Referenced by EventLogger::isListening(), parentAs(), postParentCompletion(), postParentFailure(), and postParentSuccess().
returns node with specified name that is a child of parent, or of parent's parent, etc. Definition at line 37 of file StateNode.cc. Referenced by getSibling().
Returns the const std::vector of transitions so you can read through them if need be. Definition at line 53 of file StateNode.h.
Returns the std::vector of transitions so you can modify them yourself if need be. Definition at line 50 of file StateNode.h.
template<class T >
returns correctly typed pointer to parent for access to its members Definition at line 96 of file StateNode.h.
Causes the parent state machine to complete; use this to return from a nested state machine. Definition at line 146 of file StateNode.h.
Causes the parent state machine to fail; use this to return failure from a nested state machine. Definition at line 149 of file StateNode.h.
Causes the parent state machine to succeed; use this to return success from a nested state machine. Definition at line 152 of file StateNode.h.
will post a status event through stateMachineEGID to signal "completion" of the node "completion" is defined by your subclass - will mean different things to different nodes depending on the actions they are performing. So call this yourself if there is a natural ending point for your state.
Definition at line 129 of file StateNode.cc. Referenced by postParentCompletion(), WaypointEngineNode< W, mcName, mcDesc >::processEvent(), SpeechNode::processEvent(), SoundNode::processEvent(), MotionSequenceNode< SIZE >::processEvent(), MCNodeBase::processEvent(), and DynamicMotionSequenceNode::processEvent().
posts a DataEvent<SuccessOrFailure>(failure) indicating failure of the node; meaning of failure is used-defined Definition at line 140 of file StateNode.h. Referenced by postParentFailure().
template<typename T >
Posts a DataEvent through stateSignalEGID that can be picked up by a SignalTrans. value is optional. Definition at line 155 of file StateNode.h.
will post an activation event through stateMachineEGID, used when DoStart() is called Definition at line 121 of file StateNode.cc. Referenced by startCommon().
will post an deactivation event through stateMachineEGID, used when DoStop() is called Definition at line 125 of file StateNode.cc. Referenced by stop().
posts a DataEvent<SuccessOrFailure>(success) indicating success of the node; meaning of success is used-defined Definition at line 143 of file StateNode.h. Referenced by postParentSuccess().
Sets the retain flag - if not retained, will removeReference() subnodes upon stop() and recreate them on start (by calling setup()) - may be too expensive to be worth saving memory... Definition at line 67 of file StateNode.h.
Set text to speak on node start. Definition at line 102 of file StateNode.h.
This is called by start() when it should setup the network of subnodes (if any). Definition at line 80 of file StateNode.h. Referenced by startCommon().
Transitions should call this when entering the state, so it can enable its transitions. Reimplemented from BehaviorBase. Reimplemented in DynamicMotionSequenceNode, GroupNode, LogNode, MCNodeBase, MotionSequenceNode< SIZE >, OutputNode, PostureNode, RecordMotionNode, SoundNode, SpeechNode, WalkEngineNode< W, mcName, mcDesc >, WalkToTargetNode, WaypointEngineNode< W, mcName, mcDesc >, XWalkNode, and WalkEngineNode< WalkMC, defWalkNodeName, defWalkNodeDesc >. Definition at line 45 of file StateNode.cc. Referenced by start(), OutputNode::start(), and startEvent().
Common code shared by start() and startEvent(). Reimplemented in MCNodeBase, WaypointEngineNode< W, mcName, mcDesc >, and XWalkNode. Definition at line 63 of file StateNode.cc. Referenced by start(), and startEvent().
Alternative to start() that is used when Transition::fire() passes an event that should be passed as an argument to DoStart. Reimplemented in DynamicMotionSequenceNode, MCNodeBase, MotionSequenceNode< SIZE >, PostureNode, SoundNode, SpeechNode, WalkEngineNode< W, mcName, mcDesc >, WaypointEngineNode< W, mcName, mcDesc >, XWalkNode, and WalkEngineNode< WalkMC, defWalkNodeName, defWalkNodeDesc >. Definition at line 54 of file StateNode.cc.
Transitions should call this when leaving the state, so it can disable its transitions. Reimplemented from BehaviorBase. Reimplemented in LogNode, MCNodeBase, RecordMotionNode, SoundNode, SpeechNode, WalkToTargetNode, and XWalkNode. Definition at line 91 of file StateNode.cc. Referenced by OutputNode::start().
This is called by stop() when you should destruct subnodes. Default implementation will take care of the subnodes and their transitions, you only need to worry about any *other* memory which may have been allocated. If none, you may not need implement this function at all. Definition at line 112 of file StateNode.cc. Referenced by stop(), and ~StateNode(). Member Data Documentation
this is set to true if the network has been setup but not destroyed (i.e. don't need to call setupSubNodes again) Definition at line 167 of file StateNode.h. Referenced by startCommon(), stop(), teardown(), and ~StateNode().
vector of StateNodes, just so they can be dereferenced again on DoStop() (unless retained) or ~StateNode() Definition at line 173 of file StateNode.h. Referenced by addNode(), getNodes(), getSibling(), GroupNode::start(), stop(), teardown(), and ~StateNode().
pointer to the machine that contains this node Definition at line 161 of file StateNode.h. Referenced by addNode(), getParent(), getSibling(), and startCommon().
this is set to true if the network should be retained between activations. Otherwise it's dereferenced upon DoStop(). (or at least removeReference() is called on subnodes) Definition at line 169 of file StateNode.h. Referenced by setRetain(), and stop().
Text to speak on node start (for debugging). Reimplemented in SpeechNode. Definition at line 179 of file StateNode.h. Referenced by setSpeechText(), and startCommon().
the timestamp of last call to start() Definition at line 171 of file StateNode.h. Referenced by postStateCompletion(), and postStateStop().
starting node (should be a member of nodes) Definition at line 176 of file StateNode.h. Referenced by start(), startEvent(), and teardown().
a vector of outgoing transitions Definition at line 163 of file StateNode.h. Referenced by addTransition(), getTransitions(), startCommon(), stop(), and ~StateNode(). The documentation for this class was generated from the following files: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Tekkotsu v5.0CVS |
Generated Thu Mar 18 06:35:39 2010 by Doxygen 1.6.3 |