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

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 class RemoteControllerMC : public MotionCommand {
00011  public:
00012   //! constructor, defaults to active, all joints at 0
00013   RemoteControllerMC():MotionCommand(), dirty(true), active(true) {
00014     for (unsigned int i=0; i<NumPIDJoints; i++) cmds[i]=0.0f;
00015   }
00016   //! destructor
00017   virtual ~RemoteControllerMC() {}
00018 
00019   //!@name Inherited:
00020   //! Updates all PIDJoint values
00021   virtual int updateOutputs() {
00022     int tmp=isDirty();
00023     if (isDirty())
00024       for (unsigned int i=0; i<NumPIDJoints; i++)
00025         motman->setOutput(this, PIDJointOffset+i, cmds[i]);
00026     dirty=false;
00027     return tmp;
00028   }
00029   virtual int              isDirty()                      { return (dirty && active)?1:0; } //!< true if a change has been made since the last updateJointCmds() and we're active
00030   virtual int              isAlive()                      { return true; } //!< always true
00031   //@}
00032   
00033   void setDirty() { dirty=true; } //!< sets dirty flag to true
00034   float cmds[NumPIDJoints]; //!< current vector of positions
00035 
00036  protected:
00037   bool dirty;                         //!< true if a change has been made since last call to updateJointCmds()
00038   bool active;                        //!< set by accessor functions, defaults to true
00039 };
00040 
00041 /*! @file
00042  * @brief Describes RemoteControllerMC, a class for various ways to control where the head is looking
00043  * @author ejt (Creator)
00044  *
00045  * $Author: ejt $
00046  * $Name: tekkotsu-1_4_1 $
00047  * $Revision: 1.2 $
00048  * $State: Exp $
00049  * $Date: 2003/06/12 18:06:11 $
00050  */
00051 
00052 #endif
00053 

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