Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

ERS7Info.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_ERS7Info_h
00003 #define INCLUDED_ERS7Info_h
00004 
00005 #include "Shared/CommonERSInfo.h"
00006 
00007 // see http://tekkotsu.org/porting.html#configuration for more information on TGT_HAS_* flags
00008 #if defined(TGT_ERS7)
00009 # define TGT_HAS_LEDS 27
00010 # define TGT_HAS_BUTTONS 10
00011 # define TGT_HAS_IR_DISTANCE 3
00012 #endif
00013 
00014 //! Contains information about the ERS-7 Robot, such as number of joints, PID defaults, timing information, etc.
00015 /*! 
00016 You may be particularly interested in the "Output Offsets" section, which, along with the offsets of the common RobotInfo namespace,
00017 allows you to reference any specific joint or LED on the robot.
00018 
00019 The "Input Offsets" section gives the index order of the buttons (#ButtonOffset_t) and sensors (#SensorOffset_t), as well as
00020 string names for each for easier debugging (#buttonNames, #sensorNames)
00021 
00022 "Output Types" section provides "meta-information" regarding the capabilities of the robot, such as the number of head joints, or the number of LEDs, etc.
00023 
00024 For more information on your robot's specifications, see also #DefaultPIDs, #MaxOutputSpeed, #outputRanges, and #mechanicalLimits.
00025 
00026 "Outputs" (i.e. Joints, LEDs) are often refered to by index ("offset") value within an array.
00027 These values are formed by specifying a @e section offset, plus a @e specific offset.  Sections are typically general across robot models, whereas the specifics are model-dependent (but can be aliased to provide compatability).
00028 
00029 For most joints, the positive direction is "up", and the 0 position yields a forward looking, fully extended standing posture.
00030 
00031 - {L,R}{FrBk}LegOffset - #NumLegs combinations, each with #JointsPerLeg items, add REKOffset_t; see also LegOffset_t
00032   - + #RotatorOffset: positive moves "out", away from body
00033   - + #ElevatorOffset: positive moves up, away from body
00034   - + #KneeOffset: positive bends knee (slight negative possible)
00035 - #HeadOffset - #NumHeadJoints items, add #TPROffset_t:
00036   - + #TiltOffset: positive looks up
00037   - + #PanOffset: positive looks left
00038   - + #NodOffset: positive looks up
00039 - #TailOffset - #NumTailJoints items, add #TPROffset_t:
00040   - + #TiltOffset: positive raises the joint (lowers the tail itself)
00041   - + #PanOffset: positive points the tail to the Aibo's right
00042 - MouthOffset - #NumMouthJoints items (no specific, only 1 joint)
00043 - LEDs: #NumLEDs items, see #LEDOffset_t; these are all direct offsets, and do not need to be added to anything else
00044 - #EarOffset - #NumEarJoints items (no specifics, first is left ear, second is right ear)
00045 
00046 It happens that these joints can also be grouped by the @e type of joint, so there are additionally a few other offsets that can be used in order to loop across a group of joints:
00047 - PIDJointOffset - #NumPIDJoints items, servos using PID control
00048 - LegOffset - #NumLegJoints items, a subset of PID servos corresponding to the leg joints
00049 - LEDOffset - #NumLEDs items
00050 - BinJointOffset - #NumBinJoints items, solenoids, such as the ears (if any) which flip between two positions
00051 - #NumOutputs - total number of outputs available
00052 
00053 LEDs are often handled in groups to display patterns.  Some functions take an LEDBitMask_t
00054 parameter, which allows you to specify a set of several LEDs in a single parameter.  
00055 For any given LED offset @c fooLEDOffset, the corresponding bitmask constant is @c fooLEDMask.
00056 Alternatively, you could calculate the bitmask of @c fooLEDOffset by <code>1&lt;&lt;(fooLEDOffset-LEDOffset)</code>.
00057 
00058 @see <a href="../media/TekkotsuQuickReference_ERS7.pdf">ERS-7 Quick Reference Sheet</a>
00059 */
00060 namespace ERS7Info {
00061 
00062   // *******************************
00063   //       ROBOT CONFIGURATION
00064   // *******************************
00065 
00066   extern const char* const TargetName; //!< the name of the model, to be used for logging and remote GUIs
00067 
00068   const unsigned int FrameTime=8;        //!< time between frames in the motion system (milliseconds)
00069   const unsigned int NumFrames=4;        //!< the number of frames per buffer (don't forget also double buffered)
00070   const unsigned int SlowFrameTime=8;  //!< time between frames for the ears (ERS-7 doesn't seem to have any "slow" joints; this only applied for the ears on the ERS-210)
00071   const unsigned int NumSlowFrames=4;    //!< the number of frames per buffer being sent to ears (double buffered as well)
00072   const unsigned int SoundBufferTime=32; //!< the number of milliseconds per sound buffer... I'm not sure if this can be changed
00073   
00074   //!Corresponds to entries in ERS7Info::PrimitiveName, defined at the end of this file, these are the primary grouping
00075   /*!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 */
00076   //!@name Output Types Information
00077   const unsigned NumWheels = 0; //!< no wheels, just legs
00078   
00079   const unsigned JointsPerArm   =  0; //!< no arms, just legs
00080   const unsigned NumArms        =  0; //!< no arms, just legs
00081   const unsigned NumArmJoints   =  JointsPerArm*NumArms;
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  =  2; //!< The number of joints assigned to the tail
00088   const unsigned NumMouthJoints =  1; //!< the number of joints that control the mouth
00089   const unsigned NumEarJoints   =  2; //!< The number of joints which control the ears (NOT per ear, is total)
00090   const unsigned NumButtons     =  2+4+3+1; //!< the number of buttons that are available, 2 head, 4 paws, 3 back, 1 underbelly see ERS7Info::ButtonOffset_t
00091   const unsigned NumSensors     =  3+3+5;  //!< 3 IR (distance), 3 accel (force), 5 from power, see ERS7Info::SensorOffset_t
00092   const unsigned NumLEDs        =  27; //!< The number of LEDs which can be controlled
00093   const unsigned NumFacePanelLEDs = 14; //!< The number of face panel LEDs
00094   
00095   const unsigned NumPIDJoints   = NumLegJoints+NumHeadJoints+NumTailJoints+NumMouthJoints; //!< The number of joints which use PID motion - everything except ears
00096   const unsigned NumBinJoints   = NumEarJoints; //!< The number of binary joints - just the ears
00097   const unsigned NumOutputs     = NumPIDJoints + NumBinJoints + NumLEDs; //!< the total number of outputs
00098   const unsigned NumReferenceFrames = NumOutputs + 1 + NumLegs + 1 + 3; //!< for the base, paws (NumLegs), camera, and IR sensors (3) reference frames
00099 
00100   const float CameraHorizFOV=56.9/180*M_PI; //!< horizontal field of view (radians)
00101   const float CameraVertFOV=45.2/180*M_PI; //!< vertical field of view (radians)
00102   const float CameraFOV=CameraHorizFOV; //!< should be set to maximum of #CameraHorizFOV or #CameraVertFOV
00103   const unsigned int CameraResolutionX=208; //!< the number of pixels available in the 'full' layer
00104   const unsigned int CameraResolutionY=160; //!< the number of pixels available in the 'full' layer
00105   const float BallOfFootRadius=23.433/2; //!< radius of the ball of the foot
00106 
00107   //! true for joints which can be updated every 32 ms (all joints on ERS-7)
00108   /*! @hideinitializer */
00109   const bool IsFastOutput[NumOutputs] = {
00110     true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true, //PID joints
00111     true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true, //leds
00112     true,true //ears
00113   };
00114   //@}
00115   
00116   
00117   
00118   // *******************************
00119   //         OUTPUT OFFSETS
00120   // *******************************
00121 
00122 
00123   //!Corresponds to entries in ERS7Info::PrimitiveName, defined at the end of this file
00124   //!@name Output Offsets
00125 
00126   const unsigned PIDJointOffset = 0; //!< The beginning of the PID Joints
00127   const unsigned LegOffset   = PIDJointOffset;           //!< the offset of the beginning of the leg joints, #NumLegs of #JointsPerLeg each, in #LegOrder_t order; see #LegOffset_t
00128   const unsigned HeadOffset  = LegOffset+NumLegJoints;   //!< the offset of the beginning of the head joints, add #TPROffset_t to get specific joint
00129   const unsigned TailOffset  = HeadOffset+NumHeadJoints; //!< the offset of the beginning of the tail joints, add #TPROffset_t to get specific joint (except RollOffset not available)
00130   const unsigned MouthOffset = TailOffset+NumTailJoints; //!< the offset of the beginning of the mouth joint, is specific joint
00131 
00132   const unsigned LEDOffset   = PIDJointOffset + NumPIDJoints; //!< the offset of LEDs in WorldState::outputs and MotionCommand functions, see LedOffset_t for specific offsets
00133 
00134   const unsigned BinJointOffset = LEDOffset + NumLEDs;   //!< The beginning of the binary joints
00135   const unsigned EarOffset   = BinJointOffset;           //!< the offset of the beginning of the ear joints - note that ears aren't sensed.  They can be flicked by the environment and you won't know.
00136 
00137   const unsigned BaseFrameOffset   = NumOutputs; //!< Use with kinematics to refer to base reference frame
00138   const unsigned PawFrameOffset    = BaseFrameOffset+1; //!< Use with kinematics to refer to paw reference frames (add appropriate LegOrder_t to specify which paw)
00139   const unsigned CameraFrameOffset = PawFrameOffset+NumLegs; //!< Use with kinematics to refer to camera reference frame
00140   const unsigned NearIRFrameOffset = CameraFrameOffset+1; //!< Use with kinematics to refer to short-range infrared (distance) sensor reference frame
00141   const unsigned FarIRFrameOffset = NearIRFrameOffset+1; //!< Use with kinematics to refer to long-range infrared (distance) sensor reference frame
00142   const unsigned ChestIRFrameOffset = FarIRFrameOffset+1; //!< Use with kinematics to refer to chest-mounted infrared (distance) sensor reference frame
00143 
00144   //! the ordering of legs
00145   enum LegOrder_t {
00146     LFrLegOrder = 0, //!< left front leg
00147     RFrLegOrder,     //!< right front leg
00148     LBkLegOrder,     //!< left back leg
00149     RBkLegOrder      //!< right back leg
00150   };
00151   
00152   //! 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)
00153   enum REKOffset_t {
00154     RotatorOffset=0, //!< moves leg forward or backward along body
00155     ElevatorOffset,  //!< moves leg toward or away from body
00156     KneeOffset       //!< moves knee
00157   };
00158   
00159   //! The offsets of appendages with tilt (elevation), pan (heading), and roll or nod 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)
00160   enum TPROffset_t {
00161     TiltOffset = 0, //!< tilt/elevation (vertical)
00162     PanOffset,      //!< pan/heading (horizontal)
00163     RollOffset,      //!< roll (rotational)
00164     NodOffset=RollOffset       //!< nod (second tilt)
00165   };
00166   
00167   //! The offsets of the individual legs, add #REKOffset_t value to access specific joint
00168   /*! @hideinitializer */
00169   enum LegOffset_t {
00170     LFrLegOffset = LegOffset+LFrLegOrder*JointsPerLeg, //!< beginning of left front leg's joints
00171     RFrLegOffset = LegOffset+RFrLegOrder*JointsPerLeg, //!< beginning of right front leg's joints
00172     LBkLegOffset = LegOffset+LBkLegOrder*JointsPerLeg, //!< beginning of left back leg's joints
00173     RBkLegOffset = LegOffset+RBkLegOrder*JointsPerLeg  //!< beginning of right back leg's joints
00174   };
00175   
00176   //! 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
00177   /*! @hideinitializer */
00178   enum LEDOffset_t {
00179     HeadColorLEDOffset = LEDOffset, //!< the orange LED immediately above the head button (copositioned with #HeadWhiteLEDOffset)
00180     HeadWhiteLEDOffset, //!< the LED immediately above the head button (copositioned with #HeadColorLEDOffset)
00181     ModeRedLEDOffset, //!< controls both of the red LEDs above the ears (copositioned with #ModeGreenLEDOffset and #ModeBlueLEDOffset)
00182     ModeGreenLEDOffset, //!< controls both of the green LEDs above the ears (copositioned with #ModeRedLEDOffset and #ModeBlueLEDOffset)
00183     ModeBlueLEDOffset, //!< controls both of the blue LEDs above the ears (copositioned with #ModeRedLEDOffset and #ModeGreenLEDOffset)
00184     WirelessLEDOffset, //!< controls the small rectangular blue LED on the back of the head
00185     FaceLEDPanelOffset, //!< the first LED in the panel - add 0 up to (not including) #NumFacePanelLEDs to this to access specific face panel LEDs, see LedEngine for diagram of placement
00186     FrBackColorLEDOffset = FaceLEDPanelOffset+NumFacePanelLEDs, //!< @b blue/purple LED on back, closest to head (copositioned with #FrBackWhiteLEDOffset)
00187     FrBackWhiteLEDOffset,  //!< white LED on back, closest to head (copositioned with #FrBackColorLEDOffset)
00188     MdBackColorLEDOffset, //!< @b orange LED on back, in between FrBackColorLEDOffset and RrBackColorLEDOffset (copositioned with #MdBackWhiteLEDOffset)
00189     MdBackWhiteLEDOffset, //!< white LED on back, in between FrBackWhiteLEDOffset and RrBackWhiteLEDOffset (copositioned with #MdBackColorLEDOffset)
00190     RrBackColorLEDOffset, //!< @b red LED on back, farthest from head (copositioned with #RrBackWhiteLEDOffset)
00191     RrBackWhiteLEDOffset, //!< white LED on back, farthest from head (copositioned with #RrBackColorLEDOffset)
00192     LEDABModeOffset, // allows you to control A/B mode setting (this is a "virtual" LED)
00193 
00194     // aliases for 2xx cross-compatibility
00195     BotLLEDOffset = FaceLEDPanelOffset+1,//!< aliases for backward compatability with ERS-210 (use mode A); bottom left of face panel
00196     BotRLEDOffset = FaceLEDPanelOffset+0, //!< aliases for backward compatability with ERS-210 (use mode A); bottom right of face panel
00197     MidLLEDOffset = FaceLEDPanelOffset+3, //!< aliases for backward compatability with ERS-210 (use mode A); middle left of face panel
00198     MidRLEDOffset = FaceLEDPanelOffset+2, //!< aliases for backward compatability with ERS-210 (use mode A); middle right of face panel
00199     TopLLEDOffset = FaceLEDPanelOffset+7, //!< aliases for backward compatability with ERS-210 (use mode A); top left of face panel
00200     TopRLEDOffset = FaceLEDPanelOffset+6, //!< aliases for backward compatability  with ERS-210(use mode A); top right of face panel
00201     TopBrLEDOffset= HeadColorLEDOffset,//!< aliases for backward compatability with ERS-210 (use mode A); top bar (#HeadColorLEDOffset)
00202     TlRedLEDOffset= RrBackColorLEDOffset,//!< aliases for backward compatability with ERS-210; red tail light (#RrBackColorLEDOffset)
00203     TlBluLEDOffset= FrBackColorLEDOffset //!< aliases for backward compatability with ERS-210; blue tail light (#FrBackColorLEDOffset)
00204   };
00205   //@}
00206     
00207   //! Bitmasks for use when specifying combinations of LEDs (see LedEngine ) Note that left/right are robot's point of view
00208   //!@name LED Bitmasks
00209   typedef unsigned int LEDBitMask_t; //!< So you can be clear when you're refering to a LED bitmask
00210   
00211   const LEDBitMask_t HeadColorLEDMask = 1<<(HeadColorLEDOffset-LEDOffset); //!< mask corresponding to HeadColorLEDOffset
00212   const LEDBitMask_t HeadWhiteLEDMask = 1<<(HeadWhiteLEDOffset-LEDOffset); //!< mask corresponding to HeadWhiteLEDOffset
00213   const LEDBitMask_t ModeRedLEDMask = 1<<(ModeRedLEDOffset-LEDOffset); //!< mask corresponding to ModeRedLEDOffset
00214   const LEDBitMask_t ModeGreenLEDMask = 1<<(ModeGreenLEDOffset-LEDOffset); //!< mask corresponding to ModeGreenLEDOffset
00215   const LEDBitMask_t ModeBlueLEDMask = 1<<(ModeBlueLEDOffset-LEDOffset); //!< mask corresponding to ModeBlueLEDOffset
00216   const LEDBitMask_t WirelessLEDMask = 1<<(WirelessLEDOffset-LEDOffset); //!< mask corresponding to WirelessLEDOffset
00217   const LEDBitMask_t FaceLEDPanelMask = 1<<(FaceLEDPanelOffset-LEDOffset); //!< mask corresponding to FaceLEDPanelOffset, selects only the first of the panel - shift this to get the others
00218   const LEDBitMask_t FrBackColorLEDMask = 1<<(FrBackColorLEDOffset-LEDOffset); //!< mask corresponding to FrBackColorLEDOffset
00219   const LEDBitMask_t FrBackWhiteLEDMask = 1<<(FrBackWhiteLEDOffset-LEDOffset); //!< mask corresponding to FrBackWhiteLEDOffset
00220   const LEDBitMask_t MdBackColorLEDMask = 1<<(MdBackColorLEDOffset-LEDOffset); //!< mask corresponding to MdBackColorLEDOffset
00221   const LEDBitMask_t MdBackWhiteLEDMask = 1<<(MdBackWhiteLEDOffset-LEDOffset); //!< mask corresponding to MdBackWhiteLEDOffset
00222   const LEDBitMask_t RrBackColorLEDMask = 1<<(RrBackColorLEDOffset-LEDOffset); //!< mask corresponding to RrBackColorLEDOffset
00223   const LEDBitMask_t RrBackWhiteLEDMask = 1<<(RrBackWhiteLEDOffset-LEDOffset); //!< mask corresponding to RrBackWhiteLEDOffset
00224   const LEDBitMask_t LEDABModeMask = 1<<(LEDABModeOffset-LEDOffset); //!< mask corresponding to LEDABModeOffset
00225 
00226   const LEDBitMask_t BotLLEDMask = 1<<(BotLLEDOffset-LEDOffset); //!< bottom left
00227   const LEDBitMask_t BotRLEDMask = 1<<(BotRLEDOffset-LEDOffset); //!< bottom right
00228   const LEDBitMask_t MidLLEDMask = 1<<(MidLLEDOffset-LEDOffset); //!< middle left
00229   const LEDBitMask_t MidRLEDMask = 1<<(MidRLEDOffset-LEDOffset); //!< middle right
00230   const LEDBitMask_t TopLLEDMask = 1<<(TopLLEDOffset-LEDOffset); //!< top left
00231   const LEDBitMask_t TopRLEDMask = 1<<(TopRLEDOffset-LEDOffset); //!< top right
00232   const LEDBitMask_t TopBrLEDMask= 1<<(TopBrLEDOffset-LEDOffset); //!< top bar
00233   const LEDBitMask_t TlRedLEDMask= 1<<(TlRedLEDOffset-LEDOffset); //!< red tail light
00234   const LEDBitMask_t TlBluLEDMask= 1<<(TlBluLEDOffset-LEDOffset); //!< blue tail light
00235 
00236   //! LEDs for the face panel (all FaceLEDPanelMask<<(0:NumFacePanelLEDs-1) entries)
00237   /*! @hideinitializer */
00238   const LEDBitMask_t FaceLEDMask = (FaceLEDPanelMask<<0) | (FaceLEDPanelMask<<1) | (FaceLEDPanelMask<<2) | (FaceLEDPanelMask<<3) | (FaceLEDPanelMask<<4) | (FaceLEDPanelMask<<5) | (FaceLEDPanelMask<<6) | (FaceLEDPanelMask<<7) | (FaceLEDPanelMask<<8) | (FaceLEDPanelMask<<9) | (FaceLEDPanelMask<<10) | (FaceLEDPanelMask<<11) | (FaceLEDPanelMask<<12) | (FaceLEDPanelMask<<13);
00239 
00240   //! LEDs for face (all but back lights)
00241   const LEDBitMask_t HeadLEDMask
00242   = FaceLEDMask | HeadColorLEDMask | HeadWhiteLEDMask
00243   | ModeRedLEDMask | ModeGreenLEDMask | ModeBlueLEDMask
00244   | WirelessLEDMask;
00245 
00246   //! LEDS on the back
00247   const LEDBitMask_t BackLEDMask
00248   = FrBackColorLEDMask | FrBackWhiteLEDMask
00249   | MdBackColorLEDMask | MdBackWhiteLEDMask
00250   | RrBackColorLEDMask | RrBackWhiteLEDMask;
00251 
00252   //! LEDs on tail (ERS-7 has none)
00253   const LEDBitMask_t TailLEDMask = 0;
00254 
00255   //! selects all of the leds
00256   const LEDBitMask_t AllLEDMask  = (LEDBitMask_t)~0;
00257   //@}
00258   
00259   
00260   
00261   // *******************************
00262   //          INPUT OFFSETS
00263   // *******************************
00264 
00265 
00266   //! The order in which inputs should be stored
00267   //!@name Input Offsets
00268 
00269   //! holds offsets to different buttons in WorldState::buttons[]
00270   /*! Should be a straight mapping to the ButtonSourceIDs
00271    *
00272    *  Note that the chest (power) button is not a normal button.  It kills
00273    *  power to the motors at a hardware level, and isn't sensed in the
00274    *  normal way.  If you want to know when it is pressed (and you are
00275    *  about to shut down) see PowerSrcID::PauseSID.
00276    *
00277    *  @see WorldState::buttons @see ButtonSourceID_t
00278    * @hideinitializer */
00279   enum ButtonOffset_t {
00280     LFrPawOffset = LFrLegOrder,
00281     RFrPawOffset = RFrLegOrder,
00282     LBkPawOffset = LBkLegOrder,
00283     RBkPawOffset = RBkLegOrder,
00284     ChinButOffset= 4,
00285     HeadButOffset,
00286     HeadFrButOffset=HeadButOffset,
00287     FrontBackButOffset,
00288     MiddleBackButOffset,
00289     BackButOffset = MiddleBackButOffset,
00290     RearBackButOffset,
00291     WirelessSwOffset
00292   };
00293 
00294   //! Provides a string name for each button
00295   const char* const buttonNames[NumButtons] = {
00296     "LFrPaw","RFrPaw","LBkPaw","RBkPaw",
00297     "ChinBut","HeadBut",
00298     "FrontBackBut","MiddleBackBut","RearBackBut",
00299     "WirelessSw"
00300   };
00301 
00302   //! holds offset to different sensor values in WorldState::sensors[]
00303   /*! @see WorldState::sensors[] */
00304   enum SensorOffset_t {
00305     NearIRDistOffset = 0,  //!< in millimeters, ranges from 50 to 500
00306     IRDistOffset=NearIRDistOffset, //!< alias for ERS-2xx's solitary range finder
00307     FarIRDistOffset,  //!< in millimeters, ranges from 200 to 1500
00308     ChestIRDistOffset,  //!< in millimeters, ranges from 100 to 900
00309     BAccelOffset, //!< backward acceleration, in @f$m/s^2@f$, negative if sitting on butt (positive for faceplant)
00310     LAccelOffset, //!< acceleration to the robot's left, in @f$m/s^2@f$, negative if lying on robot's left side
00311     DAccelOffset, //!< downward acceleration, in @f$m/s^2@f$, negative if standing up... be careful about the signs on all of these...
00312     PowerRemainOffset, //!< percentage, 0-1
00313     PowerThermoOffset, //!<  degrees Celcius
00314     PowerCapacityOffset, //!< milli-amp hours
00315     PowerVoltageOffset, //!< volts
00316     PowerCurrentOffset //!< milli-amp negative values (maybe positive while charging?)
00317   };
00318 
00319   //! Provides a string name for each sensor
00320   const char* const sensorNames[NumSensors] = {
00321     "NearIRDist","FarIRDist","ChestIRDist",
00322     "BAccel","LAccel","DAccel",
00323     "PowerRemain","PowerThermo","PowerCapacity","PowerVoltage","PowerCurrent"
00324   };
00325 
00326   //@}
00327 
00328 
00329   //! Names for each of the outputs
00330   const char* const outputNames[NumOutputs] = {
00331     "LFr:rotor","LFr:elvtr","LFr:knee",
00332     "RFr:rotor","RFr:elvtr","RFr:knee",
00333     "LBk:rotor","LBk:elvtr","LBk:knee",
00334     "RBk:rotor","RBk:elvtr","RBk:knee",
00335     
00336     "NECK:tilt","NECK:pan","NECK:nod",
00337     
00338     "TAIL:tilt",  "TAIL:pan",
00339     
00340     "MOUTH",
00341     
00342     "LED:headC","LED:headW",
00343     "LED:modeR","LED:modeG",
00344     "LED:modeB","LED:wless",
00345     "LED:faceA","LED:faceB","LED:faceC","LED:faceD","LED:faceE","LED:faceF","LED:faceG",
00346     "LED:faceH","LED:faceI","LED:faceJ","LED:faceK","LED:faceL","LED:faceM","LED:faceN",
00347     "LED:bkFrC","LED:bkFrW",
00348     "LED:bkMdC","LED:bkMdW",
00349     "LED:bkRrC","LED:bkRrW",
00350     "LED:ABmod",
00351     
00352     "EAR:left","EAR:right"
00353   };
00354   
00355   
00356   //! provides polymorphic robot capability detection/mapping
00357   class ERS7Capabilities : public Capabilities {
00358   public:
00359     //! constructor
00360     ERS7Capabilities()
00361     : Capabilities(TargetName,NumOutputs,outputNames,NumButtons,buttonNames,NumSensors,sensorNames,PIDJointOffset,NumPIDJoints,LEDOffset,NumLEDs)
00362     {
00363       // 2xx button aliases
00364       buttonToIndex["HeadFrBut"]=HeadFrButOffset; // aliased to HeadButOffset
00365       buttonToIndex["BackBut"]=BackButOffset; //aliased to MiddleBackButOffset
00366       // 210 led aliases
00367       outputToIndex["LED:botL"]=BotLLEDOffset; // aliased to face panel...
00368       outputToIndex["LED:botR"]=BotRLEDOffset;
00369       outputToIndex["LED:midL"]=MidLLEDOffset;
00370       outputToIndex["LED:midR"]=MidRLEDOffset;
00371       outputToIndex["LED:topL"]=TopLLEDOffset;
00372       outputToIndex["LED:topR"]=TopRLEDOffset;
00373       outputToIndex["LED:topBr"]=TopBrLEDOffset;
00374       outputToIndex["LED:tlRed"]=TlRedLEDOffset; // aliased to the red back light
00375       outputToIndex["LED:tlBlu"]=TlBluLEDOffset; // aliased to the blue back light
00376       // 220 led aliases
00377       outputToIndex["LED:bkL1"]=TlBluLEDOffset; // aliased to the blue back light
00378       outputToIndex["LED:bkL2"]=TlRedLEDOffset; // aliased to the red back light
00379       // 2xx sensor aliases
00380       sensorToIndex["IRDist"]=IRDistOffset; // aliased to the near IR sensor
00381       
00382       // the AB switch is a meta-output, don't tell Aperios about it
00383       fakeOutputs.insert(LEDABModeOffset);
00384     }
00385   };
00386   //! allocation declared in RobotInfo.cc
00387   extern ERS7Capabilities capabilities;
00388   
00389   
00390   //! the joint identifier strings used to refer to specific joints in OPEN-R (but not needed for others)
00391   /*!@showinitializer 
00392    * The offset consts defined in this file correspond to this table and will make life easier
00393    * if you feel the need to reorder things, but they can't be arbitrarily reordered... \n
00394    * In particular, assumptions are made that the pid joints will be in slots 0-numPIDJoints
00395    * and that the fast outputs (ie NOT ears) will be in slots 0-NumFastOutputs\n
00396    * There may be other assumptions not noted here!!!
00397    * @note These entries DON'T correspond to the CPC index numbers (this only lists joints for identifying joints to Aperios, CPCs are for identifying sensors from Aperios */
00398   const char* const PrimitiveName [NumOutputs] = {
00399     "PRM:/r2/c1-Joint2:21",       //!< the left front leg   the rotator
00400     "PRM:/r2/c1/c2-Joint2:22",    //!< the left front leg   the elevator 
00401     "PRM:/r2/c1/c2/c3-Joint2:23", //!< the left front leg   the knee 
00402     "PRM:/r4/c1-Joint2:41",       //!< the right front leg   the rotator
00403     "PRM:/r4/c1/c2-Joint2:42",    //!< the right front leg    the elevator 
00404     "PRM:/r4/c1/c2/c3-Joint2:43", //!< the right front leg   the knee 
00405         
00406     "PRM:/r3/c1-Joint2:31",       //!< the left hind leg   the rotator
00407     "PRM:/r3/c1/c2-Joint2:32",    //!< the left hind leg   the elevator 
00408     "PRM:/r3/c1/c2/c3-Joint2:33", //!< the left hind leg   the knee
00409     "PRM:/r5/c1-Joint2:51",       //!< the right hind leg   the rotator
00410     "PRM:/r5/c1/c2-Joint2:52",    //!< the right hind leg   the elevator 
00411     "PRM:/r5/c1/c2/c3-Joint2:53", //!< the right hind leg   the knee 
00412       
00413     "PRM:/r1/c1-Joint2:11",       //!< the lower neck tilt (12)
00414     "PRM:/r1/c1/c2-Joint2:12",    //!< the neck pan 
00415     "PRM:/r1/c1/c2/c3-Joint2:13", //!< the upper neck tilt (nod)
00416         
00417     "PRM:/r6/c1-Joint2:61",       //!< the tail tilt
00418     "PRM:/r6/c2-Joint2:62",       //!< the tail rotate
00419         
00420     "PRM:/r1/c1/c2/c3/c4-Joint2:14", //!< the mouth (17)
00421         
00422     "PRM:/r1/c1/c2/c3/l1-LED2:l1", //!< Head light (color) (x6, 18)
00423     "PRM:/r1/c1/c2/c3/l2-LED2:l2", //!< Head light (white)
00424     "PRM:/r1/c1/c2/c3/l3-LED2:l3", //!< Red mode indicator
00425     "PRM:/r1/c1/c2/c3/l4-LED2:l4", //!< Green mode indicator
00426     "PRM:/r1/c1/c2/c3/l5-LED2:l5", //!< Blue mode indicator
00427     "PRM:/r1/c1/c2/c3/l6-LED2:l6", //!< wireless light
00428     
00429     "PRM:/r1/c1/c2/c3/la-LED3:la", //!< face lights... (x14, 24-37)
00430     "PRM:/r1/c1/c2/c3/lb-LED3:lb",    
00431     "PRM:/r1/c1/c2/c3/lc-LED3:lc", 
00432     "PRM:/r1/c1/c2/c3/ld-LED3:ld", 
00433     "PRM:/r1/c1/c2/c3/le-LED3:le",    
00434     "PRM:/r1/c1/c2/c3/lf-LED3:lf", 
00435     "PRM:/r1/c1/c2/c3/lg-LED3:lg", 
00436     "PRM:/r1/c1/c2/c3/lh-LED3:lh", 
00437     "PRM:/r1/c1/c2/c3/li-LED3:li", 
00438     "PRM:/r1/c1/c2/c3/lj-LED3:lj", 
00439     "PRM:/r1/c1/c2/c3/lk-LED3:lk", 
00440     "PRM:/r1/c1/c2/c3/ll-LED3:ll", 
00441     "PRM:/r1/c1/c2/c3/lm-LED3:lm", 
00442     "PRM:/r1/c1/c2/c3/ln-LED3:ln", //!< ...last face light (37)
00443 
00444     "PRM:/lu-LED3:lu", //!< front back light (color) (x6, 38)
00445     "PRM:/lv-LED3:lv", //!< front back light (white)
00446     "PRM:/lw-LED3:lw", //!< middle back light (color)
00447     "PRM:/lx-LED3:lx", //!< middle back light (white)
00448     "PRM:/ly-LED3:ly", //!< rear back light (color)
00449     "PRM:/lz-LED3:lz", //!< rear back light (white)
00450     "",  //!< the virtual mode A/B switcher
00451       
00452     "PRM:/r1/c1/c2/c3/e5-Joint4:15", //!< left ear (44)
00453     "PRM:/r1/c1/c2/c3/e6-Joint4:16" //!< right ear
00454   };
00455 
00456   //! use to open speaker connection with the system
00457   const char* const SpeakerLocator="PRM:/s1-Speaker:S1";
00458 
00459   //! use to open camera connection with the system
00460   const char* const CameraLocator="PRM:/r1/c1/c2/c3/i1-FbkImageSensor:F1";
00461 
00462   //! This table holds the default PID values for each joint.  see PIDMC
00463   const float DefaultPIDs[NumPIDJoints][3] =
00464     {
00465       { 0x1C/(double)(1<<(16-0xE)), 0x08/(double)(1<<(16-0x2)), 0x01/(double)(1<<(16-0xF)) },
00466       { 0x14/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x01/(double)(1<<(16-0xF)) },
00467       { 0x1C/(double)(1<<(16-0xE)), 0x08/(double)(1<<(16-0x2)), 0x01/(double)(1<<(16-0xF)) },
00468       { 0x1C/(double)(1<<(16-0xE)), 0x08/(double)(1<<(16-0x2)), 0x01/(double)(1<<(16-0xF)) },
00469       { 0x14/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x01/(double)(1<<(16-0xF)) },
00470       { 0x1C/(double)(1<<(16-0xE)), 0x08/(double)(1<<(16-0x2)), 0x01/(double)(1<<(16-0xF)) },
00471       { 0x1C/(double)(1<<(16-0xE)), 0x08/(double)(1<<(16-0x2)), 0x01/(double)(1<<(16-0xF)) },
00472       { 0x14/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x01/(double)(1<<(16-0xF)) },
00473       { 0x1C/(double)(1<<(16-0xE)), 0x08/(double)(1<<(16-0x2)), 0x01/(double)(1<<(16-0xF)) },
00474       { 0x1C/(double)(1<<(16-0xE)), 0x08/(double)(1<<(16-0x2)), 0x01/(double)(1<<(16-0xF)) },
00475       { 0x14/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x01/(double)(1<<(16-0xF)) },
00476       { 0x1C/(double)(1<<(16-0xE)), 0x08/(double)(1<<(16-0x2)), 0x01/(double)(1<<(16-0xF)) },
00477 
00478       { 0x0A/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x02/(double)(1<<(16-0xF)) },
00479       { 0x08/(double)(1<<(16-0xE)), 0x02/(double)(1<<(16-0x2)), 0x04/(double)(1<<(16-0xF)) },
00480       { 0x08/(double)(1<<(16-0xE)), 0x08/(double)(1<<(16-0x2)), 0x02/(double)(1<<(16-0xF)) }, // 'I' value changed to 0x08 instead of standard 0x04
00481 
00482       { 0x0A/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x04/(double)(1<<(16-0xF)) },
00483       { 0x0A/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x04/(double)(1<<(16-0xF)) },
00484 
00485       { 0x08/(double)(1<<(16-0xE)), 0x00/(double)(1<<(16-0x2)), 0x04/(double)(1<<(16-0xF)) }
00486     };
00487     
00488   //! These will control the shift values given to the system.  see PIDMC
00489   /*! These are modified from the default values to give better range of values to the gains */
00490   const unsigned char DefaultPIDShifts[3] = {0x0E, 0x02-1, 0x0F-3};
00491     
00492   //!These values are Sony's recommended maximum joint velocities, in rad/ms
00493   /*! a value <= 0 means infinite speed (e.g. LEDs)
00494    *  
00495    *  These limits are <b>not</b> enforced by the framework.  They are simply available for you to use as you see fit.
00496    *  HeadPointerMC and PostureMC are primary examples of included classes which do respect these values (although they can be overridden)
00497    *  
00498    *  These values were obtained from the administrators of the Sony OPEN-R BBS */
00499   const float MaxOutputSpeed[NumOutputs] = {
00500     4.86510529e-3, //Legs LR,FB,REK
00501     5.27962099e-3,
00502     5.27962099e-3,
00503     4.86510529e-3,
00504     5.27962099e-3,
00505     5.27962099e-3,
00506     4.86510529e-3,
00507     5.27962099e-3,
00508     5.27962099e-3,
00509     4.86510529e-3,
00510     5.27962099e-3,
00511     5.27962099e-3,
00512   
00513     3.18522588e-3, //Head TPR
00514     1.00574598e-2,
00515     5.78140315e-3,
00516   
00517     1.51625479e-2, //Tail
00518     1.51625479e-2,
00519   
00520     1.01447263e-2, //Mouth
00521     
00522     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, //LEDs
00523     
00524     0,0                //Ears
00525   };
00526 
00527   #ifndef RAD
00528     //!Just a little macro for converting degrees to radians
00529   #define RAD(deg) (((deg) * M_PI ) / 180.0)
00530     //!a flag so we undef these after we're done - do you have a cleaner solution?
00531   #define __RI_RAD_FLAG
00532   #endif
00533   
00534   //! This table holds the software limits of each of the outputs, first index is the output offset, second index is MinMaxRange_t (i.e. MinRange or MaxRange)
00535   const double outputRanges[NumOutputs][2] =
00536     {
00537       { RAD(-115),RAD(130) },{ RAD(-10),RAD(88) },{ RAD(-25),RAD(122) }, //left front REK
00538       { RAD(-115),RAD(130) },{ RAD(-10),RAD(88) },{ RAD(-25),RAD(122) }, //right front REK
00539       { RAD(-130),RAD(115) },{ RAD(-10),RAD(88) },{ RAD(-25),RAD(122) }, //left back REK
00540       { RAD(-130),RAD(115) },{ RAD(-10),RAD(88) },{ RAD(-25),RAD(122) }, //right back REK
00541 
00542       { RAD(-75),RAD(0) },{ RAD(-88),RAD(88) },{ RAD(-15),RAD(45) }, //neck Tilt-pan-nod
00543         
00544       { RAD(5),RAD(60) },{ RAD(-45),RAD(45) }, // tail tp
00545 
00546       { RAD(-55),RAD(-3) }, //mouth
00547 
00548       {0,1},{0,1},{0,1},{0,1},{0,1},{0,1}, //misc LEDs
00549       {0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1}, //Face LEDs
00550       {0,1},{0,1},{0,1},{0,1},{0,1},{0,1}, //back LEDs
00551       {0,1}, //virtual mode A/B switcher
00552     
00553       {0,1},{0,1} //ears
00554     };
00555 
00556   //! This table holds the mechanical limits of each of the outputs, first index is the output offset, second index is MinMaxRange_t (i.e. MinRange or MaxRange)
00557   /*! Same as #outputRanges, don't know actual values because they were never specified by Sony */
00558   const double mechanicalLimits[NumOutputs][2] =
00559     {
00560       { RAD(-115),RAD(130) },{ RAD(-10),RAD(88) },{ RAD(-25),RAD(122) }, //left front REK
00561       { RAD(-115),RAD(130) },{ RAD(-10),RAD(88) },{ RAD(-25),RAD(122) }, //right front REK
00562       { RAD(-115),RAD(130) },{ RAD(-10),RAD(88) },{ RAD(-25),RAD(122) }, //left back REK
00563       { RAD(-115),RAD(130) },{ RAD(-10),RAD(88) },{ RAD(-25),RAD(122) }, //right back REK
00564 
00565       { RAD(-75),RAD(0) },{ RAD(-88),RAD(88) },{ RAD(-15),RAD(45) }, //neck Tilt-pan-nod
00566         
00567       { RAD(5),RAD(60) },{ RAD(-45),RAD(45) }, // tail tp
00568 
00569       { RAD(-55),RAD(-3) }, //mouth
00570 
00571       {0,1},{0,1},{0,1},{0,1},{0,1},{0,1}, //misc head LEDs
00572       {0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1},{0,1}, //Face LEDs
00573       {0,1},{0,1},{0,1},{0,1},{0,1},{0,1}, //back LEDs
00574       {0,1}, //virtual mode A/B switcher
00575 
00576       {0,1},{0,1} //ears
00577     };
00578 
00579 #ifdef __RI_RAD_FLAG
00580 #undef RAD
00581 #undef __RI_RAD_FLAG
00582 #endif
00583 
00584 
00585   /*! @name CPC IDs
00586    * Values defined by OPEN-R, used to interface with lower level OPEN-R code to read sensors - values @e don't correspond to order of ERS7Info::PrimitiveName */
00587   const int CPCJointMouth      =  0; //!< Mouth                           
00588   const int CPCSwitchChin      =  1; //!< Chin sensor                     
00589   const int CPCJointNeckNod    =  2; //!< Neck tilt2                      
00590   const int CPCSensorHead      =  3; //!< Head sensor                     
00591   const int CPCSensorNearPSD   =  4; //!< Head distance sensor(near)      
00592   const int CPCSensorFarPSD    =  5; //!< Head distance sensor(far)       
00593   const int CPCJointNeckPan    =  6; //!< Neck pan                        
00594   const int CPCJointNeckTilt   =  7; //!< Neck tilt1                      
00595   const int CPCSwitchLFPaw     =  8; //!< Left fore leg  paw sensor       
00596   const int CPCJointLFKnee     =  9; //!< Left fore legJ3                 
00597   const int CPCJointLFElevator = 10; //!< Left fore legJ2                 
00598   const int CPCJointLFRotator  = 11; //!< Left fore legJ1                 
00599   const int CPCSwitchLHPaw     = 12; //!< Left hind leg  paw sensor       
00600   const int CPCJointLHKnee     = 13; //!< Left hind legJ3                 
00601   const int CPCJointLHElevator = 14; //!< Left hind legJ2                 
00602   const int CPCJointLHRotator  = 15; //!< Left hind legJ1                 
00603   const int CPCSwitchRFPaw     = 16; //!< Right fore leg  paw sensor      
00604   const int CPCJointRFKnee     = 17; //!< Right fore legJ3                
00605   const int CPCJointRFElevator = 18; //!< Right fore legJ2                
00606   const int CPCJointRFRotator  = 19; //!< Right fore legJ1                
00607   const int CPCSwitchRHPaw     = 20; //!< Right hind leg  paw sensor      
00608   const int CPCJointRHKnee     = 21; //!< Right hind legJ3                
00609   const int CPCJointRHElevator = 22; //!< Right hind legJ2                
00610   const int CPCJointRHRotator  = 23; //!< Right hind legJ1                
00611   const int CPCJointTailTilt   = 24; //!< Tail tilt                       
00612   const int CPCJointTailPan    = 25; //!< Tail pan                        
00613   const int CPCSensorAccelFB   = 26; //!< Acceleration sensor(front-back) 
00614   const int CPCSensorAccelLR   = 27; //!< Acceleration sensor(right-left) 
00615   const int CPCSensorAccelUD   = 28; //!< Acceleration sensor(up-down)    
00616   const int CPCSensorChestPSD  = 29; //!< Chest distance sensor           
00617   const int CPCSwitchWireless  = 30; //!< Wireless LAN switch             
00618   const int CPCSensorBackRear  = 31; //!< Back sensor(rear)               
00619   const int CPCSensorBackMiddle= 32; //!< Back sensor(middle)             
00620   const int CPCSensorBackFront = 33; //!< Back sensor(front)              
00621   //@}
00622 
00623 }
00624   
00625 /*! @file
00626  * @brief Defines RobotInfo namespace for ERS-7 models, gives some information about the robot's capabilities, such as joint counts, offsets, names and PID values
00627  * @author ejt (Creator)
00628  *
00629  * $Author: ejt $
00630  * $Name: tekkotsu-4_0 $
00631  * $Revision: 1.47 $
00632  * $State: Exp $
00633  * $Date: 2007/11/09 19:01:14 $
00634  */
00635 
00636 #endif

Tekkotsu v4.0
Generated Thu Nov 22 00:54:52 2007 by Doxygen 1.5.4