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

Tekkotsu v3.0
Generated Wed Oct 4 00:03:43 2006 by Doxygen 1.4.7