00001
00002
00003
00004
00005 #ifndef INCLUDED_ERS220Info_h
00006 #define INCLUDED_ERS220Info_h
00007
00008 #include <math.h>
00009 #ifndef PLATFORM_APERIOS
00010 typedef unsigned short word;
00011 #else
00012 #include <Types.h>
00013 #endif
00014
00015 #include "CommonInfo.h"
00016 using namespace RobotInfo;
00017
00018 #if TGT_ERS2xx
00019 #include "ERS2xxInfo.h"
00020 #endif
00021
00022
00023 namespace ERS220Info {
00024
00025 #if TGT_ERS2xx
00026 using namespace ERS2xxInfo;
00027 #else
00028
00029
00030
00031
00032 const char* const RobotName="ERS-220";
00033
00034 const unsigned int FrameTime=8;
00035 const unsigned int NumFrames=4;
00036 const unsigned int SlowFrameTime=128;
00037 const unsigned int NumSlowFrames=1;
00038 const unsigned int SoundBufferTime=32;
00039
00040
00041
00042
00043 const unsigned JointsPerLeg = 3;
00044 const unsigned NumLegs = 4;
00045 const unsigned NumLegJoints = JointsPerLeg*NumLegs;
00046 const unsigned NumHeadJoints = 3;
00047 const unsigned NumTailJoints = 0;
00048 const unsigned NumMouthJoints = 0;
00049 const unsigned NumEarJoints = 0;
00050 const unsigned NumButtons = 11;
00051 const unsigned NumSensors = 1+3+1+5;
00052 const unsigned NumLEDs = 20;
00053
00054 const unsigned NumPIDJoints = NumLegJoints+NumHeadJoints+NumTailJoints+NumMouthJoints;
00055 const unsigned NumBinJoints = NumEarJoints;
00056 const unsigned NumOutputs = NumPIDJoints + NumBinJoints + NumLEDs;
00057 const unsigned NumReferenceFrames = NumOutputs + 1 + NumLegs + 1 + 1;
00058
00059 const float CameraHorizFOV=57.6/180*M_PI;
00060 const float CameraVertFOV=47.8/180*M_PI;
00061 const float CameraFOV=CameraHorizFOV;
00062 const unsigned int CameraResolutionX=176;
00063 const unsigned int CameraResolutionY=144;
00064 const float BallOfFootRadius=27.922/2;
00065 const float CylinderOfFootRadius=24.606/2;
00066
00067
00068 const bool IsFastOutput[NumOutputs] = {
00069
00070 true, true, true,
00071 true, true, true,
00072 true, true, true,
00073 true, true, true,
00074 true, true, true,
00075
00076 true, true, true,
00077 true, true, true,
00078 true,
00079 true, true, true,
00080 true, true, true,
00081 true, true, true,
00082 true, true, true,
00083 true,
00084
00085 };
00086
00087
00088 const bool IsRealERS220[NumOutputs] = {
00089
00090 true, true, true,
00091 true, true, true,
00092 true, true, true,
00093 true, true, true,
00094 true, true, true,
00095
00096 true, true, true,
00097 true, true, true,
00098 true,
00099 true, true, true,
00100 true, true, true,
00101 true, true, true,
00102 true, true, true,
00103 true,
00104
00105 };
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115 const unsigned PIDJointOffset = 0;
00116 const unsigned LegOffset = PIDJointOffset;
00117 const unsigned HeadOffset = LegOffset+NumLegJoints;
00118
00119 const unsigned LEDOffset = PIDJointOffset + NumPIDJoints;
00120
00121 const unsigned BinJointOffset = NumOutputs;
00122
00123 const unsigned BaseFrameOffset = NumOutputs;
00124 const unsigned PawFrameOffset = BaseFrameOffset+1;
00125 const unsigned CameraFrameOffset = PawFrameOffset+NumLegs;
00126 const unsigned IRFrameOffset = CameraFrameOffset+1;
00127
00128
00129 enum LegOffset_t {
00130 LFrLegOffset = LegOffset+LFrLegOrder*JointsPerLeg,
00131 RFrLegOffset = LegOffset+RFrLegOrder*JointsPerLeg,
00132 LBkLegOffset = LegOffset+LBkLegOrder*JointsPerLeg,
00133 RBkLegOffset = LegOffset+RBkLegOrder*JointsPerLeg
00134 };
00135
00136
00137
00138
00139 enum LEDOffset_t {
00140 FaceFrontLeftLEDOffset = LEDOffset,
00141 FaceFrontRightLEDOffset,
00142 FaceCenterLeftLEDOffset,
00143 FaceCenterRightLEDOffset,
00144 FaceBackLeftLEDOffset,
00145 FaceBackRightLEDOffset,
00146 ModeLEDOffset,
00147 BackLeft1LEDOffset,
00148 BackLeft2LEDOffset,
00149 BackLeft3LEDOffset,
00150 BackRight3LEDOffset,
00151 BackRight2LEDOffset,
00152 BackRight1LEDOffset,
00153 TailLeftLEDOffset,
00154 TailCenterLEDOffset,
00155 TailRightLEDOffset,
00156 FaceFrontBLEDOffset,
00157 FaceFrontALEDOffset,
00158 FaceFrontCLEDOffset,
00159 RetractableHeadLEDOffset,
00160
00161
00162 BotLLEDOffset = FaceFrontLeftLEDOffset,
00163 BotRLEDOffset = FaceFrontRightLEDOffset,
00164 MidLLEDOffset = FaceCenterLeftLEDOffset,
00165 MidRLEDOffset = FaceCenterRightLEDOffset,
00166 TopLLEDOffset = FaceBackLeftLEDOffset,
00167 TopRLEDOffset = FaceBackRightLEDOffset,
00168 TopBrLEDOffset = ModeLEDOffset,
00169 TlBluLEDOffset = TailLeftLEDOffset,
00170 TlRedLEDOffset = TailRightLEDOffset,
00171 };
00172
00173
00174
00175 typedef unsigned int LEDBitMask_t;
00176 const LEDBitMask_t FaceFrontLeftLEDMask = 1<<(FaceFrontLeftLEDOffset-LEDOffset);
00177 const LEDBitMask_t FaceFrontRightLEDMask = 1<<(FaceFrontRightLEDOffset-LEDOffset);
00178 const LEDBitMask_t FaceCenterLeftLEDMask = 1<<(FaceCenterLeftLEDOffset-LEDOffset);
00179 const LEDBitMask_t FaceCenterRightLEDMask = 1<<(FaceCenterRightLEDOffset-LEDOffset);
00180 const LEDBitMask_t FaceBackLeftLEDMask = 1<<(FaceBackLeftLEDOffset-LEDOffset);
00181 const LEDBitMask_t FaceBackRightLEDMask = 1<<(FaceBackRightLEDOffset-LEDOffset);
00182 const LEDBitMask_t ModeLEDMask = 1<<(ModeLEDOffset-LEDOffset);
00183 const LEDBitMask_t BackLeft1LEDMask = 1<<(BackLeft1LEDOffset-LEDOffset);
00184 const LEDBitMask_t BackLeft2LEDMask = 1<<(BackLeft2LEDOffset-LEDOffset);
00185 const LEDBitMask_t BackLeft3LEDMask = 1<<(BackLeft3LEDOffset-LEDOffset);
00186 const LEDBitMask_t BackRight3LEDMask = 1<<(BackRight3LEDOffset-LEDOffset);
00187 const LEDBitMask_t BackRight2LEDMask = 1<<(BackRight2LEDOffset-LEDOffset);
00188 const LEDBitMask_t BackRight1LEDMask = 1<<(BackRight1LEDOffset-LEDOffset);
00189 const LEDBitMask_t TailLeftLEDMask = 1<<(TailLeftLEDOffset-LEDOffset);
00190 const LEDBitMask_t TailCenterLEDMask = 1<<(TailCenterLEDOffset-LEDOffset);
00191 const LEDBitMask_t TailRightLEDMask = 1<<(TailRightLEDOffset-LEDOffset);
00192 const LEDBitMask_t FaceFrontBLEDMask = 1<<(FaceFrontBLEDOffset-LEDOffset);
00193 const LEDBitMask_t FaceFrontALEDMask = 1<<(FaceFrontALEDOffset-LEDOffset);
00194 const LEDBitMask_t FaceFrontCLEDMask = 1<<(FaceFrontCLEDOffset-LEDOffset);
00195 const LEDBitMask_t RetractableHeadLEDMask = 1<<(RetractableHeadLEDOffset-LEDOffset);
00196
00197
00198 const LEDBitMask_t BotLLEDMask = 1<<(BotLLEDOffset-LEDOffset);
00199 const LEDBitMask_t BotRLEDMask = 1<<(BotRLEDOffset-LEDOffset);
00200 const LEDBitMask_t MidLLEDMask = 1<<(MidLLEDOffset-LEDOffset);
00201 const LEDBitMask_t MidRLEDMask = 1<<(MidRLEDOffset-LEDOffset);
00202 const LEDBitMask_t TopLLEDMask = 1<<(TopLLEDOffset-LEDOffset);
00203 const LEDBitMask_t TopRLEDMask = 1<<(TopRLEDOffset-LEDOffset);
00204 const LEDBitMask_t TopBrLEDMask= 1<<(TopBrLEDOffset-LEDOffset);
00205 const LEDBitMask_t TlRedLEDMask= 1<<(TlRedLEDOffset-LEDOffset);
00206 const LEDBitMask_t TlBluLEDMask= 1<<(TlBluLEDOffset-LEDOffset);
00207
00208
00209 const LEDBitMask_t FaceLEDMask
00210 = FaceFrontLeftLEDMask
00211 | FaceFrontRightLEDMask
00212 | FaceCenterLeftLEDMask
00213 | FaceCenterRightLEDMask
00214 | FaceBackLeftLEDMask
00215 | FaceBackRightLEDMask
00216 | FaceFrontALEDMask
00217 | FaceFrontBLEDMask
00218 | FaceFrontCLEDMask
00219 | ModeLEDMask;
00220
00221
00222 const LEDBitMask_t HeadLEDMask
00223 = FaceLEDMask | RetractableHeadLEDMask;
00224
00225
00226 const LEDBitMask_t BackLEDMask
00227 = BackLeft1LEDMask
00228 | BackLeft2LEDMask
00229 | BackLeft3LEDMask
00230 | BackRight1LEDMask
00231 | BackRight2LEDMask
00232 | BackRight3LEDMask;
00233
00234
00235 const LEDBitMask_t TailLEDMask
00236 = TailLeftLEDMask
00237 | TailCenterLEDMask
00238 | TailRightLEDMask;
00239
00240
00241 const LEDBitMask_t AllLEDMask = (LEDBitMask_t)~0;
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262 enum ButtonOffset_t {
00263 LFrPawOffset = LFrLegOrder,
00264 RFrPawOffset = RFrLegOrder,
00265 LBkPawOffset = LBkLegOrder,
00266 RBkPawOffset = RBkLegOrder,
00267 ChinButOffset= 4,
00268 BackButOffset,
00269 HeadFrButOffset,
00270 HeadButOffset=HeadFrButOffset,
00271 HeadBkButOffset,
00272 TailLeftButOffset,
00273 TailCenterButOffset,
00274 TailRightButOffset,
00275 };
00276
00277
00278 const char* const buttonNames[NumButtons] = {
00279 "LFrPaw","RFrPaw","LBkPaw","RBkPaw",
00280 "ChinBut","BackBut","HeadFrBut","HeadBkBut",
00281 "TailLeftBut","TailCenterBut","TailRightBut"
00282 };
00283
00284
00285
00286 enum SensorOffset_t {
00287 IRDistOffset = 0,
00288 BAccelOffset,
00289 LAccelOffset,
00290 DAccelOffset,
00291 ThermoOffset,
00292 PowerRemainOffset,
00293 PowerThermoOffset,
00294 PowerCapacityOffset,
00295 PowerVoltageOffset,
00296 PowerCurrentOffset
00297 };
00298
00299
00300 const char* const sensorNames[NumSensors] = {
00301 "IRDist",
00302 "BAccel","LAccel","DAccel",
00303 "Thermo",
00304 "PowerRemain","PowerThermo","PowerCapacity","PowerVoltage","PowerCurrent"
00305 };
00306
00307
00308
00309
00310
00311 const unsigned outputNameLen = 9;
00312
00313 const char* const outputNames[NumOutputs] = {
00314 "LFr:rotor",
00315 "LFr:elvtr",
00316 "LFr:knee~",
00317 "RFr:rotor",
00318 "RFr:elvtr",
00319 "RFr:knee~",
00320 "LBk:rotor",
00321 "LBk:elvtr",
00322 "LBk:knee~",
00323 "RBk:rotor",
00324 "RBk:elvtr",
00325 "RBk:knee~",
00326
00327 "NECK:tilt",
00328 "NECK:pan~",
00329 "NECK:roll",
00330
00331 "LED:botL~",
00332 "LED:botR~",
00333 "LED:midL~",
00334 "LED:midR~",
00335 "LED:topL~",
00336 "LED:topR~",
00337 "LED:topBr",
00338
00339 "LED:bkL1~",
00340 "LED:bkL2~",
00341 "LED:bkL3~",
00342 "LED:bkR3~",
00343 "LED:bkR2~",
00344 "LED:bkR1~",
00345 "LED:tailL",
00346 "LED:tailC",
00347 "LED:tailR",
00348 "LED:faceB",
00349 "LED:faceA",
00350 "LED:faceC",
00351 "LED:light",
00352 };
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365 const char* const PrimitiveName [NumOutputs] = {
00366 "PRM:/r2/c1-Joint2:j1",
00367 "PRM:/r2/c1/c2-Joint2:j2",
00368 "PRM:/r2/c1/c2/c3-Joint2:j3",
00369 "PRM:/r4/c1-Joint2:j1",
00370 "PRM:/r4/c1/c2-Joint2:j2",
00371 "PRM:/r4/c1/c2/c3-Joint2:j3",
00372
00373 "PRM:/r3/c1-Joint2:j1",
00374 "PRM:/r3/c1/c2-Joint2:j2",
00375 "PRM:/r3/c1/c2/c3-Joint2:j3",
00376 "PRM:/r5/c1-Joint2:j1",
00377 "PRM:/r5/c1/c2-Joint2:j2",
00378 "PRM:/r5/c1/c2/c3-Joint2:j3",
00379
00380 "PRM:/r1/c1-Joint2:j1",
00381 "PRM:/r1/c1/c2-Joint2:j2",
00382 "PRM:/r1/c1/c2/c3-Joint2:j3",
00383
00384 "PRM:/r1/c1/c2/c3/l1-LED2:l1",
00385 "PRM:/r1/c1/c2/c3/l4-LED2:l4",
00386 "PRM:/r1/c1/c2/c3/l2-LED2:l2",
00387 "PRM:/r1/c1/c2/c3/l5-LED2:l5",
00388 "PRM:/r1/c1/c2/c3/l3-LED2:l3",
00389 "PRM:/r1/c1/c2/c3/l6-LED2:l6",
00390 "PRM:/r1/c1/c2/c3/l7-LED2:l7",
00391
00392 "PRM:/r6/l1-LED2:l1",
00393 "PRM:/r6/l2-LED2:l2",
00394 "PRM:/r6/l3-LED2:l3",
00395 "PRM:/r6/l4-LED2:l4",
00396 "PRM:/r6/l5-LED2:l5",
00397 "PRM:/r6/l6-LED2:l6",
00398
00399 "PRM:/r6/l9-LED2:l9",
00400 "PRM:/r6/l7-LED2:l7",
00401 "PRM:/r6/l8-LED2:l8",
00402
00403 "PRM:/r1/c1/c2/c3/l8-LED2:l8",
00404 "PRM:/r1/c1/c2/c3/l9-LED2:l9",
00405 "PRM:/r1/c1/c2/c3/la-LED2:la",
00406 "PRM:/r1/c1/c2/c3/lb-LED2:lb",
00407 };
00408
00409
00410 const char* const SpeakerLocator="PRM:/r1/c1/c2/c3/s1-Speaker:S1";
00411
00412
00413 const char* const CameraLocator="PRM:/r1/c1/c2/c3/i1-FbkImageSensor:F1";
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441 const float DefaultPIDs[NumPIDJoints][3] =
00442 {
00443 { 0x16/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x08/(double)(1<<(16-0xF)) },
00444 { 0x14/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x06/(double)(1<<(16-0xF)) },
00445 { 0x23/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x05/(double)(1<<(16-0xF)) },
00446 { 0x16/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x08/(double)(1<<(16-0xF)) },
00447 { 0x14/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x06/(double)(1<<(16-0xF)) },
00448 { 0x23/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x05/(double)(1<<(16-0xF)) },
00449 { 0x16/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x08/(double)(1<<(16-0xF)) },
00450 { 0x14/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x06/(double)(1<<(16-0xF)) },
00451 { 0x23/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x05/(double)(1<<(16-0xF)) },
00452 { 0x16/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x08/(double)(1<<(16-0xF)) },
00453 { 0x14/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x06/(double)(1<<(16-0xF)) },
00454 { 0x23/(double)(1<<(16-0xE)), 0x04/(double)(1<<(16-0x2)), 0x05/(double)(1<<(16-0xF)) },
00455
00456 { 0x0A/(double)(1<<(16-0xE)), 0x08/(double)(1<<(16-0x2)), 0x0C/(double)(1<<(16-0xF)) },
00457 { 0x0D/(double)(1<<(16-0xE)), 0x08/(double)(1<<(16-0x2)), 0x0B/(double)(1<<(16-0xF)) },
00458 { 0x0A/(double)(1<<(16-0xE)), 0x08/(double)(1<<(16-0x2)), 0x0C/(double)(1<<(16-0xF)) }
00459
00460
00461
00462
00463
00464 };
00465
00466
00467 const unsigned char DefaultPIDShifts[3] = {0x0E, 0x02, 0x0F};
00468
00469
00470
00471
00472
00473
00474 const float MaxOutputSpeed[NumOutputs] = {
00475 2.8143434e-03,
00476 2.4980025e-03,
00477 2.8361600e-03,
00478 2.8143434e-03,
00479 2.4980025e-03,
00480 2.8361600e-03,
00481 2.8143434e-03,
00482 2.4980025e-03,
00483 2.8361600e-03,
00484 2.8143434e-03,
00485 2.4980025e-03,
00486 2.8361600e-03,
00487
00488 2.1053034e-03,
00489 3.0106930e-03,
00490 3.0106930e-03,
00491
00492 0,0,0,
00493 0,0,0,
00494 0,
00495 0,0,0,
00496 0,0,0,
00497 0,0,0,
00498 0,0,0,
00499 0
00500 };
00501
00502 #ifndef RAD
00503
00504 #define RAD(deg) (((deg) * M_PI ) / 180.0)
00505
00506 #define __RI_RAD_FLAG
00507 #endif
00508
00509
00510 const double outputRanges[NumOutputs][2] =
00511 {
00512 { RAD(-117),RAD(117) },{ RAD(-11),RAD(89) },{ RAD(-27),RAD(147) },
00513 { RAD(-117),RAD(117) },{ RAD(-11),RAD(89) },{ RAD(-27),RAD(147) },
00514 { RAD(-117),RAD(117) },{ RAD(-11),RAD(89) },{ RAD(-27),RAD(147) },
00515 { RAD(-117),RAD(117) },{ RAD(-11),RAD(89) },{ RAD(-27),RAD(147) },
00516
00517 { RAD(-88.5),RAD(43) },{ RAD(-89.6),RAD(89.6) },{ RAD(-29),RAD(29) },
00518
00519 {0,1},{0,1},{0,1},
00520 {0,1},{0,1},{0,1},
00521 {0,1},
00522 {0,1},{0,1},{0,1},
00523 {0,1},{0,1},{0,1},
00524 {0,1},{0,1},{0,1},
00525 {0,1},{0,1},{0,1},
00526 {0,1}
00527 };
00528
00529
00530 const double mechanicalLimits[NumOutputs][2] =
00531 {
00532 { RAD(-120),RAD(120) },{ RAD(-14),RAD(92) },{ RAD(-30),RAD(150) },
00533 { RAD(-120),RAD(120) },{ RAD(-14),RAD(92) },{ RAD(-30),RAD(150) },
00534 { RAD(-120),RAD(120) },{ RAD(-14),RAD(92) },{ RAD(-30),RAD(150) },
00535 { RAD(-120),RAD(120) },{ RAD(-14),RAD(92) },{ RAD(-30),RAD(150) },
00536
00537 { RAD(-91.5),RAD(46) },{ RAD(-92.6),RAD(92.6) },{ RAD(-32),RAD(32) },
00538
00539 {0,1},{0,1},{0,1},
00540 {0,1},{0,1},{0,1},
00541 {0,1},
00542 {0,1},{0,1},{0,1},
00543 {0,1},{0,1},{0,1},
00544 {0,1},{0,1},{0,1},
00545 {0,1},{0,1},{0,1},
00546 {0,1}
00547 };
00548
00549 #ifdef __RI_RAD_FLAG
00550 #undef RAD
00551 #undef __RI_RAD_FLAG
00552 #endif
00553
00554 #endif //TGT_ERS2xx check
00555
00556
00557
00558 static const int CPCJointNeckTilt = 0;
00559 static const int CPCJointNeckPan = 1;
00560 static const int CPCJointNeckRoll = 2;
00561 static const int CPCSensorPSD = 3;
00562 static const int CPCSensorHeadBackPressure = 4;
00563 static const int CPCSensorHeadFrontPressure = 5;
00564 static const int CPCSensorChinSwitch = 6;
00565 static const int CPCJointLFRotator = 7;
00566 static const int CPCJointLFElevator = 8;
00567 static const int CPCJointLFKnee = 9;
00568 static const int CPCSensorLFPaw = 10;
00569 static const int CPCJointLHRotator = 11;
00570 static const int CPCJointLHElevator = 12;
00571 static const int CPCJointLHKnee = 13;
00572 static const int CPCSensorLHPaw = 14;
00573 static const int CPCJointRFRotator = 15;
00574 static const int CPCJointRFElevator = 16;
00575 static const int CPCJointRFKnee = 17;
00576 static const int CPCSensorRFPaw = 18;
00577 static const int CPCJointRHRotator = 19;
00578 static const int CPCJointRHElevator = 20;
00579 static const int CPCJointRHKnee = 21;
00580 static const int CPCSensorRHPaw = 22;
00581 static const int CPCSensorThermoSensor = 23;
00582 static const int CPCSensorBackSwitch = 24;
00583 static const int CPCSensorTailLeftSwitch = 25;
00584 static const int CPCSensorTailCenterSwitch = 26;
00585 static const int CPCSensorTailRightSwitch = 27;
00586 static const int CPCSensorAccelFB = 28;
00587 static const int CPCSensorAccelLR = 29;
00588 static const int CPCSensorAccelUD = 30;
00589
00590
00591 }
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604 #endif