Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

ERS220Info.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 
00003 // Mad props to Daishi MORI, the 220 master chief, for porting to the 220 ;)
00004 
00005 #ifndef INCLUDED_ERS220Info_h
00006 #define INCLUDED_ERS220Info_h
00007 
00008 #include <math.h>
00009 #ifndef PLATFORM_APERIOS
00010 typedef unsigned short word; //!< otherwise defined in Types.h
00011 #else
00012 #include <Types.h>
00013 #endif
00014 
00015 #include "CommonInfo.h"
00016 using namespace RobotInfo;
00017 
00018 #if TGT_ERS2xx
00019 #include "ERS2xxInfo.h"
00020 #endif
00021 
00022 //! Contains information about the ERS-220 Robot, such as number of joints, PID defaults, timing information, etc.
00023 namespace ERS220Info {
00024 
00025 #if TGT_ERS2xx
00026   using namespace ERS2xxInfo;
00027 #else
00028   // *******************************
00029   //       ROBOT CONFIGURATION
00030   // *******************************
00031 
00032 
00033   const unsigned int FrameTime=8;        //!< time between frames in the motion system (milliseconds)
00034   const unsigned int NumFrames=4;        //!< the number of frames per buffer (don't forget also double buffered)
00035   const unsigned int SlowFrameTime=128;  //!< time between frames for the ears (which move slower for some reason, don't want to mix with other outputs) (milliseconds)
00036   const unsigned int NumSlowFrames=1;    //!< the number of frames per buffer being sent to ears (double buffered as well)
00037   const unsigned int SoundBufferTime=32; //!< the number of milliseconds per sound buffer... I'm not sure if this can be changed
00038   
00039   //!Corresponds to entries in ERS220Info::PrimitiveName, defined at the end of this file, these are the primary grouping
00040   /*!Right now all binary joints are slow, but perhaps this won't always be the case... hence the IsFast/Slow bitmasks to select which type, in order to be more general */
00041   //!@name Output Types Information
00042   const unsigned JointsPerLeg   =  3; //!< The number of joints per leg
00043   const unsigned NumLegs        =  4; //!< The number of legs
00044   const unsigned NumLegJoints   =  JointsPerLeg*NumLegs; //!< the TOTAL number of joints on ALL legs
00045   const unsigned NumHeadJoints  =  3; //!< The number of joints in the neck
00046   const unsigned NumTailJoints  =  0; //!< The number of joints assigned to the tail
00047   const unsigned NumMouthJoints =  0; //!< the number of joints that control the mouth
00048   const unsigned NumEarJoints   =  0; //!< The number of joints which control the ears (NOT per ear, is total)
00049   const unsigned NumButtons     =  11; //!< the number of buttons that are available, see ERS220Info::ButtonOffset_t
00050   const unsigned NumSensors     =  1+3+1+5;  //!< 1 dist, 3 accel, 1 thermo, 5 from power, see ERS220Info::SensorOffset_t
00051   const unsigned NumLEDs        = 20; //!< The number of LEDs which can be controlled
00052   
00053   const unsigned NumPIDJoints   = NumLegJoints+NumHeadJoints+NumTailJoints+NumMouthJoints; //!< The number of joints which use PID motion - everything
00054   const unsigned NumBinJoints   = NumEarJoints; //!< The number of binary joints - just the ears (which the 220 doesn't have)
00055   const unsigned NumOutputs     = NumPIDJoints + NumBinJoints + NumLEDs; //!< the total number of outputs
00056   const unsigned NumReferenceFrames = NumOutputs + 1 + NumLegs + 1 + 1; //!< for the base, paw, camera, and IR sensor reference frames
00057 
00058   const float CameraHorizFOV=57.6/180*M_PI; //!< horizontal field of view (radians)
00059   const float CameraVertFOV=47.8/180*M_PI; //!< vertical field of view (radians)
00060   const float CameraFOV=CameraHorizFOV; //!< should be set to maximum of #CameraHorizFOV or #CameraVertFOV
00061   const unsigned int CameraResolutionX=176; //!< the number of pixels available in the 'full' layer
00062   const unsigned int CameraResolutionY=144; //!< the number of pixels available in the 'full' layer
00063 
00064   const bool IsFastOutput[NumOutputs] = {
00065     // for PID joints
00066     true, true, true,
00067     true, true, true,
00068     true, true, true,
00069     true, true, true,
00070     true, true, true,
00071     // for LEDs
00072     true, true, true,           // face left side LEDs x3
00073     true, true, true,           // face right side LEDs x3
00074     true,                       // head mode LED x1
00075     true, true, true,           // back left multi LEDs x3
00076     true, true, true,           // back right multi LEDs x3
00077     true, true, true,           // tail LEDs x3
00078     true, true, true,           // face front LEDs x3
00079     true,                       // retractable head light x1
00080     // for binary joints (none supported/exist on 220)
00081   }; //!< true for joints which can be updated every 32 ms (all but the ears on a 210)
00082 
00083   //! we need this so you can tell programmatically which joints are "real" and which are "fake" in ERS-2xx target mode
00084   const bool IsRealERS220[NumOutputs] = {
00085     // for PID joints
00086     true, true, true,
00087     true, true, true,
00088     true, true, true,
00089     true, true, true,
00090     true, true, true,
00091     // for LEDs
00092     true, true, true,           // face left side LEDs x3
00093     true, true, true,           // face right side LEDs x3
00094     true,                       // head mode LED x1
00095     true, true, true,           // back left multi LEDs x3
00096     true, true, true,           // back right multi LEDs x3
00097     true, true, true,           // tail LEDs x3
00098     true, true, true,           // face front LEDs x3
00099     true,                       // retractable head light x1
00100     // for binary joints (none supported/exist on 220)
00101   }; //!< true for joints which can be updated every 32 ms (all but the ears on a 210)
00102 
00103 
00104   // *******************************
00105   //         OUTPUT OFFSETS
00106   // *******************************
00107 
00108 
00109   //!Corresponds to entries in ERS220Info::PrimitiveName, defined at the end of this file
00110   //!@name Output Offsets
00111   const unsigned PIDJointOffset = 0; //!< The beginning of the PID Joints
00112   const unsigned LegOffset   = PIDJointOffset;           //!< the offset of the beginning of the leg joints
00113   const unsigned HeadOffset  = LegOffset+NumLegJoints;   //!< the offset of the beginning of the head joints
00114 
00115   const unsigned LEDOffset   = PIDJointOffset + NumPIDJoints; //!< the offset of LEDs in WorldState::outputs and MotionCommand functions
00116 
00117   const unsigned BinJointOffset = NumOutputs; //!< The beginning of the binary joints
00118 
00119   const unsigned BaseFrameOffset   = NumOutputs; //!< Use with kinematics to refer to base reference frame
00120   const unsigned PawFrameOffset    = BaseFrameOffset+1; //!< Use with kinematics to refer to paw reference frames (add appropriate LegOrder_t to specify which paw)
00121   const unsigned CameraFrameOffset = PawFrameOffset+NumLegs; //!< Use with kinematics to refer to camera reference frame
00122   const unsigned IRFrameOffset = CameraFrameOffset+1; //!< Use with kinematics to refer to infrared (distance) sensor reference frame
00123 
00124   //! The offsets of the individual legs
00125   enum LegOffset_t {
00126     LFrLegOffset = LegOffset+LFrLegOrder*JointsPerLeg, //!< beginning of left front leg
00127     RFrLegOffset = LegOffset+RFrLegOrder*JointsPerLeg, //!< beginning of right front leg
00128     LBkLegOffset = LegOffset+LBkLegOrder*JointsPerLeg, //!< beginning of left back leg
00129     RBkLegOffset = LegOffset+RBkLegOrder*JointsPerLeg  //!< beginning of right back leg
00130   };
00131   
00132   //@}
00133   
00134   //! The offsets of the individual LEDs on the head and tail.  Note that left/right are robot's point of view.  See also LEDBitMask_t
00135   enum LEDOffset_t {
00136     FaceFrontLeftLEDOffset = LEDOffset, //!< head face side light (front left - blue)
00137     FaceFrontRightLEDOffset,    //!< head face side light (front right - blue)
00138     FaceCenterLeftLEDOffset,    //!< head face side light (center left - blue)
00139     FaceCenterRightLEDOffset,   //!< head face side light (center right - blue)
00140     FaceBackLeftLEDOffset,      //!< head face side light (back left - red)
00141     FaceBackRightLEDOffset,     //!< head face side light (back right - red)
00142     ModeLEDOffset,              //!< mode indicator (back of the head - orange)
00143     BackLeft1LEDOffset,         //!< back multi-indicator (left #1 - blue)
00144     BackLeft2LEDOffset,         //!< back multi-indicator (left #2 - blue)
00145     BackLeft3LEDOffset,         //!< back multi-indicator (left #3 - blue)
00146     BackRight3LEDOffset,        //!< back multi-indicator (right #3 - blue)
00147     BackRight2LEDOffset,        //!< back multi-indicator (right #2 - blue)
00148     BackRight1LEDOffset,        //!< back multi-indicator (right #1 - blue)
00149     TailLeftLEDOffset,          //!< tail light (left - blue)
00150     TailCenterLEDOffset,        //!< tail light (center - red)
00151     TailRightLEDOffset,         //!< tail light (right - blue)
00152     FaceFrontBLEDOffset,        //!< face front light B (blue)
00153     FaceFrontALEDOffset,        //!< face front light A (blue)
00154     FaceFrontCLEDOffset,        //!< face front light C (red)
00155     RetractableHeadLEDOffset,   //!< retractable head light
00156  
00157     // aliases for backward compatibility
00158     BotLLEDOffset = FaceFrontLeftLEDOffset,   //!< bottom left (red - sad) (ERS-210)
00159     BotRLEDOffset = FaceFrontRightLEDOffset,  //!< bottom right (red - sad) (ERS-210)
00160     MidLLEDOffset = FaceCenterLeftLEDOffset,  //!< middle left (green - happy) (ERS-210)
00161     MidRLEDOffset = FaceCenterRightLEDOffset, //!< middle right (green - happy) (ERS-210)
00162     TopLLEDOffset = FaceBackLeftLEDOffset,    //!< top left (red - angry) (ERS-210)
00163     TopRLEDOffset = FaceBackRightLEDOffset,   //!< top right (red - angry) (ERS-210)
00164     TopBrLEDOffset = ModeLEDOffset,           //!< top bar (green) (ERS-210)
00165     TlBluLEDOffset = TailLeftLEDOffset,      //!< blue tail light (ERS-210)
00166     TlRedLEDOffset = TailRightLEDOffset,      //!< red tail light (ERS-210)
00167   };
00168   
00169   //! Bitmasks for use when specifying combinations of LEDs (see LedEngine ) Note that left/right are robot's point of view
00170   //!@name LED Bitmasks
00171   typedef unsigned int LEDBitMask_t; //!< So you can be clear when you're refering to a LED bitmask
00172   const LEDBitMask_t FaceFrontLeftLEDMask   = 1<<(FaceFrontLeftLEDOffset-LEDOffset);
00173   const LEDBitMask_t FaceFrontRightLEDMask  = 1<<(FaceFrontRightLEDOffset-LEDOffset);
00174   const LEDBitMask_t FaceCenterLeftLEDMask  = 1<<(FaceCenterLeftLEDOffset-LEDOffset);
00175   const LEDBitMask_t FaceCenterRightLEDMask = 1<<(FaceCenterRightLEDOffset-LEDOffset);
00176   const LEDBitMask_t FaceBackLeftLEDMask    = 1<<(FaceBackLeftLEDOffset-LEDOffset);
00177   const LEDBitMask_t FaceBackRightLEDMask   = 1<<(FaceBackRightLEDOffset-LEDOffset);
00178   const LEDBitMask_t ModeLEDMask            = 1<<(ModeLEDOffset-LEDOffset);
00179   const LEDBitMask_t BackLeft1LEDMask       = 1<<(BackLeft1LEDOffset-LEDOffset);
00180   const LEDBitMask_t BackLeft2LEDMask       = 1<<(BackLeft2LEDOffset-LEDOffset);
00181   const LEDBitMask_t BackLeft3LEDMask       = 1<<(BackLeft3LEDOffset-LEDOffset);
00182   const LEDBitMask_t BackRight3LEDMask      = 1<<(BackRight3LEDOffset-LEDOffset);
00183   const LEDBitMask_t BackRight2LEDMask      = 1<<(BackRight2LEDOffset-LEDOffset);
00184   const LEDBitMask_t BackRight1LEDMask      = 1<<(BackRight1LEDOffset-LEDOffset);
00185   const LEDBitMask_t TailLeftLEDMask        = 1<<(TailLeftLEDOffset-LEDOffset);
00186   const LEDBitMask_t TailCenterLEDMask      = 1<<(TailCenterLEDOffset-LEDOffset);
00187   const LEDBitMask_t TailRightLEDMask       = 1<<(TailRightLEDOffset-LEDOffset);
00188   const LEDBitMask_t FaceFrontBLEDMask      = 1<<(FaceFrontBLEDOffset-LEDOffset);
00189   const LEDBitMask_t FaceFrontALEDMask      = 1<<(FaceFrontALEDOffset-LEDOffset);
00190   const LEDBitMask_t FaceFrontCLEDMask      = 1<<(FaceFrontCLEDOffset-LEDOffset);
00191   const LEDBitMask_t RetractableHeadLEDMask = 1<<(RetractableHeadLEDOffset-LEDOffset);
00192   
00193   // aliases for backward compatibility
00194   const LEDBitMask_t BotLLEDMask = 1<<(BotLLEDOffset-LEDOffset); //!< bottom left (red - sad)
00195   const LEDBitMask_t BotRLEDMask = 1<<(BotRLEDOffset-LEDOffset); //!< bottom right (red - sad)
00196   const LEDBitMask_t MidLLEDMask = 1<<(MidLLEDOffset-LEDOffset); //!< middle left (green - happy)
00197   const LEDBitMask_t MidRLEDMask = 1<<(MidRLEDOffset-LEDOffset); //!< middle right (green - happy)
00198   const LEDBitMask_t TopLLEDMask = 1<<(TopLLEDOffset-LEDOffset); //!< top left (red - angry)
00199   const LEDBitMask_t TopRLEDMask = 1<<(TopRLEDOffset-LEDOffset); //!< top right (red - angry)
00200   const LEDBitMask_t TopBrLEDMask= 1<<(TopBrLEDOffset-LEDOffset); //!< top bar (green)
00201   const LEDBitMask_t TlRedLEDMask= 1<<(TlRedLEDOffset-LEDOffset); //!< red tail light
00202   const LEDBitMask_t TlBluLEDMask= 1<<(TlBluLEDOffset-LEDOffset); //!< blue tail light
00203 
00204   const LEDBitMask_t FaceLEDMask
00205   = FaceFrontLeftLEDMask
00206   | FaceFrontRightLEDMask
00207   | FaceCenterLeftLEDMask
00208   | FaceCenterRightLEDMask
00209   | FaceBackLeftLEDMask
00210   | FaceBackRightLEDMask
00211   | FaceFrontALEDMask
00212   | FaceFrontBLEDMask
00213   | FaceFrontCLEDMask
00214   | ModeLEDMask;              //!< LEDs for face
00215  
00216   const LEDBitMask_t HeadLEDMask
00217   = FaceLEDMask
00218   | RetractableHeadLEDMask;   //!< LEDs on head (face plus retractable light)
00219  
00220   const LEDBitMask_t BackLEDMask
00221   = BackLeft1LEDMask
00222   | BackLeft2LEDMask
00223   | BackLeft3LEDMask
00224   | BackRight1LEDMask
00225   | BackRight2LEDMask
00226   | BackRight3LEDMask; //!< LEDs on back
00227  
00228   const LEDBitMask_t TailLEDMask
00229   = TailLeftLEDMask
00230   | TailCenterLEDMask
00231   | TailRightLEDMask;  //!< LEDs for tail
00232  
00233   const LEDBitMask_t AllLEDMask  = (LEDBitMask_t)~0; //!< selects all of the leds
00234   //@}
00235 
00236 
00237   // *******************************
00238   //          INPUT OFFSETS
00239   // *******************************
00240 
00241 
00242   //! The order in which inputs should be stored
00243   //!@name Input Offsets
00244 
00245   //! holds offsets to different buttons in WorldState::buttons[]
00246   /*! Should be a straight mapping to the ButtonSourceIDs
00247    *
00248    *  Note that the chest (power) button is not a normal button.  It kills
00249    *  power to the motors at a hardware level, and isn't sensed in the
00250    *  normal way.  If you want to know when it is pressed (and you are
00251    *  about to shut down) see PowerSourceID::PauseSID.
00252    *
00253    *  @see WorldState::buttons @see ButtonSourceID_t */
00254   enum ButtonOffset_t {
00255     LFrPawOffset = LFrLegOrder,
00256     RFrPawOffset = RFrLegOrder,
00257     LBkPawOffset = LBkLegOrder,
00258     RBkPawOffset = RBkLegOrder,
00259     ChinButOffset= 4,
00260     BackButOffset,
00261     HeadFrButOffset, //!< for the "antenna" - this is <.2 if pushed back all the way
00262     HeadBkButOffset, //!< for the "antenna" - this is >.98 if pulled forward, <.2 if pushed back partly
00263     TailLeftButOffset,
00264     TailCenterButOffset,
00265     TailRightButOffset,
00266   };
00267 
00268   //! Provides a string name for each button
00269   const char* const buttonNames[NumButtons] = {
00270     "LFrPaw","RFrPaw","LBkPaw","RBkPaw",
00271     "ChinBut","BackBut","HeadFrBut","HeadBkBut",
00272     "TailLeftBut","TailCenterBut","TailRightBut"
00273   };
00274 
00275   //! holds offset to different sensor values in WorldState::sensors[]
00276   /*! @see WorldState::sensors[] */
00277   enum SensorOffset_t {
00278     IRDistOffset = 0,  //!< in millimeters
00279     BAccelOffset, //!< backward acceleration, in @f$m/s^2@f$, negative if sitting on butt (positive for faceplant)
00280     LAccelOffset, //!< acceleration to the robot's left, in @f$m/s^2@f$, negative if lying on robot's left side
00281     DAccelOffset, //!< downward acceleration, in @f$m/s^2@f$, negative if standing up... be careful about the signs on all of these...
00282     ThermoOffset, //!< in degrees Celcius
00283     PowerRemainOffset, //!< percentage, 0-1
00284     PowerThermoOffset, //!<  degrees Celcius
00285     PowerCapacityOffset, //!< milli-amp hours
00286     PowerVoltageOffset, //!< volts
00287     PowerCurrentOffset //!< milli-amp negative values (maybe positive while charging?)
00288   };
00289 
00290   //! Provides a string name for each sensor
00291   const char* const sensorNames[NumSensors] = {
00292     "IRDist",
00293     "BAccel","LAccel","DAccel",
00294     "Thermo",
00295     "PowerRemain","PowerThermo","PowerCapacity","PowerVoltage","PowerCurrent"
00296   };
00297 
00298   //@}
00299 
00300 
00301   //! The length of the strings used for each of the outputs in outputNames (doesn't include null term)
00302   const unsigned outputNameLen = 9;
00303   //! A name of uniform length for referring to joints - handy for posture files, etc.
00304   const char* const outputNames[NumOutputs] = {
00305     "LFr:rotor",
00306     "LFr:elvtr",
00307     "LFr:knee~",
00308     "RFr:rotor",
00309     "RFr:elvtr",
00310     "RFr:knee~",
00311     "LBk:rotor",
00312     "LBk:elvtr",
00313     "LBk:knee~",
00314     "RBk:rotor",
00315     "RBk:elvtr",
00316     "RBk:knee~",
00317     
00318     "NECK:tilt",
00319     "NECK:pan~",
00320     "NECK:roll",
00321     
00322     "LED:botL~",
00323     "LED:botR~",
00324     "LED:midL~",
00325     "LED:midR~",
00326     "LED:topL~",
00327     "LED:topR~",
00328     "LED:topBr",
00329     
00330     "LED:bkL1~",                // "LED:tlBlu" of ERS-210
00331     "LED:bkL2~",                // "LED:tlRed" of ERS-210
00332     "LED:bkL3~",
00333     "LED:bkR3~",
00334     "LED:bkR2~",
00335     "LED:bkR1~",
00336     "LED:tailL",
00337     "LED:tailC",
00338     "LED:tailR",
00339     "LED:faceB",
00340     "LED:faceA",
00341     "LED:faceC",
00342     "LED:light",                 // retractable head light
00343   };
00344   
00345 
00346   //! the joint identifier strings used to refer to specific joints in OPEN-R (but not needed for others)
00347   /*!@showinitializer 
00348    * @warning IMPORTANT!!!!  DO NOT CHANGE THE ORDER OF ITEMS IN THIS TABLE!!!\n
00349    *
00350    * The offset consts defined in this file correspond to this table and will make life easier
00351    * if you feel the need to reorder things, but they aren't used perfect @e everywhere \n
00352    * In particular, assumptions are made that the pid joints will be in slots 0-numPIDJoints
00353    * and that the fast outputs (ie NOT ears) will be in slots 0-NumFastOutputs\n
00354    * There may be other assumptions not noted here!!!
00355    * @note These entries DON'T correspond to the CPC index numbers defined in WorldState (this only lists joints, and in a different order defined by OPEN-R, that one has sensors as well*/
00356   const char* const PrimitiveName [NumOutputs] = {
00357     "PRM:/r2/c1-Joint2:j1",       //!< the left front leg   the rotator
00358     "PRM:/r2/c1/c2-Joint2:j2",    //!< the left front leg   the elevator 
00359     "PRM:/r2/c1/c2/c3-Joint2:j3", //!< the left front leg   the knee 
00360     "PRM:/r4/c1-Joint2:j1",       //!< the right front leg   the rotator
00361     "PRM:/r4/c1/c2-Joint2:j2",    //!< the right front leg    the elevator 
00362     "PRM:/r4/c1/c2/c3-Joint2:j3", //!< the right front leg   the knee 
00363     
00364     "PRM:/r3/c1-Joint2:j1",       //!< the left hind leg   the rotator
00365     "PRM:/r3/c1/c2-Joint2:j2",    //!< the left hind leg   the elevator 
00366     "PRM:/r3/c1/c2/c3-Joint2:j3", //!< the left hind leg   the knee
00367     "PRM:/r5/c1-Joint2:j1",       //!< the right hind leg   the rotator
00368     "PRM:/r5/c1/c2-Joint2:j2",    //!< the right hind leg   the elevator 
00369     "PRM:/r5/c1/c2/c3-Joint2:j3", //!< the right hind leg   the knee 
00370 
00371     "PRM:/r1/c1-Joint2:j1",       //!< the neck  tilt (12)
00372     "PRM:/r1/c1/c2-Joint2:j2",    //!< the neck   pan 
00373     "PRM:/r1/c1/c2/c3-Joint2:j3", //!< the neck   roll 
00374         
00375     "PRM:/r1/c1/c2/c3/l1-LED2:l1", //!< lower  left  LED (15)
00376     "PRM:/r1/c1/c2/c3/l4-LED2:l4", //!< lower  right LED
00377     "PRM:/r1/c1/c2/c3/l2-LED2:l2", //!< middle left  LED
00378     "PRM:/r1/c1/c2/c3/l5-LED2:l5", //!< middle right LED
00379     "PRM:/r1/c1/c2/c3/l3-LED2:l3", //!< upper  left  LED
00380     "PRM:/r1/c1/c2/c3/l6-LED2:l6", //!< upper  right LED
00381     "PRM:/r1/c1/c2/c3/l7-LED2:l7", //!< top          LED
00382     
00383     "PRM:/r6/l1-LED2:l1", //!< back 1st left LED (corresponds to tail blue LED of ERS-210)
00384     "PRM:/r6/l2-LED2:l2", //!< back 2nd left LED (corresponds to tail red  LED of ERS-210)
00385     "PRM:/r6/l3-LED2:l3", //!< back 3rd left LED
00386     "PRM:/r6/l4-LED2:l4", //!< back 3rd right LED
00387     "PRM:/r6/l5-LED2:l5", //!< back 2nd right LED
00388     "PRM:/r6/l6-LED2:l6", //!< back 1st right LED
00389  
00390     "PRM:/r6/l9-LED2:l9", //!< tail left LED
00391     "PRM:/r6/l7-LED2:l7", //!< tail center LED
00392     "PRM:/r6/l8-LED2:l8", //!< tail right LED
00393  
00394     "PRM:/r1/c1/c2/c3/l8-LED2:l8", //!< face front LED B
00395     "PRM:/r1/c1/c2/c3/l9-LED2:l9", //!< face front LED A
00396     "PRM:/r1/c1/c2/c3/la-LED2:la", //!< face front LED C
00397     "PRM:/r1/c1/c2/c3/lb-LED2:lb", //!< retractable head light
00398   };
00399 
00400   //! use to open speaker connectio with the system
00401   const char* const SpeakerLocator="PRM:/r1/c1/c2/c3/s1-Speaker:S1";
00402 
00403   //! use to open camera connection with the system
00404   const char* const CameraLocator="PRM:/r1/c1/c2/c3/i1-FbkImageSensor:F1";
00405 
00406   //Old PID table:
00407   /*const word Pid[NumPIDJoints][6] = {
00408     { 0x16, 0x04, 0x08, 0x0E, 0x02, 0x0F },
00409     { 0x14, 0x04, 0x06, 0x0E, 0x02, 0x0F },
00410     { 0x23, 0x04, 0x05, 0x0E, 0x02, 0x0F },
00411     { 0x16, 0x04, 0x08, 0x0E, 0x02, 0x0F },
00412     { 0x14, 0x04, 0x06, 0x0E, 0x02, 0x0F },
00413     { 0x23, 0x04, 0x05, 0x0E, 0x02, 0x0F },
00414     { 0x16, 0x04, 0x08, 0x0E, 0x02, 0x0F },
00415     { 0x14, 0x04, 0x06, 0x0E, 0x02, 0x0F },
00416     { 0x23, 0x04, 0x05, 0x0E, 0x02, 0x0F },
00417     { 0x16, 0x04, 0x08, 0x0E, 0x02, 0x0F },
00418     { 0x14, 0x04, 0x06, 0x0E, 0x02, 0x0F },
00419     { 0x23, 0x04, 0x05, 0x0E, 0x02, 0x0F },
00420     
00421     { 0x0A, 0x08, 0x0C, 0x0E, 0x02, 0x0F },
00422     { 0x0D, 0x08, 0x0B, 0x0E, 0x02, 0x0F },
00423     { 0x10, 0x08, 0x0C, 0x0E, 0x02, 0x0F }, // P was 0x0C, updated as seen on https://www.openr.org/page1_2001/gain.html 8/13/2002
00424     
00425     { 0x0A, 0x00, 0x18, 0x0E, 0x02, 0x0F },
00426     { 0x07, 0x00, 0x11, 0x0E, 0x02, 0x0F },
00427     
00428     { 0x0E, 0x08, 0x10, 0x0E, 0x02, 0x0F }, //  { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
00429   };*/
00430       
00431   //! This table holds the default PID values for each joint.  see PIDMC
00432   const float DefaultPIDs[NumPIDJoints][3] =
00433     {
00434       { 0x16/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x08/(double)(1<<(16-0xF)) },
00435       { 0x14/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x06/(double)(1<<(16-0xF)) },
00436       { 0x23/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x05/(double)(1<<(16-0xF)) },
00437       { 0x16/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x08/(double)(1<<(16-0xF)) },
00438       { 0x14/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x06/(double)(1<<(16-0xF)) },
00439       { 0x23/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x05/(double)(1<<(16-0xF)) },
00440       { 0x16/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x08/(double)(1<<(16-0xF)) },
00441       { 0x14/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x06/(double)(1<<(16-0xF)) },
00442       { 0x23/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x05/(double)(1<<(16-0xF)) },
00443       { 0x16/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x08/(double)(1<<(16-0xF)) },
00444       { 0x14/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x06/(double)(1<<(16-0xF)) },
00445       { 0x23/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x05/(double)(1<<(16-0xF)) },
00446 
00447       { 0x0A/(double)(1<<(16-0xE)), 0x08/(double)(1<<(16-0x2)), 0x0C/(double)(1<<(16-0xF)) },
00448       { 0x0D/(double)(1<<(16-0xE)), 0x08/(double)(1<<(16-0x2)), 0x0B/(double)(1<<(16-0xF)) },
00449       { 0x0A/(double)(1<<(16-0xE)), 0x08/(double)(1<<(16-0x2)), 0x0C/(double)(1<<(16-0xF)) }
00450 
00451 //      { 0x0A/(double)(1<<(16-0xE)), 0x00/(double)(1<<(16-0x2)), 0x18/(double)(1<<(16-0xF)) },
00452 //      { 0x07/(double)(1<<(16-0xE)), 0x00/(double)(1<<(16-0x2)), 0x11/(double)(1<<(16-0xF)) },
00453 
00454 //      { 0x0E/(double)(1<<(16-0xE)), 0x08/(double)(1<<(16-0x2)), 0x10/(double)(1<<(16-0xF)) }
00455     };
00456   
00457   //! These will control the shift values given to the system.  see PIDMC
00458   const unsigned char DefaultPIDShifts[3] = {0x0E, 0x02, 0x0F};
00459     
00460   //!These values are Sony's recommended maximum joint velocities, in rad/ms
00461   /*! a value <= 0 means infinite speed (e.g. LEDs)
00462    *  
00463    *  These limits are <b>not</b> enforced by the framework.  They are simply available for you to use as you see fit.
00464    *  HeadPointerMC is (as of v1.6) the only included MotionCommand to actually use these values. */
00465   const float MaxOutputSpeed[NumOutputs] = {
00466     2.8143434e-03,     //Legs LR,FB,REK
00467     2.4980025e-03,
00468     2.8361600e-03,
00469     2.8143434e-03,
00470     2.4980025e-03,
00471     2.8361600e-03,
00472     2.8143434e-03,
00473     2.4980025e-03,
00474     2.8361600e-03,
00475     2.8143434e-03,
00476     2.4980025e-03,
00477     2.8361600e-03,
00478   
00479     2.1053034e-03,     //Head TPR
00480     3.0106930e-03,
00481     3.0106930e-03,
00482   
00483     0,0,0,//LEDs
00484     0,0,0,
00485     0,
00486     0,0,0, 
00487     0,0,0, 
00488     0,0,0, 
00489     0,0,0, 
00490     0
00491   };
00492 
00493 #ifndef RAD
00494   //!Just a little macro for converting degrees to radians
00495 #define RAD(deg) (((deg) * M_PI ) / 180.0)
00496   //!a flag so we undef these after we're done - do you have a cleaner solution?
00497 #define __RI_RAD_FLAG
00498 #endif
00499 
00500   //! Defines the indexes to use to access the min and max entries of ERSInfo::outputRanges and ERS7Info::mechanicalLimits
00501   enum MinMaxRange_t { MinRange,MaxRange };
00502 
00503   //! This table holds the software limits of each of the outputs
00504   const double outputRanges[NumOutputs][2] =
00505     {
00506       { RAD(-117),RAD(117) },{ RAD(-11),RAD(89) },{ RAD(-27),RAD(147) }, //left front REK
00507       { RAD(-117),RAD(117) },{ RAD(-11),RAD(89) },{ RAD(-27),RAD(147) }, //right front REK
00508       { RAD(-117),RAD(117) },{ RAD(-11),RAD(89) },{ RAD(-27),RAD(147) }, //left back REK
00509       { RAD(-117),RAD(117) },{ RAD(-11),RAD(89) },{ RAD(-27),RAD(147) }, //right back REK
00510 
00511       { RAD(-88.5),RAD(43) },{ RAD(-89.6),RAD(89.6) },{ RAD(-29),RAD(29) }, //neck TPR
00512         
00513       {0,1},{0,1},{0,1},        // face left side LEDs x3
00514       {0,1},{0,1},{0,1},        // face right side LEDs x3
00515       {0,1},                    // head mode LED x1
00516       {0,1},{0,1},{0,1},        // back left multi LEDs x3
00517       {0,1},{0,1},{0,1},        // back right multi LEDs x3
00518       {0,1},{0,1},{0,1},        // tail LEDs x3
00519       {0,1},{0,1},{0,1},        // face front LEDs x3
00520       {0,1}                     // retractable head light x1
00521     };
00522 
00523   //! This table holds the mechanical limits of each of the outputs
00524   const double mechanicalLimits[NumOutputs][2] =
00525     {
00526       { RAD(-120),RAD(120) },{ RAD(-14),RAD(92) },{ RAD(-30),RAD(150) }, //left front jsk
00527       { RAD(-120),RAD(120) },{ RAD(-14),RAD(92) },{ RAD(-30),RAD(150) }, //right front jsk
00528       { RAD(-120),RAD(120) },{ RAD(-14),RAD(92) },{ RAD(-30),RAD(150) }, //left back jsk
00529       { RAD(-120),RAD(120) },{ RAD(-14),RAD(92) },{ RAD(-30),RAD(150) }, //right back jsk
00530 
00531       { RAD(-91.5),RAD(46) },{ RAD(-92.6),RAD(92.6) },{ RAD(-32),RAD(32) }, //neck tpr
00532         
00533       {0,1},{0,1},{0,1},        // face left side LEDs x3
00534       {0,1},{0,1},{0,1},        // face right side LEDs x3
00535       {0,1},                    // head mode LED x1
00536       {0,1},{0,1},{0,1},        // back left multi LEDs x3
00537       {0,1},{0,1},{0,1},        // back right multi LEDs x3
00538       {0,1},{0,1},{0,1},        // tail LEDs x3
00539       {0,1},{0,1},{0,1},        // face front LEDs x3
00540       {0,1}                     // retractable head light x1
00541     };
00542 
00543 #ifdef __RI_RAD_FLAG
00544 #undef RAD
00545 #undef __RI_RAD_FLAG
00546 #endif
00547 
00548 #endif //TGT_ERS2xx check
00549 
00550   /*! @name CPC IDs
00551    * values defined by OPEN-R, used to interface with lower level OPEN-R code to read sensors - DOESN'T correspond to ERS220Info::PrimitiveName */
00552     static const int CPCJointNeckTilt           =  0; // PRM:/r1/c1-Joint2:j1
00553     static const int CPCJointNeckPan            =  1; // PRM:/r1/c1/c2-Joint2:j2
00554     static const int CPCJointNeckRoll           =  2; // PRM:/r1/c1/c2/c3-Joint2:j3
00555     static const int CPCSensorPSD               =  3; // PRM:/r1/c1/c2/c3/p1-Sensor:p1
00556     static const int CPCSensorHeadBackPressure  =  4; // PRM:/r1/c1/c2/c3/f1-Sensor:f1
00557     static const int CPCSensorHeadFrontPressure =  5; // PRM:/r1/c1/c2/c3/f2-Sensor:f2
00558     static const int CPCSensorChinSwitch        =  6; // PRM:/r1/c1/c2/c3/c4/s5-Sensor:s5
00559     static const int CPCJointLFRotator          =  7; // PRM:/r2/c1-Joint2:j1
00560     static const int CPCJointLFElevator         =  8; // PRM:/r2/c1/c2-Joint2:j2
00561     static const int CPCJointLFKnee             =  9; // PRM:/r2/c1/c2/c3-Joint2:j3
00562     static const int CPCSensorLFPaw             = 10; // PRM:/r2/c1/c2/c3/c4-Sensor:s4
00563     static const int CPCJointLHRotator          = 11; // PRM:/r3/c1-Joint2:j1
00564     static const int CPCJointLHElevator         = 12; // PRM:/r3/c1/c2-Joint2:j2
00565     static const int CPCJointLHKnee             = 13; // PRM:/r3/c1/c2/c3-Joint2:j3
00566     static const int CPCSensorLHPaw             = 14; // PRM:/r3/c1/c2/c3/c4-Sensor:s4
00567     static const int CPCJointRFRotator          = 15; // PRM:/r4/c1-Joint2:j1
00568     static const int CPCJointRFElevator         = 16; // PRM:/r4/c1/c2-Joint2:j2
00569     static const int CPCJointRFKnee             = 17; // PRM:/r4/c1/c2/c3-Joint2:j3
00570     static const int CPCSensorRFPaw             = 18; // PRM:/r4/c1/c2/c3/c4-Sensor:s4
00571     static const int CPCJointRHRotator          = 19; // PRM:/r5/c1-Joint2:j1
00572     static const int CPCJointRHElevator         = 20; // PRM:/r5/c1/c2-Joint2:j2
00573     static const int CPCJointRHKnee             = 21; // PRM:/r5/c1/c2/c3-Joint2:j3
00574     static const int CPCSensorRHPaw             = 22; // PRM:/r5/c1/c2/c3/c4-Sensor:s4
00575     static const int CPCSensorThermoSensor      = 23; // PRM:/r6/t1-Sensor:t1
00576     static const int CPCSensorBackSwitch        = 24; // PRM:/r6/s1-Sensor:s1
00577     static const int CPCSensorTailLeftSwitch    = 25; // PRM:/r6/s2-Sensor:s2  (ERS-220 only)
00578     static const int CPCSensorTailCenterSwitch  = 26; // PRM:/r6/s3-Sensor:s3  (ERS-220 only)
00579     static const int CPCSensorTailRightSwitch   = 27; // PRM:/r6/s4-Sensor:s4  (ERS-220 only)
00580     static const int CPCSensorAccelFB           = 28; // PRM:/a1-Sensor:a1
00581     static const int CPCSensorAccelLR           = 29; // PRM:/a2-Sensor:a2
00582     static const int CPCSensorAccelUD           = 30; // PRM:/a3-Sensor:a3
00583   //@}
00584 
00585 }
00586 
00587 /*! @file
00588  * @brief Defines RobotInfo namespace for ERS-220 models, gives some information about the robot's capabilities, such as joint counts, offsets, names and PID values
00589  * @author Daishi MORI (Creator)
00590  *
00591  * $Author: ejt $
00592  * $Name: tekkotsu-2_4_1 $
00593  * $Revision: 1.21 $
00594  * $State: Exp $
00595  * $Date: 2005/06/01 05:47:48 $
00596  */
00597 
00598 #endif

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