00001
00002 #ifndef INCLUDED_KHR2Info_h
00003 #define INCLUDED_KHR2Info_h
00004
00005 #include <cmath>
00006 #include <stdlib.h>
00007 #include "CommonInfo.h"
00008 using namespace RobotInfo;
00009
00010
00011 #if defined(TGT_KHR2)
00012 # define TGT_IS_BIPED
00013 # define TGT_IS_HUMANOID
00014 # define TGT_IS_KHR2
00015 # define TGT_HAS_CAMERA 1
00016 # define TGT_HAS_LEGS 2
00017 # define TGT_HAS_ARMS 2
00018 # define TGT_HAS_HEAD 1
00019 #endif
00020
00021
00022 namespace KHR2Info {
00023
00024
00025
00026
00027
00028 extern const char* const TargetName;
00029
00030 const unsigned int FrameTime=32;
00031 const unsigned int NumFrames=1;
00032 const unsigned int SoundBufferTime=32;
00033
00034
00035 const unsigned NumWheels = 0;
00036
00037 const unsigned FingerJointsPerArm = 0;
00038 const unsigned JointsPerArm = 3;
00039 const unsigned NumArms = 2;
00040 const unsigned NumArmJoints = JointsPerArm*NumArms;
00041
00042 const unsigned JointsPerLeg = 5;
00043 const unsigned NumLegs = 2;
00044 const unsigned NumLegJoints = JointsPerLeg*NumLegs;
00045 const unsigned NumHeadJoints = 1;
00046 const unsigned NumTailJoints = 0;
00047 const unsigned NumMouthJoints = 0;
00048 const unsigned NumEarJoints = 0;
00049 const unsigned NumButtons = 0;
00050 const unsigned SensorsPerFoot = 6;
00051 const unsigned NumIMUAxes = 3;
00052 const unsigned NumFootSensors = SensorsPerFoot*NumLegs;
00053 const unsigned NumSensors = NumArms + NumLegs*6 + 3;
00054 const unsigned NumFacePanelLEDs = 0;
00055
00056 const unsigned NumLEDs = 0;
00057 const unsigned NumPIDJoints = NumArmJoints+NumLegJoints+NumHeadJoints;
00058
00059 const unsigned NumOutputs = NumWheels + NumPIDJoints + NumLEDs;
00060 const unsigned NumReferenceFrames = NumOutputs + NumLegs + NumArms + 1 + 1;
00061
00062 using namespace Camera75DOF;
00063
00064 const float BallOfFootRadius=23.433f / 2;
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075 const unsigned PIDJointOffset = 0;
00076
00077 const unsigned ArmOffset = PIDJointOffset;
00078 const unsigned LegOffset = ArmOffset+NumArmJoints;
00079 const unsigned HeadOffset = LegOffset+NumLegJoints;
00080 const unsigned LEDOffset = PIDJointOffset + NumPIDJoints;
00081 const unsigned BaseFrameOffset = NumOutputs;
00082 const unsigned CameraFrameOffset = BaseFrameOffset+1;
00083 const unsigned GripperFrameOffset = CameraFrameOffset+1;
00084 const unsigned FootFrameOffset = GripperFrameOffset+NumLegs;
00085
00086
00087 enum ArmOrder_t
00088 {
00089 LeftArmOrder = 0,
00090 RightArmOrder
00091 };
00092
00093
00094 enum LegOrder_t
00095 {
00096 LeftLegOrder = 0,
00097 RightLegOrder
00098 };
00099
00100 enum RLEOffset_t
00101 {
00102 ArmShoulderRotateOffset = 0,
00103 ArmShoulderOffset,
00104 ArmElbowOffset
00105 };
00106
00107
00108 enum TPROffset_t
00109 {
00110 PanOffset = 0,
00111 TiltOffset = PanOffset
00112 };
00113
00114 enum AHKALOffset_t
00115 {
00116 LegHipAbduceOffset = 0,
00117 LegHipOffset,
00118 LegKneeOffset,
00119 LegAnkleOffset,
00120 LegAnkleLateralOffset
00121 };
00122
00123 enum ArmOffset_t
00124 {
00125 LeftArmOffset = ArmOffset+LeftArmOrder*JointsPerArm,
00126 RightArmOffset = ArmOffset+RightArmOrder*JointsPerArm
00127 };
00128
00129 enum LegOffset_t
00130 {
00131 LeftLegOffset = LegOffset+LeftLegOrder*JointsPerLeg,
00132 RightLegOffset = LegOffset+RightLegOrder*JointsPerLeg
00133 };
00134
00135 enum HeadOffset_t
00136 {
00137 HeadPanOffset = HeadOffset
00138 };
00139
00140 enum LEDOffset_t {};
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160 enum ButtonOffset_t {};
00161
00162
00163 const char* const buttonNames[NumButtons+1] = {NULL};
00164
00165
00166
00167 enum SensorOffset_t
00168 {
00169 LStressOffset, RStressOffset,
00170
00171 LLToeOffset, LRToeOffset, LLSoleOffset, LRSoleOffset, LLBackOffset, LRBackOffset,
00172
00173
00174 RLToeOffset, RRToeOffset, RLSoleOffset, RRSoleOffset, RLBackOffset, RRBackOffset,
00175
00176
00177
00178
00179
00180 BAccelOffset,
00181
00182
00183
00184 LAccelOffset,
00185
00186
00187
00188 DAccelOffset
00189
00190
00191 };
00192
00193
00194 const char* const sensorNames[NumSensors + 1] = {
00195 "LStress", "RStress",
00196
00197
00198 "LLToe", "LRToe", "LLSole", "LRSole", "LLBack", "LRBack",
00199
00200
00201 "RLToe", "RRToe", "RLSole", "RRSole", "RLBack", "RRBack",
00202
00203 "BAccel", "LAccel", "DAccel"
00204
00205
00206 };
00207
00208
00209 const char* const outputNames[NumReferenceFrames + 1] = {
00210
00211
00212 "LArm:Rotate", "LArm:Elevator", "LArm:Elbow",
00213
00214
00215 "RArm:Rotate", "RArm:Elevator", "RArm:Elbow",
00216
00217
00218 "LLeg:Abduce", "LLeg:Flex", "LLeg:Knee",
00219 "LLeg:AnkleFlex",
00220 "LLeg:AnkleLateral",
00221
00222
00223 "RLeg:Abduce", "RLeg:Flex", "RLeg:Knee",
00224 "RLeg:AnkleFlex",
00225 "RLeg:AnkleLateral",
00226
00227
00228 "NECK:Pan",
00229
00230 "BaseFrame",
00231 "CAMERA:Eye",
00232 "LArm:Wrist",
00233 "RArm:Wrist",
00234 "LLeg:Sole",
00235 "RLeg:Sole",
00236 NULL
00237 };
00238
00239
00240 extern const Capabilities capabilities;
00241
00242
00243 const float DefaultPIDs[NumPIDJoints][3] = {
00244 {1, 0, 0}, {1, 0, 0}, {1, 0, 0}, {1, 0, 0},
00245 {1, 0, 0}, {1, 0, 0}, {1, 0, 0}, {1, 0, 0},
00246 {1, 0, 0}, {1, 0, 0}, {1, 0, 0}, {1, 0, 0},
00247 {1, 0, 0}, {1, 0, 0}, {1, 0, 0}, {1, 0, 0},
00248 {1, 0, 0}
00249 };
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259 const float MaxOutputSpeed[NumOutputs] = {
00260
00261
00262 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f,
00263 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f,
00264 1.f
00265 };
00266
00267 #ifndef RAD
00268
00269 #define RAD(deg) (((deg) * (float)M_PI ) / 180.0f)
00270
00271 #define __RI_RAD_FLAG
00272 #endif
00273
00274
00275 const float outputRanges[NumOutputs][2] = {
00276
00277
00278 {RAD(0), RAD(180)}, {RAD(0), RAD(180)}, {RAD(-90), RAD(90)},
00279
00280
00281 {RAD(0), RAD(180)}, {RAD(0), RAD(180)}, {RAD(-90), RAD(90)},
00282
00283
00284 {RAD(-10), RAD(90)}, {RAD(-90), RAD(90)}, {RAD(-90), RAD(20)},
00285 {RAD(-90), RAD(90)},
00286 {RAD(-70), RAD(20)},
00287
00288
00289 {RAD(-10), RAD(90)}, {RAD(-90), RAD(90)}, {RAD(-90), RAD(20)},
00290 {RAD(-90), RAD(90)},
00291 {RAD(-70), RAD(20)},
00292
00293
00294 {RAD(-90), RAD(90)}
00295 };
00296
00297
00298
00299
00300
00301 const float mechanicalLimits[NumOutputs][2] = {
00302
00303
00304 {RAD(0), RAD(180)}, {RAD(0), RAD(180)}, {RAD(-90), RAD(90)},
00305
00306
00307 {RAD(0), RAD(180)}, {RAD(0), RAD(180)}, {RAD(-90), RAD(90)},
00308
00309
00310 {RAD(-10), RAD(90)}, {RAD(-90), RAD(90)}, {RAD(-90), RAD(20)},
00311 {RAD(-90), RAD(90)},
00312 {RAD(-70), RAD(20)},
00313
00314
00315 {RAD(-10), RAD(90)}, {RAD(-90), RAD(90)}, {RAD(-90), RAD(20)},
00316 {RAD(-90), RAD(90)},
00317 {RAD(-70), RAD(20)},
00318
00319
00320 {RAD(-90), RAD(90)}
00321 };
00322
00323 #ifdef __RI_RAD_FLAG
00324 #undef RAD
00325 #undef __RI_RAD_FLAG
00326 #endif
00327 }
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338 #endif