00001
00002 #ifndef INCLUDED_MCRepeater_h_
00003 #define INCLUDED_MCRepeater_h_
00004
00005 #include "Behaviors/BehaviorBase.h"
00006 #include "Shared/SharedObject.h"
00007 #include "Motion/MotionManager.h"
00008 #include "Events/EventRouter.h"
00009
00010
00011 class MCRepeater : public BehaviorBase {
00012 public:
00013
00014 MCRepeater(const SharedObjectBase* sharedmc) : BehaviorBase(), mc(sharedmc) {}
00015
00016 virtual void DoStart() {
00017 BehaviorBase::DoStart();
00018 MotionManager::MC_ID id=motman->addMotion(*mc,true);
00019 erouter->addListener(this,EventBase::motmanEGID,id,EventBase::deactivateETID);
00020 }
00021
00022 virtual void DoStop() {
00023 erouter->forgetListener(this);
00024 BehaviorBase::DoStop();
00025 }
00026
00027 virtual void processEvent(const EventBase& ) {
00028 erouter->forgetListener(this);
00029 MotionManager::MC_ID id=motman->addMotion(*mc,true);
00030 erouter->addListener(this,EventBase::motmanEGID,id,EventBase::deactivateETID);
00031 }
00032
00033 virtual std::string getName() const { return "MCRepeater"; }
00034
00035 static std::string getClassDescription() { return "Sends a given MotionCommand to MotionManager, waits until it autoprunes, and then sends it again."; }
00036
00037 protected:
00038 const SharedObjectBase* mc;
00039
00040 private:
00041 MCRepeater(const MCRepeater&);
00042 MCRepeater operator=(const MCRepeater&);
00043 };
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 #endif