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

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

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