Homepage Demos Overview Downloads Tutorials Reference
Credits

RemoteControllerMC.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_RemoteControllerMC_h
00003 #define INCLUDED_RemoteControllerMC_h
00004 
00005 #include "MotionCommand.h"
00006 #include "OutputCmd.h"
00007 #include "Shared/RobotInfo.h"
00008 
00009 //! This class is used for setting all PIDJoints to a certain set of values (not the gains, just the joint positions)
00010 /*! This is PostureMC's little brother.  Not quite so full of features, but straightforward and easy to understand. (hopefully) */
00011 class RemoteControllerMC : public MotionCommand {
00012  public:
00013   //! constructor, defaults to active, all joints at 0
00014   RemoteControllerMC():MotionCommand(), dirty(true), active(true) {
00015     for (unsigned int i=0; i<NumPIDJoints; i++) cmds[i]=0.0f;
00016   }
00017   //! destructor
00018   virtual ~RemoteControllerMC() {}
00019 
00020   //!@name Inherited:
00021   //! Updates all PIDJoint values
00022   virtual int updateOutputs() {
00023     int tmp=isDirty();
00024     if (isDirty())
00025       for (unsigned int i=0; i<NumPIDJoints; i++)
00026         motman->setOutput(this, PIDJointOffset+i, cmds[i]);
00027     dirty=false;
00028     return tmp;
00029   }
00030   virtual int              isDirty()                      { return (dirty && active)?1:0; } //!< true if a change has been made since the last updateJointCmds() and we're active
00031   virtual int              isAlive()                      { return true; } //!< always true
00032   //@}
00033   
00034   void setDirty() { dirty=true; } //!< sets dirty flag to true
00035   float cmds[NumPIDJoints]; //!< current vector of positions
00036 
00037  protected:
00038   bool dirty;                         //!< true if a change has been made since last call to updateJointCmds()
00039   bool active;                        //!< set by accessor functions, defaults to true
00040 };
00041 
00042 /*! @file
00043  * @brief Describes RemoteControllerMC, a class used for setting all PIDJoints to a certain set of values (not the gains, just the joint positions)
00044  * @author alokl (Creator)
00045  *
00046  * $Author: ejt $
00047  * $Name: tekkotsu-2_0 $
00048  * $Revision: 1.4 $
00049  * $State: Exp $
00050  * $Date: 2004/01/07 22:52:26 $
00051  */
00052 
00053 #endif
00054 

Tekkotsu v2.0
Generated Wed Jan 21 03:20:29 2004 by Doxygen 1.3.4