Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
00001 //-*-c++-*- 00002 #ifndef INCLUDED_RelaxBehavior_h_ 00003 #define INCLUDED_RelaxBehavior_h_ 00004 00005 #include <iostream> 00006 #include "Behaviors/BehaviorBase.h" 00007 #include "Motion/PIDMC.h" 00008 #include "Shared/SharedObject.h" 00009 #include "Motion/MotionManager.h" 00010 00011 using namespace std; 00012 00013 //! A behavior that sets all the pids to zero for the tail and legs servos. 00014 /*! This should hopefully make the robot quieter and consume less power. */ 00015 class RelaxBehavior : public BehaviorBase { 00016 public: 00017 //! contstructor 00018 RelaxBehavior() : BehaviorBase(), pidMCID(MotionManager::invalid_MC_ID) {} 00019 00020 virtual void DoStart() { 00021 BehaviorBase::DoStart(); 00022 SharedObject<PIDMC> pidMC(0); 00023 // if you want to keep some joints from being turned off, e.g.: 00024 //pidMC->setJointPowerLevel(HeadOffset+TiltOffset,1); 00025 // (or you could change the contructor too...) 00026 // http://www.tekkotsu.org/dox/classPIDMC.html 00027 00028 // You could also change the priority level so that anytime 00029 // a joint is not in use it goes limp (try kBackgroundPriority) 00030 pidMCID=motman->addMotion(pidMC,MotionManager::kHighPriority,false); 00031 // the 'false' is to keep it from auto-pruning 00032 } 00033 virtual void DoStop() { 00034 motman->removeMotion(pidMCID); 00035 //this "one-shot" version of doing things will restore the PIDs 00036 motman->addMotion(SharedObject<PIDMC>(1)); 00037 BehaviorBase::DoStop(); 00038 } 00039 virtual std::string getName() const { return "RelaxBehavior"; } 00040 protected: 00041 MotionManager::MC_ID pidMCID; //!< the id for the pid motion command 00042 }; 00043 00044 #endif // INCLUDED_RelaxBehavior_h_ 00045 00046 /*! @file 00047 * @brief Describes RelaxBehavior, which sets all the pids to zero for the tail and legs servos. 00048 * @author Erik Berglund <tekkotsu.dev.spam.345@blog.no> (Creator) 00049 * @author ejt (Modifications) 00050 * 00051 * $Author: ejt $ 00052 * $Name: tekkotsu-2_0 $ 00053 * $Revision: 1.3 $ 00054 * $State: Exp $ 00055 * $Date: 2004/01/18 10:16:56 $ 00056 */
Tekkotsu v2.0 |
Generated Wed Jan 21 03:20:29 2004 by Doxygen 1.3.4 |