Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

ToggleHeadLightBehavior.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_ToggleHeadLightBehavior_h_
00003 #define INCLUDED_ToggleHeadLightBehavior_h_
00004 
00005 #include "IPC/SharedObject.h"
00006 #include "Motion/PostureMC.h"
00007 #include "Shared/ERS220Info.h"
00008 
00009 //! opens or closes the head light on an ERS-220
00010 class ToggleHeadLightBehavior : public BehaviorBase {
00011 public:
00012   //! constructor
00013   ToggleHeadLightBehavior() : BehaviorBase("ToggleHeadLightBehavior"), light_id(MotionManager::invalid_MC_ID) {}
00014 
00015   //! opens the head light
00016   virtual void DoStart() {
00017     BehaviorBase::DoStart();
00018     if(state->robotDesign & WorldState::ERS220Mask) {
00019       SharedObject<PostureMC> pose;
00020       pose->setOutputCmd(ERS220Info::RetractableHeadLEDOffset,true);
00021       light_id=motman->addPersistentMotion(pose);
00022     }
00023   }
00024 
00025   //! resets the head light
00026   virtual void DoStop() {
00027     motman->removeMotion(light_id);
00028   }
00029 
00030   static std::string getClassDescription() { return "Opens or closes the head light on an ERS-220"; }
00031   virtual std::string getDescription() const { return getClassDescription(); }
00032 
00033 protected:
00034   MotionManager::MC_ID light_id; //!< id value of the PostureMC used to control the light
00035 };
00036 
00037 /*! @file
00038  * @brief Defines ToggleHeadLightBehavior, which will open or close the head light on an ERS-220
00039  * @author ejt (Creator)
00040  *
00041  * $Author: ejt $
00042  * $Name: tekkotsu-2_4_1 $
00043  * $Revision: 1.5 $
00044  * $State: Exp $
00045  * $Date: 2005/06/01 05:47:45 $
00046  */
00047 
00048 #endif

Tekkotsu v2.4.1
Generated Tue Aug 16 16:32:49 2005 by Doxygen 1.4.4