Homepage
Demos
Overview
Downloads
Dev. Resources
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   virtual void  DoStart() { MotionCommand::DoStart(); dirty=true; } //!< marks this as dirty each time it is added
00033   //@}
00034   
00035   void setDirty() { dirty=true; } //!< sets dirty flag to true
00036   float cmds[NumPIDJoints]; //!< current vector of positions
00037 
00038  protected:
00039   bool dirty;                         //!< true if a change has been made since last call to updateJointCmds()
00040   bool active;                        //!< set by accessor functions, defaults to true
00041 };
00042 
00043 /*! @file
00044  * @brief Describes RemoteControllerMC, a class used for setting all PIDJoints to a certain set of values (not the gains, just the joint positions)
00045  * @author alokl (Creator)
00046  *
00047  * $Author: ejt $
00048  * $Name: tekkotsu-2_4_1 $
00049  * $Revision: 1.5 $
00050  * $State: Exp $
00051  * $Date: 2004/12/21 00:42:21 $
00052  */
00053 
00054 #endif
00055 

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