Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

WaypointWalkNode.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_WaypointWalkNode_h_
00003 #define INCLUDED_WaypointWalkNode_h_
00004 
00005 #include "MCNode.h"
00006 #include "Motion/MotionManager.h"
00007 #include "Motion/WaypointWalkMC.h"
00008 #include "Events/EventRouter.h"
00009 #include "Events/LocomotionEvent.h"
00010 
00011 //!default name for WaypointEngineNode's (have to instantiate a variable in order to use as a template argument)
00012 /*! instantiation will be placed in MCNode.cc to avoid file bloat */
00013 extern const char defWaypointWalkNodeName[];
00014 //!default description for WaypointWalkNode's (have to instantiate a variable in order to use as a template argument)
00015 /*! instantiation will be placed in MCNode.cc to avoid file bloat */
00016 extern const char defWaypointWalkNodeDesc[];
00017 
00018 //! A StateNode for doing a waypoint walk, use the template parameter to specify a custom walk MC, or use the ::WaypointWalkNode typedef to accept the "default" walk
00019 template<typename W, const char* mcName=defWaypointWalkNodeName, const char* mcDesc=defWaypointWalkNodeDesc>
00020 class WaypointEngineNode : public MCNode<W,mcName,mcDesc> {
00021 public:
00022 
00023   //! constructor
00024   WaypointEngineNode() : MCNode<W,mcName,mcDesc>() {}
00025 
00026   //! constructor
00027   WaypointEngineNode(const std::string& name) : MCNode<W,mcName,mcDesc>(name) {}
00028 
00029   //!destructor
00030   ~WaypointEngineNode() {}
00031 
00032   virtual void DoStart() {
00033     MCNode<W,mcName,mcDesc>::DoStart();
00034     erouter->addListener(this,EventBase::locomotionEGID,MCNode<W,mcName,mcDesc>::getMC_ID(),EventBase::statusETID);
00035   }
00036 
00037 protected:
00038 
00039   //! constructor
00040   WaypointEngineNode(const std::string& className, const std::string& instanceName) : 
00041     MCNode<W,mcName,mcDesc>(className,instanceName) {}
00042 
00043   void processEvent(const EventBase &event) {
00044     if ( static_cast<const LocomotionEvent&>(event).isStop() )
00045       MCNode<W,mcName,mcDesc>::postCompletionEvent();
00046   }
00047 
00048 };
00049 
00050 //! the prototypical WaypointWalkNode, using a WaypointWalkMC
00051 typedef WaypointEngineNode<WaypointWalkMC> WaypointWalkNode;
00052 
00053 /*! @file
00054  * @brief Describes WaypointEngineNode,  a StateNode for doing a waypoint walk; use the template parameter to specify a custom waypoint walk MC, or use the WaypointWalkNode typedef to accept the "default" walk
00055  * @author dst (Creator)
00056  *
00057  * $Author: dst $
00058  * $Name: tekkotsu-4_0 $
00059  * $Revision: 1.1 $
00060  * $State: Exp $
00061  * $Date: 2007/02/26 08:42:51 $
00062  */
00063 
00064 #endif

Tekkotsu v4.0
Generated Thu Nov 22 00:54:56 2007 by Doxygen 1.5.4