00001
00002 #ifndef INCLUDED_Chiara2Info_h
00003 #define INCLUDED_Chiara2Info_h
00004
00005 #include <cmath>
00006 #include <stdlib.h>
00007 #include "CommonInfo.h"
00008 using namespace RobotInfo;
00009
00010
00011 #if defined(TGT_CHIARA2)
00012 # define TGT_IS_BIOLOID
00013 # define TGT_IS_CHIARA
00014 # define TGT_IS_CHIARA2
00015 # define TGT_HAS_CAMERA 1
00016 # define TGT_HAS_LEDS 7
00017 # define TGT_HAS_BUTTONS 3
00018 # define TGT_HAS_LEGS 6
00019 # define TGT_HAS_SEK_LEGS 6
00020 # define TGT_HAS_ARMS 1
00021 # define TGT_HAS_HEAD 1
00022 # define TGT_HAS_POWER_STATUS
00023 # define TGT_HAS_IR_DISTANCE 3
00024 #endif
00025
00026
00027 namespace Chiara2Info {
00028
00029
00030
00031
00032
00033 extern const char* const TargetName;
00034
00035 const unsigned int FrameTime=32;
00036 const unsigned int NumFrames=1;
00037 const unsigned int SoundBufferTime=32;
00038
00039
00040 const unsigned NumWheels = 0;
00041
00042 const unsigned JointsPerArm = 6;
00043 const unsigned NumArms = 1;
00044 const unsigned NumArmJoints = JointsPerArm*NumArms;
00045
00046 const unsigned JointsPerLeg = 3;
00047 const unsigned NumLegs = 6;
00048 const unsigned NumLegJoints = JointsPerLeg*NumLegs;
00049 const unsigned NumHeadJoints = 2;
00050 const unsigned NumTailJoints = 0;
00051 const unsigned NumMouthJoints = 0;
00052 const unsigned NumEarJoints = 0;
00053 const unsigned NumButtons = 3;
00054 const unsigned NumSensors = 11;
00055 const unsigned NumFacePanelLEDs = 0;
00056
00057 const unsigned NumLEDs = NumLegs + 1;
00058 const unsigned NumPIDJoints = NumArmJoints + 1 + NumLegJoints + NumHeadJoints+NumTailJoints+NumMouthJoints;;
00059
00060 const unsigned NumOutputs = NumWheels + NumPIDJoints + NumLEDs;
00061 const unsigned NumReferenceFrames = NumOutputs + 1 + NumLegs + NumArms + 1 + 3;
00062
00063 using namespace Camera75DOF;
00064
00065 const float BallOfFootRadius=0;
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 const unsigned PIDJointOffset = 0;
00078 const unsigned RFrRotatorOffset = PIDJointOffset;
00079 const unsigned LegOffset = RFrRotatorOffset+1;
00080 const unsigned ArmOffset = LegOffset+NumLegJoints;
00081 const unsigned HeadOffset = ArmOffset+NumArmJoints;
00082
00083 const unsigned LEDOffset = PIDJointOffset + NumPIDJoints;
00084
00085 const unsigned BaseFrameOffset = NumOutputs;
00086 const unsigned FootFrameOffset = BaseFrameOffset+1;
00087 const unsigned GripperFrameOffset = FootFrameOffset+NumLegs;
00088 const unsigned CameraFrameOffset = GripperFrameOffset+NumArms;
00089
00090 const unsigned LeftIRFrameOffset = CameraFrameOffset+1;
00091 const unsigned CenterIRFrameOffset = LeftIRFrameOffset+1;
00092 const unsigned IRFrameOffset = CenterIRFrameOffset;
00093 const unsigned RightIRFrameOffset = CenterIRFrameOffset+1;
00094
00095
00096 enum LegOrder_t {
00097 RFrLegOrder = 0,
00098 LFrLegOrder,
00099 RMdLegOrder,
00100 LMdLegOrder,
00101 RBkLegOrder,
00102 LBkLegOrder
00103 };
00104
00105
00106 enum SEKOffset_t {
00107 SweepOffset=0,
00108 ElevatorOffset,
00109 KneeOffset
00110 };
00111
00112
00113 enum TPROffset_t {
00114 PanOffset=0,
00115 TiltOffset,
00116 NodOffset = TiltOffset,
00117 RollOffset
00118 };
00119
00120
00121
00122 enum LegOffset_t {
00123 RFrLegOffset = LegOffset+RFrLegOrder*JointsPerLeg,
00124 LFrLegOffset = LegOffset+LFrLegOrder*JointsPerLeg,
00125 RMdLegOffset = LegOffset+RMdLegOrder*JointsPerLeg,
00126 LMdLegOffset = LegOffset+LMdLegOrder*JointsPerLeg,
00127 RBkLegOffset = LegOffset+RBkLegOrder*JointsPerLeg,
00128 LBkLegOffset = LegOffset+LBkLegOrder*JointsPerLeg,
00129 };
00130
00131
00132 enum ArmOffset_t {
00133 ArmShoulderOffset=ArmOffset,
00134 ArmElbowOffset,
00135 WristOffset,
00136 WristYawOffset = WristOffset,
00137 WristPitchOffset,
00138 GripperLeftOffset,
00139 GripperRightOffset,
00140 GripperOffset
00141 };
00142
00143
00144 enum HeadOffset_t {
00145 HeadPanOffset = HeadOffset,
00146 HeadTiltOffset,
00147 };
00148
00149
00150
00151 enum LEDOffset_t {
00152 RFrKneeLEDOffset = LEDOffset,
00153 LFrKneeLEDOffset,
00154 RMdKneeLEDOffset,
00155 LMdKneeLEDOffset,
00156 RBkKneeLEDOffset,
00157 LBkKneeLEDOffset,
00158 HeadLEDOffset
00159 };
00160
00161 typedef unsigned int LEDBitMask_t;
00162
00163 const LEDBitMask_t RFrKneeLEDMask = 1<<(RFrKneeLEDOffset-LEDOffset);
00164 const LEDBitMask_t LFrKneeLEDMask = 1<<(LFrKneeLEDOffset-LEDOffset);
00165 const LEDBitMask_t RMdKneeLEDMask = 1<<(RMdKneeLEDOffset-LEDOffset);
00166 const LEDBitMask_t LMdKneeLEDMask = 1<<(LMdKneeLEDOffset-LEDOffset);
00167 const LEDBitMask_t RBkKneeLEDMask = 1<<(RBkKneeLEDOffset-LEDOffset);
00168 const LEDBitMask_t LBkKneeLEDMask = 1<<(LBkKneeLEDOffset-LEDOffset);
00169 const LEDBitMask_t HeadLEDMask = 1<<(HeadLEDOffset-LEDOffset);
00170
00171
00172 const LEDBitMask_t FaceLEDMask = HeadLEDMask;
00173
00174 const LEDBitMask_t AllLEDMask = (LEDBitMask_t)~0;
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196 enum ButtonOffset_t { GreenButOffset, RedButOffset, YellowButOffset };
00197
00198
00199 const char* const buttonNames[NumButtons+1] = { "GreenBut", "RedBut", "YellowBut", NULL };
00200
00201
00202
00203 enum SensorOffset_t {
00204 LeftIRDistOffset,
00205 CenterIRDistOffset,
00206 IRDistOffset = CenterIRDistOffset,
00207 RightIRDistOffset,
00208 LeftLuminosityOffset,
00209 CenterLuminosityOffset,
00210 RightLuminosityOffset,
00211 MicVolumeOffset,
00212 MicSpikeCountOffset,
00213 PowerRemainOffset,
00214 PowerThermoOffset,
00215 PowerVoltageOffset,
00216 };
00217
00218
00219 const char* const sensorNames[NumSensors+1] = {
00220 "LeftIRDist", "CenterIRDist", "RightIRDist",
00221 "LeftLuminosity", "CenterLuminosity", "RightLuminosity",
00222 "MicVolume", "MicSpikeCount",
00223 "PowerRemain", "PowerThermo", "PowerVoltage", NULL
00224 };
00225
00226
00227
00228
00229
00230 const char* const outputNames[NumReferenceFrames+1] = {
00231
00232 "RFr:rotor",
00233 "RFr:sweep","RFr:elvtr","RFr:knee",
00234 "LFr:sweep","LFr:elvtr","LFr:knee",
00235 "RMd:sweep","RMd:elvtr","RMd:knee",
00236 "LMd:sweep","LMd:elvtr","LMd:knee",
00237 "RBk:sweep","RBk:elvtr","RBk:knee",
00238 "LBk:sweep","LBk:elvtr","LBk:knee",
00239 "ARM:shldr","ARM:elbow","ARM:wristYaw","ARM:wristPitch","ARM:gripperLeft","ARM:gripperRight",
00240 "NECK:pan","NECK:tilt",
00241
00242
00243
00244 "LED:RFr:knee","LED:LFr:knee",
00245 "LED:RMd:knee","LED:LMd:knee",
00246 "LED:RBk:knee","LED:LBk:knee",
00247 "LED:NECK:pan",
00248
00249
00250 "BaseFrame",
00251 "RFrFootFrame",
00252 "LFrFootFrame",
00253 "RMdFootFrame",
00254 "LMdFootFrame",
00255 "RBkFootFrame",
00256 "LBkFootFrame",
00257 "GripperFrame",
00258 "CameraFrame",
00259 "LeftIRFrame",
00260 "CenterIRFrame",
00261 "RightIRFrame",
00262 NULL
00263 };
00264
00265
00266 class ChiaraCapabilities : public Capabilities {
00267 public:
00268
00269 ChiaraCapabilities()
00270 : Capabilities(TargetName,NumReferenceFrames,outputNames,NumButtons,buttonNames,NumSensors,sensorNames,PIDJointOffset,NumPIDJoints,LEDOffset,NumLEDs,NumOutputs)
00271 {
00272 frameToIndex["ARM:Wrist"] = WristYawOffset;
00273 frameToIndex["NECK:nod"] = HeadTiltOffset;
00274 frameToIndex["IRFrame"] = IRFrameOffset;
00275 sensorToIndex["IRDist"]=IRDistOffset;
00276 }
00277 };
00278
00279 extern const ChiaraCapabilities capabilities;
00280
00281
00282
00283 enum ServoParam_t {
00284 DYNAMIXEL_SLOPE=0,
00285 DYNAMIXEL_PUNCH,
00286 DYNAMIXEL_MARGIN
00287 };
00288
00289
00290
00291
00292 const float DefaultPIDs[NumPIDJoints][3] = {
00293 {32,32,0},
00294 {32,32,0}, {32,32,0}, {32,32,0},
00295 {32,32,0}, {32,32,0}, {32,32,0},
00296 {32,32,0}, {32,32,0}, {32,32,0},
00297 {32,32,0}, {32,32,0}, {32,32,0},
00298 {32,32,0}, {32,32,0}, {32,32,0},
00299 {32,32,0}, {32,32,0}, {32,32,0},
00300 {32,32,0}, {32,32,0}, {32,32,0}, {32,32,0}, {32,32,0}, {32,32,0},
00301 {32,32,0}, {32,32,0},
00302 };
00303
00304
00305
00306
00307
00308
00309
00310
00311 const float MaxOutputSpeed[NumOutputs] = {
00312
00313 0,
00314 0,0,0,
00315 0,0,0,
00316 0,0,0,
00317 0,0,0,
00318 0,0,0,
00319 0,0,0,
00320 0,0,0,0,0,0,
00321 0,0,
00322
00323 0,0,
00324 0,0,
00325 0,0,
00326 0,
00327 };
00328
00329 #ifndef RAD
00330
00331 #define RAD(deg) (((deg) * (float)M_PI ) / 180.0f)
00332
00333 #define __RI_RAD_FLAG
00334 #endif
00335
00336
00337 const float outputRanges[NumOutputs][2] = {
00338
00339 {RAD(-17),RAD(90)},
00340 {RAD(-102),RAD(67)}, {RAD(-100),RAD(100)}, {RAD(-55),RAD(160)},
00341 {RAD(-53),RAD(58)}, {RAD(-100),RAD(100)}, {RAD(-55),RAD(160)},
00342 {RAD(-53),RAD(53)}, {RAD(-100),RAD(100)}, {RAD(-55),RAD(160)},
00343 {RAD(-53),RAD(53)}, {RAD(-100),RAD(100)}, {RAD(-55),RAD(160)},
00344 {RAD(-53),RAD(53)}, {RAD(-100),RAD(100)}, {RAD(-55),RAD(160)},
00345 {RAD(-73),RAD(53)}, {RAD(-100),RAD(100)}, {RAD(-55),RAD(160)},
00346 {RAD(-95),RAD(95)}, {RAD(-95),RAD(95)}, {RAD(-100),RAD(100)}, {RAD(-90),RAD(90)}, {RAD(-90),RAD(90)}, {RAD(-90),RAD(90)},
00347 {RAD(-150),RAD(150)}, {RAD(-92),RAD(75)},
00348
00349
00350 {0,1}, {0,1},
00351 {0,1}, {0,1},
00352 {0,1}, {0,1},
00353 {0,1},
00354 };
00355
00356
00357
00358 const float mechanicalLimits[NumOutputs][2] = {
00359
00360 {RAD(-17),RAD(90)},
00361 {RAD(-102),RAD(67)}, {RAD(-100),RAD(100)}, {RAD(-55),RAD(160)},
00362 {RAD(-53),RAD(58)}, {RAD(-100),RAD(100)}, {RAD(-55),RAD(160)},
00363 {RAD(-53),RAD(53)}, {RAD(-100),RAD(100)}, {RAD(-55),RAD(160)},
00364 {RAD(-53),RAD(53)}, {RAD(-100),RAD(100)}, {RAD(-55),RAD(160)},
00365 {RAD(-53),RAD(53)}, {RAD(-100),RAD(100)}, {RAD(-55),RAD(160)},
00366 {RAD(-73),RAD(53)}, {RAD(-100),RAD(100)}, {RAD(-55),RAD(160)},
00367 {RAD(-95),RAD(95)}, {RAD(-95),RAD(95)}, {RAD(-100),RAD(100)}, {RAD(-90),RAD(90)}, {RAD(-90),RAD(90)}, {RAD(-90),RAD(90)},
00368 {RAD(-150),RAD(150)}, {RAD(-92),RAD(75)},
00369
00370
00371 {0,1}, {0,1},
00372 {0,1}, {0,1},
00373 {0,1}, {0,1},
00374 {0,1},
00375 };
00376
00377 #ifdef __RI_RAD_FLAG
00378 #undef RAD
00379 #undef __RI_RAD_FLAG
00380 #endif
00381 }
00382
00383
00384
00385
00386
00387
00388 #endif