Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
TailWagNode.hGo to the documentation of this file.00001 //-*-c++-*- 00002 #ifndef INCLUDED_TailWagNode_h_ 00003 #define INCLUDED_TailWagNode_h_ 00004 00005 #include "Behaviors/StateNode.h" 00006 #include "Events/EventRouter.h" 00007 #include "Motion/TailWagMC.h" 00008 00009 //! A simple StateNode that executes a TailWagMC motion command 00010 class TailWagNode : public StateNode { 00011 protected: 00012 SharedObject<TailWagMC> tail_mc; //!< MotionCommand used by this node 00013 MotionManager::MC_ID tail_id; //!< id number for the MotionCommand 00014 00015 public: 00016 //! constructor 00017 TailWagNode(std::string nodename="TailWagNode") : 00018 StateNode("TailWagNode",nodename), tail_mc(), tail_id(MotionManager::invalid_MC_ID) {} 00019 00020 //! activate the node 00021 virtual void DoStart() { 00022 StateNode::DoStart(); 00023 tail_id = motman->addPersistentMotion(tail_mc); 00024 erouter->addListener(this,EventBase::motmanEGID,tail_id,EventBase::statusETID); 00025 } 00026 00027 //! deactivate the node 00028 virtual void DoStop() { 00029 motman->removeMotion(tail_id); 00030 tail_id = MotionManager::invalid_MC_ID; 00031 erouter->removeListener(this); 00032 StateNode::DoStop(); 00033 } 00034 00035 //! receive motmanEGID status event and throw stateMachineEGID status event - this doesn't ever actually happen for a TailWagMC, but just for completeness... 00036 virtual void processEvent(const EventBase&) { 00037 postCompletionEvent(); 00038 } 00039 00040 //! reveal the MotionCommand itself, use getMC_ID() instead if this node isActive(). 00041 SharedObject<TailWagMC>& getMC() { return tail_mc; } 00042 00043 //! reveal the MC_ID 00044 MotionManager::MC_ID& getMC_ID() { return tail_id; } 00045 00046 00047 }; 00048 00049 /*! @file 00050 * @brief Defines TailWagNode, a simple StateNode that runs a TailWagMC motion command 00051 * @author dst, ejt (Creators) 00052 * 00053 * $Author: ejt $ 00054 * $Name: tekkotsu-2_4_1 $ 00055 * $Revision: 1.2 $ 00056 * $State: Exp $ 00057 * $Date: 2005/01/24 22:23:50 $ 00058 */ 00059 00060 #endif |
Tekkotsu v2.4.1 |
Generated Tue Aug 16 16:32:49 2005 by Doxygen 1.4.4 |