Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
MCRepeater.hGo to the documentation of this file.00001 //-*-c++-*- 00002 #ifndef INCLUDED_MCRepeater_h_ 00003 #define INCLUDED_MCRepeater_h_ 00004 00005 #include "Behaviors/BehaviorBase.h" 00006 #include "IPC/SharedObject.h" 00007 #include "Motion/MotionManager.h" 00008 #include "Events/EventRouter.h" 00009 00010 //! Sends a given MotionCommand to MotionManager, waits until it autoprunes, and then sends it again. 00011 class MCRepeater : public BehaviorBase { 00012 public: 00013 //! constructor 00014 MCRepeater(const SharedObjectBase* sharedmc) : BehaviorBase("MCRepeater"), mc(sharedmc) {} 00015 00016 virtual void DoStart() { 00017 BehaviorBase::DoStart(); // do this first 00018 MotionManager::MC_ID id=motman->addPrunableMotion(*mc); 00019 erouter->addListener(this,EventBase::motmanEGID,id,EventBase::deactivateETID); 00020 } 00021 00022 virtual void DoStop() { 00023 erouter->removeListener(this); 00024 BehaviorBase::DoStop(); // do this last 00025 } 00026 00027 virtual void processEvent(const EventBase& /*e*/) { 00028 erouter->removeListener(this); 00029 MotionManager::MC_ID id=motman->addPrunableMotion(*mc); 00030 erouter->addListener(this,EventBase::motmanEGID,id,EventBase::deactivateETID); 00031 } 00032 00033 static std::string getClassDescription() { return "Sends a given MotionCommand to MotionManager, waits until it autoprunes, and then sends it again."; } 00034 virtual std::string getDescription() const { return getClassDescription(); } 00035 00036 protected: 00037 const SharedObjectBase* mc; //!< the motion command being repeated 00038 00039 private: 00040 MCRepeater(const MCRepeater&); //!< don't call 00041 MCRepeater operator=(const MCRepeater&); //!< don't call 00042 }; 00043 00044 /*! @file 00045 * @brief Defines MCRepeater, which sends a given MotionCommand to MotionManager, waits until it autoprunes, and then sends it again. 00046 * @author ejt (Creator) 00047 * 00048 * $Author: ejt $ 00049 * $Name: tekkotsu-2_4_1 $ 00050 * $Revision: 1.6 $ 00051 * $State: Exp $ 00052 * $Date: 2005/06/01 05:47:45 $ 00053 */ 00054 00055 #endif |
Tekkotsu v2.4.1 |
Generated Tue Aug 16 16:32:47 2005 by Doxygen 1.4.4 |