00001
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
00012
00013 extern const char defWaypointWalkNodeName[];
00014
00015
00016 extern const char defWaypointWalkNodeDesc[];
00017
00018
00019 template<typename W, const char* mcName=defWaypointWalkNodeName, const char* mcDesc=defWaypointWalkNodeDesc>
00020 class WaypointEngineNode : public MCNode<W,mcName,mcDesc> {
00021 public:
00022
00023
00024 WaypointEngineNode() : MCNode<W,mcName,mcDesc>() {}
00025
00026
00027 WaypointEngineNode(const std::string& name) : MCNode<W,mcName,mcDesc>(name) {}
00028
00029
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
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
00051 typedef WaypointEngineNode<WaypointWalkMC> WaypointWalkNode;
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 #endif