Homepage Demos Overview Downloads Tutorials Reference
Credits
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Search

FollowHeadBehavior.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_FollowHeadBehavior_h_
00003 #define INCLUDED_FollowHeadBehavior_h_
00004 
00005 #include "Behaviors/BehaviorBase.h"
00006 #include "Motion/MotionManager.h"
00007 
00008 //! Will walk where the head is pointing
00009 /*! Press the chin button to loosen the head to point it, release the
00010  *  button to lock it again
00011  *
00012  *  Tilt of head determines x axis (forward/backward)<br>
00013  *  Roll of head determines y axis (sideways strafing)<br>
00014  *  Pan of head determines z axis (rotational)
00015  *
00016  *  The zero point of joint position is zero motion.  Since the tilt
00017  *  is asymmetric (can tilt down farther than it can tilt up), the
00018  *  full range of the down tilt isn't used - if you tilt down farther
00019  *  than you could tilt it back, it'll just clip the speed.  Besides,
00020  *  if the head is all the way down, it screws up the walk because
00021  *  the center of balance is changed.
00022  */
00023 class FollowHeadBehavior : public BehaviorBase {
00024  public:
00025 
00026   //! just sets up the variables
00027   FollowHeadBehavior();
00028 
00029   //! calls DoStop() if isActive()
00030   virtual ~FollowHeadBehavior();
00031 
00032   //! Register for events and creates and adds two motion commands - a walker and a head pointer
00033   virtual void DoStart();
00034 
00035   //! Removes its two motion commands
00036   virtual void DoStop();
00037 
00038   //! Handles event processing
00039   /*! After every clock pulse, sets walk in direction of head */
00040   virtual void processEvent(const EventBase& e);
00041 
00042   virtual std::string getName() const { return "FollowHeadBehavior"; }
00043   static std::string getClassDescription() { return "Walks whereever you point the head - press the chin button to loosen the head, release to lock it"; }
00044 
00045  protected:
00046   const EventBase head_release; //!< event mask for releasing head (chin button down)
00047   const EventBase head_lock;    //!< event mask for locking head (chin button up)
00048   const EventBase clock;        //!< event mask for updating walk direction (every 150 ms)
00049   MotionManager::MC_ID walker_id;      //!< MC_ID for walker
00050 };
00051 
00052 /*! @file
00053  * @brief Describes FollowHeadBehavior, walks where the head is pointing
00054  * @author ejt (Creator)
00055  *
00056  * $Author: ejt $
00057  * $Name: tekkotsu-1_4_1 $
00058  * $Revision: 1.3 $
00059  * $State: Exp $
00060  * $Date: 2003/06/05 17:03:15 $
00061  */
00062 
00063 #endif

Tekkotsu v1.4
Generated Sat Jul 19 00:06:30 2003 by Doxygen 1.3.2