Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
ToggleHeadLightBehavior.ccGo to the documentation of this file.00001 #if defined(TGT_ERS2xx) || defined(TGT_ERS220) 00002 00003 #include "Behaviors/BehaviorBase.h" 00004 #include "Motion/MotionPtr.h" 00005 #include "Motion/PostureMC.h" 00006 #include "Shared/ERS220Info.h" 00007 00008 //! opens or closes the head light on an ERS-220 00009 class ToggleHeadLightBehavior : public BehaviorBase { 00010 public: 00011 //! constructor 00012 ToggleHeadLightBehavior() : BehaviorBase("ToggleHeadLightBehavior"), light() {} 00013 00014 //! opens the head light 00015 virtual void doStart() { 00016 BehaviorBase::doStart(); 00017 if(RobotName == ERS220Info::TargetName) { 00018 unsigned int idx = ERS220Info::RetractableHeadLEDOffset; 00019 light->setOutputCmd(idx, state->outputs[idx]>0.5 ? 0 : 1); 00020 addMotion(light); 00021 } 00022 } 00023 00024 static std::string getClassDescription() { return "Opens or closes the head light on an ERS-220"; } 00025 virtual std::string getDescription() const { return getClassDescription(); } 00026 00027 protected: 00028 MotionPtr<PostureMC> light; //!< the PostureMC used to control the light 00029 }; 00030 00031 REGISTER_BEHAVIOR_MENU_OPT(ToggleHeadLightBehavior,"Background Behaviors",BEH_NONEXCLUSIVE); 00032 00033 #endif 00034 00035 /*! @file 00036 * @brief Defines ToggleHeadLightBehavior, which will open or close the head light on an ERS-220 00037 * @author ejt (Creator) 00038 */ |
Tekkotsu v5.1CVS |
Generated Mon May 9 04:58:52 2016 by Doxygen 1.6.3 |