Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

CommonCalliopeInfo.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_CommonCalliopeInfo_h
00003 #define INCLUDED_CommonCalliopeInfo_h
00004 
00005 #include <cmath>
00006 #include <stdlib.h>
00007 #include "CommonInfo.h"
00008 using namespace RobotInfo;
00009 
00010 // see http://tekkotsu.org/porting.html#configuration for more information on TGT_HAS_* flags
00011 
00012 #if defined(TGT_CALLIOPE)
00013 #  define TGT_IS_CALLIOPE
00014 #endif
00015 
00016 #if defined(TGT_CALLIOPESP) || defined(TGT_CALLIOPELP) || defined(TGT_CALLIOPEKP)
00017 #  define TGT_IS_CALLIOPE
00018 #  define TGT_IS_CALLIOPE0
00019 #endif
00020 
00021 #if defined(TGT_CALLIOPE2SP) || defined(TGT_CALLIOPE2LP) || defined(TGT_CALLIOPE2KP)
00022 #  define TGT_IS_CALLIOPE
00023 #  define TGT_IS_CALLIOPE2
00024 #endif
00025 
00026 #if defined(TGT_CALLIOPE5SP) || defined(TGT_CALLIOPE5LP) || defined(TGT_CALLIOPE5KP)
00027 #  define TGT_IS_CALLIOPE
00028 #  define TGT_IS_CALLIOPE5
00029 #endif
00030 
00031 #if defined(TGT_CALLIOPEKP) || defined(TGT_CALLIOPE2KP) || defined(TGT_CALLIOPE5KP)
00032 #  define TGT_HAS_KINECT
00033 #endif
00034 
00035 // Common to all Calliope models
00036 #if defined(TGT_IS_CALLIOPE)
00037 #  define TGT_IS_CREATE
00038 #  define TGT_HAS_WHEELS 2
00039 #  define TGT_HAS_BUTTONS 15
00040 #  define TGT_HAS_LEDS 4
00041 #  define TGT_HAS_CAMERA 1
00042 #endif
00043 
00044 // Everything but the base model (old TGT_CREATE) has a pan-tilt
00045 #if !defined(TGT_CALLIOPE)
00046 #  define TGT_HAS_HEAD 1
00047 #endif
00048 
00049 // 2-DOF arm with open-close gripper
00050 #if defined(TGT_IS_CALLIOPE2)
00051 #  define TGT_HAS_ARMS 1
00052 #  define TGT_HAS_GRIPPER 1
00053 #endif
00054 
00055 // 5-DOF arm with indpendent fingers
00056 #if defined(TGT_IS_CALLIOPE5)
00057 #  define TGT_HAS_ARMS 1
00058 #  define TGT_HAS_GRIPPER 1
00059 #  define TGT_HAS_FINGERS 2
00060 #endif
00061 
00062 // models with a head but not a kinect have an AX-S1 with 3 IR rangefinders
00063 #if defined(TGT_HAS_HEAD) && !defined(TGT_HAS_KINECT)
00064 #  define TGT_HAS_IR_DISTANCE 3
00065 #endif
00066 
00067 #ifndef RAD
00068 //!Just a little macro for converting degrees to radians
00069 #define RAD(deg) (((deg) * (float)M_PI ) / 180.0f)
00070 //!a flag so we undef these after we're done - do you have a cleaner solution?
00071 #define __RI_RAD_FLAG
00072 #endif
00073 
00074 
00075 //! Contains information about a Calliope robot, such as number of joints, LEDs, etc.
00076 namespace CommonCalliopeInfo {
00077   
00078   // *******************************
00079   //       ROBOT CONFIGURATION
00080   // *******************************
00081 
00082   const unsigned int FrameTime=30;        //!< time between frames in the motion system (milliseconds)
00083   const unsigned int NumFrames=1;        //!< the number of frames per buffer (don't forget also double buffered)
00084   const unsigned int SoundBufferTime=32; //!< the number of milliseconds per sound buffer... I'm not sure if this can be changed
00085   
00086   //!@name Output Types Information
00087   const unsigned NumWheels      =  2;
00088   
00089   const unsigned JointsPerLeg   =  0; //!< The number of joints per leg
00090   const unsigned NumLegs        =  0; //!< The number of legs
00091   const unsigned NumLegJoints   =  JointsPerLeg*NumLegs; //!< the TOTAL number of joints on ALL legs
00092   const unsigned NumTailJoints  =  0; //!< The number of joints assigned to the tail
00093   const unsigned NumMouthJoints =  0; //!< the number of joints that control the mouth
00094   const unsigned NumEarJoints   =  0; //!< The number of joints which control the ears (NOT per ear, is total)
00095   const unsigned NumButtons     =  15; //!< the number of buttons that are available
00096   const unsigned NumLEDs        =  4; //!< The number of LEDs which can be controlled
00097   const unsigned NumFacePanelLEDs = 0; //!< The number of face panel LEDs
00098   //@}
00099 
00100 
00101   // *******************************
00102   //         OUTPUT OFFSETS
00103   // *******************************
00104 
00105   //!Corresponds to entries in outputNames, defined at the end of this file
00106   //!@name Output Offsets
00107 
00108   
00109   const unsigned PIDJointOffset = 0; //!< The beginning of the PID Joints
00110   const unsigned WheelOffset = PIDJointOffset;
00111 
00112   enum WheelOffset_t {
00113     LWheelOffset=WheelOffset,
00114     RWheelOffset
00115   };
00116   
00117   //! Offset needed so that the centroid of the robot is correct related to the bounding box
00118   const fmat::Column<3> AgentBoundingBoxBaseFrameOffset = fmat::pack(838.4/2-304.8/2,0,0);
00119 
00120   //! Half of the length, width, and height of the robot.
00121   const fmat::Column<3> AgentBoundingBoxHalfDims = fmat::pack(838.4/2, 304.8/2, 0);
00122 
00123   // *******************************
00124   //          INPUT OFFSETS
00125   // *******************************
00126 
00127 
00128   //! The order in which inputs should be stored
00129   //!@name Input Offsets
00130 
00131   //! holds offsets to different buttons in WorldState::buttons[]
00132   /*! Should be a straight mapping to the ButtonSourceIDs
00133    *
00134    *  @see WorldState::buttons
00135    * @hideinitializer */
00136   enum ButtonOffset_t {
00137     PlayButOffset, //!< 1 if play button is down
00138     AdvanceButOffset, //!< 1 if advance button is down
00139     WallButOffset, //!< 1 if wall is detected (note correspondence to WALL_SIGNAL_OFFSET's value, avoiding problems if the two are swapped)
00140     DropCasterButOffset, //!< 1 if caster detects dropoff
00141     DropLeftWheelButOffset, //!< 1 if left wheel detects dropoff
00142     DropRightWheelButOffset, //!< 1 if right wheel detects dropoff
00143     BumpLeftButOffset, //!< 1 if left bumper is pressed
00144     BumpRightButOffset, //!< 1 if right bumper is pressed
00145     OvercurrentLeftWheelOffset, //!< 1 if the left wheel is drawing more than 1 amp
00146     OvercurrentRightWheelOffset, //!< 1 if the right wheel is drawing more than 1 amp
00147     LowSideDriver0ButOffset, //!< 1 if low side driver 0 is pulling more than 0.5 amps
00148     LowSideDriver1ButOffset, //!< 1 if low side driver 1 is pulling more than 0.5 amps
00149     LowSideDriver2ButOffset, //!< 1 if low side driver 2 is pulling more than 1.6 amps
00150     BaseChargerButOffset, //!< 1 if the home base charger is available
00151     InternalChargerButOffset //!< 1 if the internal charger is available
00152   };
00153 
00154   const ButtonOffset_t GreenButOffset = PlayButOffset;
00155   const ButtonOffset_t YellowButOffset = AdvanceButOffset;
00156   const ButtonOffset_t RedButOffset = PlayButOffset;
00157 
00158   //! Provides a string name for each button
00159   const char* const buttonNames[NumButtons+1] = { 
00160     "Play", "Advance",
00161     "Wall",
00162     "CasterDrop", "LWheelDrop", "RWheelDrop",
00163     "LBump", "RBump",
00164     "LOverCurrent", "ROverCurrent",
00165     "DriverLow0", "DriverLow1", "DriverLow2",
00166     "BaseCharger", "InternalCharger",
00167     NULL
00168   };
00169 
00170   //! holds offset to different sensor values in WorldState::sensors[]
00171   /*! @see WorldState::sensors[] */
00172   enum SensorOffset_t {
00173     DigitalInput0Offset, //!< the digital input pins in bits 0 through 4
00174     DigitalInput1Offset, //!< the digital input pins in bits 0 through 4
00175     DigitalInput2Offset, //!< the digital input pins in bits 0 through 4
00176     DigitalInput3Offset, //!< the digital input pins in bits 0 through 4
00177     AnalogSignalOffset, //!< voltage on cargo bay pin 4
00178     WallSignalOffset, //!< strength of the wall sensor's signal (note correspondence to WALL_OFFSET's value, avoid problems if the two are swapped)
00179     IRCommOffset, //!< value received by the infrared communication receiver, see IRComm_t for values sent by standard hardware
00180     CliffLeftSignalOffset, //!< strength of the left cliff sensor
00181     CliffFrontLeftSignalOffset, //!< strength of the front left cliff sensor
00182     CliffFrontRightSignalOffset, //!< strength of the front right cliff sensor
00183     CliffRightSignalOffset, //!< strength of the right cliff sensor
00184     EncoderDistanceOffset, //!< average distance (mm) traveled by the wheels since last update
00185     EncoderAngleOffset, //!< average angle (radians) rotated since the last update
00186     VoltageOffset, //!< mV measured at battery
00187     CurrentOffset, //!< mA flowing into battery (negative when discharging)
00188     BatteryChargeOffset, //!< mAh remaining in battery (may not be accurate with alkaline battery pack)
00189     BatteryTempOffset, //!< degrees celsius
00190     ChargingStateOffset, //!< one of #ChargingState_t
00191     ModeStateOffset, //!< one of #ModeState_t
00192   };
00193   
00194   enum IRComm_t {
00195     IR_REMOTE_LEFT=129,
00196     IR_REMOTE_FORWARD,
00197     IR_REMOTE_RIGHT,
00198     IR_REMOTE_SPOT,
00199     IR_REMOTE_MAX,
00200     IR_REMOTE_SMALL,
00201     IR_REMOTE_MEDIUM,
00202     IR_REMOTE_LARGE,
00203     IR_REMOTE_PAUSE,
00204     IR_REMOTE_POWER,
00205     IR_REMOTE_ARC_LEFT, 
00206     IR_REMOTE_ARC_RIGHT,
00207     IR_REMOTE_STOP,
00208     IR_REMOTE_SEND,
00209     IR_REMOTE_DOCK,
00210     IR_BASE_RED=248,
00211     IR_BASE_GREEN=244,
00212     IR_BASE_FORCE=242,
00213     IR_BASE_RED_GREEN=252,
00214     IR_BASE_RED_FORCE=250,
00215     IR_BASE_GREEN_FORCE=246,
00216     IR_BASE_RED_GREEN_FORCE=254
00217   };
00218   /*const unsigned IR_BASE_MASK=240;
00219   const unsigned IR_BASE_RED_MASK=8;
00220   const unsigned IR_BASE_GREEN_MASK=4;
00221   const unsigned IR_BASE_FORCE_MASK=2;*/
00222   
00223   enum ChargingState_t {
00224     CHARGING_OFF,
00225     CHARGING_RECONDITIONING,
00226     CHARGING_FULL,
00227     CHARGING_TRICKLE,
00228     CHARGING_WAITING,
00229     CHARGING_FAULT
00230   };
00231 
00232   enum ModeState_t {
00233     MODE_OFF,
00234     MODE_PASSIVE,
00235     MODE_SAFE,
00236     MODE_FULL
00237   };
00238     
00239   //@}
00240 
00241 
00242   namespace WithoutAXS1Sensors {
00243     const unsigned NumSensors     =  19;  //!< the number of sensors available: 19 Create
00244     
00245     //! Provides a string name for each sensor
00246     const char* const sensorNames[NumSensors+1] = { 
00247       "DigitalIn0",
00248       "DigitalIn1",
00249       "DigitalIn2",
00250       "DigitalIn3",
00251       "AnalogIn",
00252       "WallSignal",
00253       "IR",
00254       "CliffLeftSignal",
00255       "CliffFrontLeftSignal",
00256       "CliffFrontRightSignal",
00257       "CliffRight",
00258       "Distance",
00259       "Angle",
00260       "BatteryVoltage",
00261       "BatteryCurrent",
00262       "BatteryCharge",
00263       "BatteryTemp",
00264       "ChargingState",
00265       "ModeState",
00266       NULL
00267     };
00268     
00269   }
00270   
00271   namespace WithAXS1Sensors {
00272     const unsigned NumSensors     =  WithoutAXS1Sensors::NumSensors+3+3+2;  //!< the number of sensors available: 19 Create plus 3 IR, 3 luminosity, 2 mic from AX-S1
00273     
00274     enum AXS1SensorOffset_t {
00275       LeftIRDistOffset = ModeStateOffset+1,
00276       CenterIRDistOffset,
00277       IRDistOffset = CenterIRDistOffset,
00278       RightIRDistOffset,
00279       LeftLuminosityOffset,
00280       CenterLuminosityOffset,
00281       RightLuminosityOffset,
00282       MicVolumeOffset,
00283       MicSpikeCountOffset
00284     };
00285     
00286     //! Provides a string name for each sensor
00287     const char* const sensorNames[NumSensors+1] = { 
00288       "DigitalIn0",
00289       "DigitalIn1",
00290       "DigitalIn2",
00291       "DigitalIn3",
00292       "AnalogIn",
00293       "WallSignal",
00294       "IR",
00295       "CliffLeftSignal",
00296       "CliffFrontLeftSignal",
00297       "CliffFrontRightSignal",
00298       "CliffRight",
00299       "Distance",
00300       "Angle",
00301       "BatteryVoltage",
00302       "BatteryCurrent",
00303       "BatteryCharge",
00304       "BatteryTemp",
00305       "ChargingState",
00306       "ModeState",
00307       "LeftIRDist", "CenterIRDist", "RightIRDist",
00308       "LeftLuminosity", "CenterLuminosity", "RightLuminosity",
00309       "MicVolume", "MicSpikeCount",
00310       NULL
00311     };
00312   }
00313   
00314   namespace WithHead {
00315     const unsigned NumHeadJoints = 2; //!< The number of joints in the pan/tilt
00316     const unsigned HeadOffset  = WheelOffset+NumWheels;   //!< the offset of the beginning of the head joints, add TPROffset_t to get specific joint
00317     
00318     //! The offsets of appendages with pan (heading), tilt (elevation), note that this should be added to HeadOffset, otherwise use HeadOffset_t (#HeadPanOffset and #HeadTiltOffset)
00319     enum TPROffset_t {
00320       PanOffset = 0,      //!< pan/heading (horizontal)
00321       TiltOffset, //!< tilt/elevation (vertical)
00322       NodOffset = TiltOffset //!< replicated tilt (could be left undefined instead...)
00323     };
00324     
00325     //! These are 'absolute' offsets for the neck joints, don't need to add to HeadOffset like TPROffset_t values do
00326     enum HeadOffset_t {
00327       HeadPanOffset = HeadOffset,      //!< pan/heading (horizontal)
00328       HeadTiltOffset, //!< tilt/elevation (vertical)
00329     };
00330   }
00331   
00332   // No arm, no head
00333   namespace CalliopeInfo {
00334     const unsigned JointsPerArm   =  0;
00335     const unsigned NumArms        =  0;
00336     const unsigned NumArmJoints   =  JointsPerArm*NumArms;
00337     const unsigned NumHeadJoints = 0;
00338     const unsigned NumPIDJoints   = NumWheels + NumHeadJoints + NumArmJoints; //!< number of motors and servos
00339     const unsigned NumOutputs     = NumPIDJoints + NumLEDs + 1 /*Create mode*/; //!< the total number of outputs
00340 
00341     const unsigned LEDOffset   = WheelOffset+NumWheels;
00342     const unsigned ModeOffset = LEDOffset + NumLEDs;
00343     
00344     const unsigned BaseFrameOffset   = NumOutputs; //!< Use with kinematics to refer to base reference frame
00345     const unsigned CameraFrameOffset = BaseFrameOffset+1; //!< Use with kinematics to refer to camera reference frame
00346 
00347     //! The offsets of the individual LEDs
00348     /*! @hideinitializer */
00349     enum LEDOffset_t {
00350       PowerRedLEDOffset=LEDOffset,
00351       PowerGreenLEDOffset,
00352       PlayLEDOffset,
00353       AdvanceLEDOffset
00354     };
00355     
00356     const LEDOffset_t RedLEDOffset = PowerRedLEDOffset;
00357     const LEDOffset_t BlueLEDOffset = AdvanceLEDOffset; //!< Create has no blue LED: use Advance LED here, and Advance+PowerRED in BlueLEDMask
00358     const LEDOffset_t GreenLEDOffset = PlayLEDOffset;
00359     const LEDOffset_t YellowLEDOffset = AdvanceLEDOffset;
00360     
00361     typedef unsigned int LEDBitMask_t; //!< So you can be clear when you're refering to a LED bitmask
00362     
00363     const LEDBitMask_t BlueLEDMask = (1<<(AdvanceLEDOffset-LEDOffset)) |
00364     (1<<(PowerRedLEDOffset-LEDOffset)); //!< Create has no blue LED, so use Advance (green) + Power (red)
00365     const LEDBitMask_t GreenLEDMask = 1<<(GreenLEDOffset-LEDOffset); //!< mask corresponding to GreenLEDOffset
00366     const LEDBitMask_t YellowLEDMask = 1<<(YellowLEDOffset-LEDOffset); //!< mask corresponding to YellowLEDOffset
00367     const LEDBitMask_t RedLEDMask = 1<<(RedLEDOffset-LEDOffset); //!< mask corresponding to RedLEDOffset
00368     
00369     const LEDBitMask_t PowerRedLEDMask = 1<<(PowerRedLEDOffset-LEDOffset); //!< mask corresponding to BlueLEDOffset
00370     const LEDBitMask_t PowerGreenLEDMask = 1<<(PowerGreenLEDOffset-LEDOffset); //!< mask corresponding to GreenLEDOffset
00371     const LEDBitMask_t PlayLEDMask = 1<<(PlayLEDOffset-LEDOffset); //!< mask corresponding to YellowLEDOffset
00372     const LEDBitMask_t AdvanceLEDMask = 1<<(AdvanceLEDOffset-LEDOffset); //!< mask corresponding to RedLEDOffset
00373     
00374     //! LEDs for the face panel (all FaceLEDPanelMask<<(0:NumFacePanelLEDs-1) entries)
00375     const LEDBitMask_t FaceLEDMask = 0;
00376     //! selects all of the leds
00377     const LEDBitMask_t AllLEDMask  = (LEDBitMask_t)~0;
00378     //@}
00379 
00380     //! This table holds the default PID values for each joint.  see PIDMC
00381     const float DefaultPIDs[NumPIDJoints][3] = {
00382       {1,0,0},
00383       {1,0,0},
00384     };
00385     
00386     //!These values are our recommended maximum joint velocities, in rad/ms
00387     const float MaxOutputSpeed[NumOutputs] = {
00388       0, 0,   // wheels
00389       0,
00390       0,
00391       0,
00392       0,
00393       0
00394     };
00395     
00396     //! 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)
00397     const float outputRanges[NumOutputs][2] =
00398     {
00399       { -500 , 500 }, // left wheel
00400       { -500 , 500 }, // right wheel
00401       {  0 , 1 },
00402       {  0 , 1 },
00403       {  0 , 1 },
00404       {  0 , 1 },
00405       { MODE_PASSIVE, MODE_SAFE }
00406     };
00407     
00408   }
00409   
00410   // no arm, with pan/tilt head and AX-S1
00411   namespace Calliope0 {
00412     using namespace CommonCalliopeInfo::WithHead;
00413     
00414     const unsigned JointsPerArm   =  0;
00415     const unsigned NumArms        =  0;
00416     const unsigned NumArmJoints   =  JointsPerArm*NumArms;
00417     const unsigned NumPIDJoints   = NumWheels + NumHeadJoints + NumArmJoints; //!< number of motors and servos
00418     const unsigned NumOutputs     = NumPIDJoints + NumLEDs + 1 /*Create mode*/; //!< the total number of outputs
00419 
00420     const unsigned LEDOffset   = WheelOffset+NumWheels;
00421     const unsigned ModeOffset = LEDOffset + NumLEDs;
00422     
00423     const unsigned BaseFrameOffset   = NumOutputs; //!< Use with kinematics to refer to base reference frame
00424     const unsigned CameraFrameOffset = BaseFrameOffset+1; //!< Use with kinematics to refer to camera reference frame
00425     const unsigned LeftIRFrameOffset = CameraFrameOffset+1; //!< Use with kinematics to refer to left IR distance rangefinder reference frame
00426     const unsigned CenterIRFrameOffset = LeftIRFrameOffset+1; //!< Use with kinematics to refer to center IR distance rangefinder reference frame
00427     const unsigned IRFrameOffset = CenterIRFrameOffset; //!< alias for CenterIRFrameOffset
00428     const unsigned RightIRFrameOffset = CenterIRFrameOffset+1; //!< Use with kinematics to refer to right IR distance rangefinder reference frame
00429     
00430     //! The offsets of the individual LEDs
00431     /*! @hideinitializer */
00432     enum LEDOffset_t {
00433       PowerRedLEDOffset=LEDOffset,
00434       PowerGreenLEDOffset,
00435       PlayLEDOffset,
00436       AdvanceLEDOffset
00437     };
00438     
00439     const LEDOffset_t RedLEDOffset = PowerRedLEDOffset;
00440     const LEDOffset_t BlueLEDOffset = AdvanceLEDOffset; //!< Create has no blue LED: use Advance LED here, and Advance+PowerRED in BlueLEDMask
00441     const LEDOffset_t GreenLEDOffset = PlayLEDOffset;
00442     const LEDOffset_t YellowLEDOffset = AdvanceLEDOffset;
00443     
00444     typedef unsigned int LEDBitMask_t; //!< So you can be clear when you're refering to a LED bitmask
00445     
00446     const LEDBitMask_t BlueLEDMask = (1<<(AdvanceLEDOffset-LEDOffset)) |
00447     (1<<(PowerRedLEDOffset-LEDOffset)); //!< Create has no blue LED, so use Advance (green) + Power (red)
00448     const LEDBitMask_t GreenLEDMask = 1<<(GreenLEDOffset-LEDOffset); //!< mask corresponding to GreenLEDOffset
00449     const LEDBitMask_t YellowLEDMask = 1<<(YellowLEDOffset-LEDOffset); //!< mask corresponding to YellowLEDOffset
00450     const LEDBitMask_t RedLEDMask = 1<<(RedLEDOffset-LEDOffset); //!< mask corresponding to RedLEDOffset
00451     
00452     const LEDBitMask_t PowerRedLEDMask = 1<<(PowerRedLEDOffset-LEDOffset); //!< mask corresponding to BlueLEDOffset
00453     const LEDBitMask_t PowerGreenLEDMask = 1<<(PowerGreenLEDOffset-LEDOffset); //!< mask corresponding to GreenLEDOffset
00454     const LEDBitMask_t PlayLEDMask = 1<<(PlayLEDOffset-LEDOffset); //!< mask corresponding to YellowLEDOffset
00455     const LEDBitMask_t AdvanceLEDMask = 1<<(AdvanceLEDOffset-LEDOffset); //!< mask corresponding to RedLEDOffset
00456     
00457     //! LEDs for the face panel (all FaceLEDPanelMask<<(0:NumFacePanelLEDs-1) entries)
00458     const LEDBitMask_t FaceLEDMask = 0;
00459     //! selects all of the leds
00460     const LEDBitMask_t AllLEDMask  = (LEDBitMask_t)~0;
00461     //@}
00462     //! This table holds the default PID values for each joint.  see PIDMC
00463     const float DefaultPIDs[NumPIDJoints][3] = {
00464       {1,0,0},
00465       {1,0,0},
00466       {1,0,0},
00467       {1,0,0}
00468     };
00469     
00470     //!These values are our recommended maximum joint velocities, in rad/ms
00471     const float MaxOutputSpeed[NumOutputs] = {
00472       0, 0,   // wheels
00473       0, 0,   // head
00474       0,
00475       0,
00476       0,
00477       0,
00478       0
00479     };
00480     
00481     //! 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)
00482     const float outputRanges[NumOutputs][2] =
00483     {
00484       { -500 , 500 }, // left wheel
00485       { -500 , 500 }, // right wheel
00486       {RAD(-150),RAD(150)}, // neck pan
00487       {RAD(-92),RAD(75)}, // neck tilt
00488       {  0 , 1 },
00489       {  0 , 1 },
00490       {  0 , 1 },
00491       {  0 , 1 },
00492       { MODE_PASSIVE, MODE_SAFE }
00493     };
00494     
00495   }
00496   
00497   // 2-dof arm, with pan/tilt head and AX-S1
00498   namespace Calliope2 {
00499     using namespace CommonCalliopeInfo::WithHead;
00500     
00501     const unsigned JointsPerArm   =  3; //!< 2 arm joints plus gripper
00502     const unsigned NumArms        =  1;
00503     const unsigned NumArmJoints   =  JointsPerArm*NumArms;
00504     const unsigned NumPIDJoints   = NumWheels + NumHeadJoints + NumArmJoints; //!< number of motors and servos
00505     const unsigned NumOutputs     = NumPIDJoints + NumLEDs + 1 /*Create mode*/; //!< the total number of outputs
00506 
00507     const unsigned ArmOffset = HeadOffset+NumHeadJoints;
00508     const unsigned LEDOffset   = ArmOffset+NumArmJoints;
00509     const unsigned ModeOffset = LEDOffset + NumLEDs;
00510     
00511     const unsigned BaseFrameOffset   = NumOutputs; //!< Use with kinematics to refer to base reference frame
00512     const unsigned GripperFrameOffset = BaseFrameOffset + 1; //!< Use with kinematics to refer to gripper reference frame
00513     const unsigned CameraFrameOffset = GripperFrameOffset+NumArms; //!< Use with kinematics to refer to camera reference frame
00514     const unsigned LeftIRFrameOffset = CameraFrameOffset+1; //!< Use with kinematics to refer to left IR distance rangefinder reference frame
00515     const unsigned CenterIRFrameOffset = LeftIRFrameOffset+1; //!< Use with kinematics to refer to center IR distance rangefinder reference frame
00516     const unsigned IRFrameOffset = CenterIRFrameOffset; //!< alias for CenterIRFrameOffset
00517     const unsigned RightIRFrameOffset = CenterIRFrameOffset+1; //!< Use with kinematics to refer to right IR distance rangefinder reference frame
00518 
00519     //! These are 'absolute' offsets for the arm joints, don't need to add to ArmOffset like TPROffset_t values do
00520     enum ArmOffset_t {
00521       ArmBaseOffset=ArmOffset,
00522       ArmElbowOffset,
00523       GripperOffset
00524     };
00525     
00526     //! The offsets of the individual LEDs
00527     /*! @hideinitializer */
00528     enum LEDOffset_t {
00529       PowerRedLEDOffset=LEDOffset,
00530       PowerGreenLEDOffset,
00531       PlayLEDOffset,
00532       AdvanceLEDOffset
00533     };
00534     
00535     const LEDOffset_t RedLEDOffset = PowerRedLEDOffset;
00536     const LEDOffset_t BlueLEDOffset = AdvanceLEDOffset; //!< Create has no blue LED: use Advance LED here, and Advance+PowerRED in BlueLEDMask
00537     const LEDOffset_t GreenLEDOffset = PlayLEDOffset;
00538     const LEDOffset_t YellowLEDOffset = AdvanceLEDOffset;
00539     
00540     typedef unsigned int LEDBitMask_t; //!< So you can be clear when you're refering to a LED bitmask
00541     
00542     const LEDBitMask_t BlueLEDMask = (1<<(AdvanceLEDOffset-LEDOffset)) |
00543     (1<<(PowerRedLEDOffset-LEDOffset)); //!< Create has no blue LED, so use Advance (green) + Power (red)
00544     const LEDBitMask_t GreenLEDMask = 1<<(GreenLEDOffset-LEDOffset); //!< mask corresponding to GreenLEDOffset
00545     const LEDBitMask_t YellowLEDMask = 1<<(YellowLEDOffset-LEDOffset); //!< mask corresponding to YellowLEDOffset
00546     const LEDBitMask_t RedLEDMask = 1<<(RedLEDOffset-LEDOffset); //!< mask corresponding to RedLEDOffset
00547     
00548     const LEDBitMask_t PowerRedLEDMask = 1<<(PowerRedLEDOffset-LEDOffset); //!< mask corresponding to BlueLEDOffset
00549     const LEDBitMask_t PowerGreenLEDMask = 1<<(PowerGreenLEDOffset-LEDOffset); //!< mask corresponding to GreenLEDOffset
00550     const LEDBitMask_t PlayLEDMask = 1<<(PlayLEDOffset-LEDOffset); //!< mask corresponding to YellowLEDOffset
00551     const LEDBitMask_t AdvanceLEDMask = 1<<(AdvanceLEDOffset-LEDOffset); //!< mask corresponding to RedLEDOffset
00552     
00553     //! LEDs for the face panel (all FaceLEDPanelMask<<(0:NumFacePanelLEDs-1) entries)
00554     const LEDBitMask_t FaceLEDMask = 0;
00555     //! selects all of the leds
00556     const LEDBitMask_t AllLEDMask  = (LEDBitMask_t)~0;
00557     //@}
00558     //! This table holds the default PID values for each joint.  see PIDMC
00559     const float DefaultPIDs[NumPIDJoints][3] = {
00560       {1,0,0},
00561       {1,0,0},
00562       {1,0,0},
00563       {1,0,0},
00564       {1,0,0},
00565       {1,0,0},
00566       {1,0,0}
00567     };
00568     
00569     //!These values are our recommended maximum joint velocities, in rad/ms
00570     const float MaxOutputSpeed[NumOutputs] = {
00571       0, 0,   // wheels
00572       0, 0,   // head
00573       0, 0, 0, // arm
00574       0,
00575       0,
00576       0,
00577       0,
00578       0
00579     };
00580     
00581     //! 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)
00582     const float outputRanges[NumOutputs][2] =
00583     {
00584       { -500 , 500 }, // left wheel
00585       { -500 , 500 }, // right wheel
00586       {RAD(-150),RAD(150)}, // neck pan
00587       {RAD(-92),RAD(75)}, // neck tilt
00588       {RAD(-150),RAD(75)}, // arm base
00589       {RAD(-60),RAD(49)}, // arm elbow
00590       {RAD(0),RAD(150)}, // gripper
00591       {  0 , 1 },
00592       {  0 , 1 },
00593       {  0 , 1 },
00594       {  0 , 1 },
00595       { MODE_PASSIVE, MODE_SAFE }
00596     };
00597     
00598   }
00599   
00600   // 5-dof arm, with pan/tilt head (but see sub-spaces re: AX-S1...)
00601   namespace Calliope5 {
00602     using namespace CommonCalliopeInfo::WithHead;
00603     
00604     const unsigned JointsPerArm   =  7; //!< 5 arms joints plus two fingers
00605     const unsigned NumArms        =  1;
00606     const unsigned NumArmJoints   =  JointsPerArm*NumArms;
00607     const unsigned NumPIDJoints   = NumWheels + NumHeadJoints + NumArmJoints; //!< number of motors and servos
00608     const unsigned NumOutputs     = NumPIDJoints + NumLEDs + 1 /*Create mode*/; //!< the total number of outputs
00609 
00610     const unsigned ArmOffset = HeadOffset+NumHeadJoints;
00611     const unsigned LEDOffset   = ArmOffset+NumArmJoints;
00612     const unsigned ModeOffset = LEDOffset + NumLEDs;
00613     
00614     const unsigned BaseFrameOffset   = NumOutputs; //!< Use with kinematics to refer to base reference frame
00615     const unsigned GripperFrameOffset = BaseFrameOffset + 1; //!< Use with kinematics to refer to gripper reference frame
00616     const unsigned LeftFingerFrameOffset = GripperFrameOffset+1; //!< Use with kinematics to refer to the left finger reference frame
00617     const unsigned RightFingerFrameOffset = LeftFingerFrameOffset+1; //!< Use with kinematics to refer to the right finger reference frame
00618     const unsigned CameraFrameOffset = RightFingerFrameOffset+NumArms; //!< Use with kinematics to refer to camera reference frame
00619 
00620     //! These are 'absolute' offsets for the arm joints, don't need to add to ArmOffset like TPROffset_t values do
00621     enum ArmOffset_t {
00622       ArmBaseOffset=ArmOffset,
00623       ArmShoulderOffset,
00624       ArmElbowOffset,
00625       ArmWristOffset,
00626       WristRotateOffset,
00627       LeftFingerOffset,
00628       RightFingerOffset
00629     };
00630     
00631     namespace WithoutAXS1Sensors {
00632       using namespace Calliope5;
00633       using namespace CommonCalliopeInfo::WithoutAXS1Sensors;
00634     }
00635     namespace WithAXS1Sensors {
00636       using namespace Calliope5;
00637       using namespace CommonCalliopeInfo::WithAXS1Sensors;
00638       const unsigned LeftIRFrameOffset = CameraFrameOffset+1; //!< Use with kinematics to refer to left IR distance rangefinder reference frame
00639       const unsigned CenterIRFrameOffset = LeftIRFrameOffset+1; //!< Use with kinematics to refer to center IR distance rangefinder reference frame
00640       const unsigned IRFrameOffset = CenterIRFrameOffset; //!< alias for CenterIRFrameOffset
00641       const unsigned RightIRFrameOffset = CenterIRFrameOffset+1; //!< Use with kinematics to refer to right IR distance rangefinder reference frame
00642     }
00643 
00644     //! The offsets of the individual LEDs
00645     /*! @hideinitializer */
00646     enum LEDOffset_t {
00647       PowerRedLEDOffset=LEDOffset,
00648       PowerGreenLEDOffset,
00649       PlayLEDOffset,
00650       AdvanceLEDOffset
00651     };
00652     
00653     const LEDOffset_t RedLEDOffset = PowerRedLEDOffset;
00654     const LEDOffset_t BlueLEDOffset = AdvanceLEDOffset; //!< Create has no blue LED: use Advance LED here, and Advance+PowerRED in BlueLEDMask
00655     const LEDOffset_t GreenLEDOffset = PlayLEDOffset;
00656     const LEDOffset_t YellowLEDOffset = AdvanceLEDOffset;
00657     
00658     typedef unsigned int LEDBitMask_t; //!< So you can be clear when you're refering to a LED bitmask
00659     
00660     const LEDBitMask_t BlueLEDMask = (1<<(AdvanceLEDOffset-LEDOffset)) |
00661     (1<<(PowerRedLEDOffset-LEDOffset)); //!< Create has no blue LED, so use Advance (green) + Power (red)
00662     const LEDBitMask_t GreenLEDMask = 1<<(GreenLEDOffset-LEDOffset); //!< mask corresponding to GreenLEDOffset
00663     const LEDBitMask_t YellowLEDMask = 1<<(YellowLEDOffset-LEDOffset); //!< mask corresponding to YellowLEDOffset
00664     const LEDBitMask_t RedLEDMask = 1<<(RedLEDOffset-LEDOffset); //!< mask corresponding to RedLEDOffset
00665     
00666     const LEDBitMask_t PowerRedLEDMask = 1<<(PowerRedLEDOffset-LEDOffset); //!< mask corresponding to BlueLEDOffset
00667     const LEDBitMask_t PowerGreenLEDMask = 1<<(PowerGreenLEDOffset-LEDOffset); //!< mask corresponding to GreenLEDOffset
00668     const LEDBitMask_t PlayLEDMask = 1<<(PlayLEDOffset-LEDOffset); //!< mask corresponding to YellowLEDOffset
00669     const LEDBitMask_t AdvanceLEDMask = 1<<(AdvanceLEDOffset-LEDOffset); //!< mask corresponding to RedLEDOffset
00670     
00671     //! LEDs for the face panel (all FaceLEDPanelMask<<(0:NumFacePanelLEDs-1) entries)
00672     const LEDBitMask_t FaceLEDMask = 0;
00673     //! selects all of the leds
00674     const LEDBitMask_t AllLEDMask  = (LEDBitMask_t)~0;
00675     //@}
00676     //! This table holds the default PID values for each joint.  see PIDMC
00677     const float DefaultPIDs[NumPIDJoints][3] = {
00678       {1,0,0},
00679       {1,0,0},
00680       {1,0,0},
00681       {1,0,0},
00682       {1,0,0},
00683       {1,0,0},
00684       {1,0,0},
00685       {1,0,0},
00686       {1,0,0},
00687       {1,0,0},
00688       {1,0,0}
00689     };
00690     
00691     //!These values are our recommended maximum joint velocities, in rad/ms
00692     const float MaxOutputSpeed[NumOutputs] = {
00693       0, 0,   // wheels
00694       0, 0,   // head
00695       0, 0, 0, 0, 0, 0, 0, // arm
00696       0,
00697       0,
00698       0,
00699       0,
00700       0
00701     };
00702     
00703     //! 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)
00704     const float outputRanges[NumOutputs][2] =
00705     {
00706       { -500 , 500 }, // left wheel
00707       { -500 , 500 }, // right wheel
00708       {RAD(-150),RAD(150)}, // neck pan
00709       {RAD(-92),RAD(75)}, // neck tilt
00710       {RAD(-150),RAD(150)}, // arm base
00711       {RAD(-150),RAD(150)}, // arm shoulder
00712       {RAD(-150),RAD(150)}, // arm elbow
00713       {RAD(-150),RAD(150)}, // arm wrist
00714       {RAD(-150),RAD(150)}, // arm wristrot
00715       {RAD(-70),RAD(44)}, // arm left finger
00716       {RAD(-25),RAD(70)}, // arm right finger
00717       {  0 , 1 },
00718       {  0 , 1 },
00719       {  0 , 1 },
00720       {  0 , 1 },
00721       { MODE_PASSIVE, MODE_SAFE }
00722     };
00723     
00724   }
00725   
00726 }
00727 
00728 #endif

Tekkotsu v5.1CVS
Generated Fri Mar 16 05:26:35 2012 by Doxygen 1.6.3