| 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 31 of file StateNode.h.
Member Enumeration DocumentationValues used in a SignalTrans for postStateSuccess and postStateFailure. Definition at line 126 of file StateNode.h. Constructor & Destructor Documentation
constructor, class name from typeid is used as instance name Definition at line 35 of file StateNode.h. Referenced by Grasper::setup(), Grasper::CloseTheGripper::setup(), Grasper::OpenTheGripper::setup(), and Grasper::Grasp::setup().
constructor, pass a name to use Definition at line 40 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 8 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 60 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 30 of file StateNode.cc. Referenced by LookAtMarkers::setup(), Grasper::setup(), Grasper::CloseTheGripper::setup(), Grasper::OpenTheGripper::setup(), Grasper::Rest::setup(), Grasper::Grasp::setup(), and Grasper::Plan::setup().
Adds the specified StateTransition to the transition table. Definition at line 23 of file StateNode.cc. Referenced by LookAtMarkers::setup(), Grasper::setup(), Grasper::CloseTheGripper::setup(), Grasper::OpenTheGripper::setup(), Grasper::Rest::setup(), Grasper::Grasp::setup(), and Grasper::Plan::setup().
temporary to produce warnings to help people update Definition at line 193 of file StateNode.h.
template<typename T >
Extract data from a signal sent to this state via Transition::fire(const EventBase&). Definition at line 107 of file StateNode.h.
template<class T >
returns a correctly typed pointer to ancestor of the specified type; user by $reference Definition at line 196 of file StateNode.h.
returns node with specified name that is a child of this node Definition at line 38 of file StateNode.cc.
Returns the const std::vector of sub-nodes so you can read through them if need be. Definition at line 66 of file StateNode.h.
Returns the std::vector of sub-nodes so you can modify them yourself if need be. Definition at line 63 of file StateNode.h. Referenced by EventLogger::spider().
returns pointer to parent as a generic StateNode Definition at line 88 of file StateNode.h. Referenced by LookAtMarkers::DummyFinish::doStart(), getAncestor(), EventLogger::isListening(), parentAs(), postParentCompletion(), postParentFailure(), postParentSignal(), and postParentSuccess().
returns node with specified name that is a child of parent, or of parent's parent, etc. Definition at line 44 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 55 of file StateNode.h.
Returns the std::vector of transitions so you can modify them yourself if need be. Definition at line 52 of file StateNode.h.
template<class T >
returns correctly typed pointer to parent for access to its members Definition at line 94 of file StateNode.h.
Causes the parent state machine to complete; use this to return from a nested state machine. Definition at line 150 of file StateNode.h. Referenced by PostMachineCompletion::doStart().
Causes the parent state machine to fail; use this to return failure from a nested state machine. Definition at line 153 of file StateNode.h. Referenced by PostMachineFailure::doStart().
template<typename T >
Causes the parent state machine to post a DataEvent through stateSignalEGID. value is optional. Definition at line 159 of file StateNode.h.
Causes the parent state machine to succeed; use this to return success from a nested state machine. Definition at line 156 of file StateNode.h. Referenced by PostMachineSuccess::doStart().
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 134 of file StateNode.cc. Referenced by WaypointEngineNode< W, mcName, mcDesc >::doEvent(), SpeechNode::doEvent(), SoundNode::doEvent(), MotionSequenceNode< SIZE >::doEvent(), MCNodeBase::doEvent(), LookAtMarkers::Search::doEvent(), LookAtMarkers::TrackMarker::doEvent(), DynamicMotionSequenceNode::doEvent(), SetWrist::doStart(), ResetInitialPlacementXX::doStart(), LookAtMarkers::SelectMarker::doStart(), Grasper::PathPlanToRest::doStart(), Grasper::PathPlanConstrained::doStart(), Grasper::PathPlanUnconstrained::doStart(), SetJoint::moveJoint(), postParentCompletion(), SpeechNode::postStart(), WalkForward::setID(), WalkSideways::setID(), Turn::setID(), Rock::setID(), Sway::setID(), Twist::setID(), and SetGround::setID().
posts a DataEvent<SuccessOrFailure>(failure) indicating failure of the node; meaning of failure is used-defined Definition at line 144 of file StateNode.h. Referenced by MCNodeBase::motionFails(), and postParentFailure().
template<typename T >
Posts a DataEvent through stateSignalEGID that can be picked up by a SignalTrans. value is optional. Definition at line 164 of file StateNode.h. Referenced by postParentSignal().
will post an activation event through stateMachineEGID, used when doStart() is called Definition at line 126 of file StateNode.cc. Referenced by start().
will post an deactivation event through stateMachineEGID, used when doStop() is called Definition at line 130 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 147 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 69 of file StateNode.h.
Set text to speak on node start. Definition at line 103 of file StateNode.h.
This is called by start() when it should setup the network of subnodes (if any). Reimplemented in Grasper::Plan, Grasper::Grasp, Grasper::Rest, Grasper::OpenTheGripper, Grasper::CloseTheGripper, Grasper, and LookAtMarkers. Definition at line 75 of file StateNode.h. Referenced by start().
Transitions should call this when entering the state, so it can enable its transitions. This could be implemented slightly more simply as a pre/postStart() pair, but keeping our specialization in start() itself allows us to keep pre/postStart empty (thus more robust to subclass overrides forgetting to call their superclass version, but also avoids any potential subclass mis-handling of transition fire while in preStart) Reimplemented from BehaviorBase. Definition at line 62 of file StateNode.cc. Referenced by Grasper::dispatch(), OutputNode::postStart(), and start().
Transitions should call this when leaving the state, so it can disable its transitions. Reimplemented from BehaviorBase. Reimplemented in LedActivate, LogNode, MCNodeBase, RecordMotionNode, SoundNode, SpeechNode, WalkNode, and WaypointEngineNode< W, mcName, mcDesc >. Definition at line 96 of file StateNode.cc. Referenced by LookAtMarkers::DummyFinish::doStart(), Grasper::NextRequest::doStart(), and OutputNode::postStart().
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 117 of file StateNode.cc. Referenced by stop(), and ~StateNode().
template<typename T >
Try to extract data from a signal sent to this state via Transition::fire(const EventBase&). Definition at line 117 of file StateNode.h. Friends And Related Function Documentation
Definition at line 32 of file StateNode.h. 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 176 of file StateNode.h. Referenced by start(), stop(), teardown(), and ~StateNode().
vector of StateNodes, just so they can be dereferenced again on doStop() (unless retained) or ~StateNode() Definition at line 182 of file StateNode.h. Referenced by addNode(), getChild(), getNodes(), getSibling(), GroupNode::postStart(), stop(), teardown(), and ~StateNode().
pointer to the machine that contains this node Definition at line 170 of file StateNode.h. Referenced by addNode(), getParent(), getSibling(), and start().
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 178 of file StateNode.h. Referenced by setRetain(), and stop().
Text to speak on node start (for debugging). Definition at line 188 of file StateNode.h. Referenced by setSpeechText(), and start().
the timestamp of last call to start() Definition at line 180 of file StateNode.h. Referenced by postStateCompletion(), and postStateStop().
starting node (should be a member of nodes) Definition at line 185 of file StateNode.h. Referenced by LookAtMarkers::setup(), Grasper::setup(), Grasper::CloseTheGripper::setup(), Grasper::OpenTheGripper::setup(), Grasper::Rest::setup(), Grasper::Grasp::setup(), Grasper::Plan::setup(), start(), and teardown().
a vector of outgoing transitions Definition at line 172 of file StateNode.h. Referenced by addTransition(), getTransitions(), start(), stop(), and ~StateNode(). The documentation for this class was generated from the following files: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Tekkotsu v5.1CVS |
Generated Tue Jan 31 04:32:27 2012 by Doxygen 1.6.3 |