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