00001
00002 #ifndef INCLUDED_CalliopeUInfo_h
00003 #define INCLUDED_CalliopeUInfo_h
00004
00005 #include <cmath>
00006 #include <stdlib.h>
00007 #include "CommonInfo.h"
00008 using namespace RobotInfo;
00009
00010
00011 #if defined(TGT_CALLIOPEU)
00012 # define TGT_IS_KOBUKI
00013 # define TGT_HAS_WHEELS 2
00014 # define TGT_HAS_BUTTONS 15
00015 # define TGT_HAS_LEDS 4
00016 # define TGT_HAS_CAMERA 1
00017 #endif
00018
00019
00020 namespace CalliopeUInfo {
00021
00022
00023
00024
00025
00026 extern const char* const TargetName;
00027
00028 const unsigned int FrameTime=30;
00029 const unsigned int NumFrames=1;
00030 const unsigned int SoundBufferTime=32;
00031
00032
00033 const unsigned NumWheels = 2;
00034
00035 const unsigned FingerJointsPerArm = 0;
00036 const unsigned JointsPerArm = 0;
00037 const unsigned NumArms = 0;
00038 const unsigned NumArmJoints = JointsPerArm*NumArms;
00039
00040 const unsigned JointsPerLeg = 0;
00041 const unsigned NumLegs = 0;
00042 const unsigned NumLegJoints = JointsPerLeg*NumLegs;
00043 const unsigned NumHeadJoints = 0;
00044 const unsigned NumTailJoints = 0;
00045 const unsigned NumMouthJoints = 0;
00046 const unsigned NumEarJoints = 0;
00047 const unsigned NumButtons = 11;
00048 const unsigned NumSensors = 42;
00049 const unsigned NumLEDs = 4;
00050 const unsigned NumFacePanelLEDs = 0;
00051
00052 const unsigned NumPIDJoints = NumWheels;
00053 const unsigned NumOutputs = NumPIDJoints + NumLEDs;
00054 const unsigned NumReferenceFrames = NumOutputs + 1 + NumArms + 1;
00055
00056 const float wheelBase = 230.0;
00057 const float wheelRadius = 35.0;
00058 const float tickToRad = 0.002436916871363930187454f;
00059
00060 using namespace Camera75DOF;
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 const unsigned PIDJointOffset = 0;
00072 const unsigned WheelOffset = PIDJointOffset;
00073 const unsigned HeadOffset = WheelOffset+NumWheels;
00074
00075 const unsigned LEDOffset = HeadOffset+NumHeadJoints;
00076
00077 const unsigned ModeOffset = LEDOffset + NumLEDs;
00078
00079 const unsigned BaseFrameOffset = NumOutputs;
00080 const unsigned CameraFrameOffset = BaseFrameOffset + 1;
00081
00082
00083 enum TPROffset_t {
00084 PanOffset = 0,
00085 TiltOffset,
00086 NodOffset = TiltOffset
00087 };
00088
00089
00090 enum HeadOffset_t {
00091 HeadPanOffset = HeadOffset,
00092 HeadTiltOffset,
00093 };
00094
00095 enum WheelOffset_t {
00096 SpeedOffset=WheelOffset,
00097 RadiusOffset
00098 };
00099
00100
00101
00102 enum LEDOffset_t {
00103 RedLED1Offset=LEDOffset,
00104 GreenLED1Offset,
00105 RedLED2Offset,
00106 GreenLED2Offset
00107 };
00108
00109 const LEDOffset_t RedLEDOffset = RedLED1Offset;
00110 const LEDOffset_t YellowLEDOffset = RedLED2Offset;
00111 const LEDOffset_t GreenLEDOffset = GreenLED1Offset;
00112 const LEDOffset_t BlueLEDOffset = GreenLED2Offset;
00113
00114 typedef unsigned int LEDBitMask_t;
00115
00116 const LEDBitMask_t RedLEDMask = 1<<(RedLED1Offset-LEDOffset);
00117 const LEDBitMask_t YellowLEDMask = 1<<(RedLED2Offset-LEDOffset);
00118 const LEDBitMask_t GreenLEDMask = 1<<(GreenLED1Offset-LEDOffset);
00119 const LEDBitMask_t BlueLEDMask = (1<<(GreenLED2Offset-LEDOffset));
00120
00121
00122
00123
00124 const LEDBitMask_t FaceLEDMask = 0;
00125
00126 const LEDBitMask_t AllLEDMask = (LEDBitMask_t)~0;
00127
00128
00129
00130 const fmat::Column<3> AgentBoundingBoxBaseFrameOffset = fmat::pack(0,0,0);
00131
00132
00133 const fmat::Column<3> AgentBoundingBoxHalfDims = fmat::pack(304.8/2, 304.8/2, 0);
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148 enum ButtonOffset_t {
00149 B0ButOffset,
00150 B1ButOffset,
00151 B2ButOffset,
00152 DropLeftWheelButOffset,
00153 DropRightWheelButOffset,
00154 BumpLeftButOffset,
00155 BumpRightButOffset,
00156 BumpCenterButOffset,
00157 CliffLeftButOffset,
00158 CliffRightButOffset,
00159 CliffCenterButOffset,
00160
00161 };
00162
00163 const ButtonOffset_t GreenButOffset = B0ButOffset;
00164 const ButtonOffset_t YellowButOffset = B1ButOffset;
00165 const ButtonOffset_t RedButOffset = B2ButOffset;
00166
00167
00168 const char* const buttonNames[NumButtons+1] = {
00169 "Button0",
00170 "Button1",
00171 "Button2",
00172 "LeftWheelDrop",
00173 "RightWheelDrop",
00174 "BumpLeft",
00175 "BumpRight",
00176 "BumpCenter",
00177 "CliffLeft",
00178 "CliffRight",
00179 "CliffCenter",
00180 NULL
00181 };
00182
00183
00184
00185 enum SensorOffset_t {
00186
00187
00188
00189 LeftEncoderOffset,
00190 RightEncoderOffset,
00191 LeftPwmOffset,
00192 RightPwmOffset,
00193 ChargerOffset,
00194 BatteryOffset,
00195 OverCurrentOffset,
00196
00197
00198 Docking0Offset,
00199 Docking1Offset,
00200 Docking2Offset,
00201
00202
00203 AngleOffset,
00204 AngleRateOffset,
00205 Acc0Offset,
00206 Acc1Offset,
00207 Acc2Offset,
00208
00209
00210 Bottom0Offset,
00211 Bottom1Offset,
00212 Bottom2Offset,
00213
00214
00215 Current0Offset,
00216 Current1Offset,
00217
00218
00219 FrameIdOffset,
00220 FollowedDataLenghtOffset,
00221 GyroParam0Offset,
00222 GyroParam1Offset,
00223 GyroParam2Offset,
00224 GyroParam3Offset,
00225 GyroParam4Offset,
00226 GyroParam5Offset,
00227 GyroParam6Offset,
00228 GyroParam7Offset,
00229 GyroParam8Offset,
00230
00231
00232 DigitalInputOffset,
00233 AnalogInput0Offset,
00234 AnalogInput1Offset,
00235 AnalogInput2Offset,
00236 AnalogInput3Offset,
00237 AnalogInput4Offset,
00238 AnalogInput5Offset,
00239 AnalogInput6Offset,
00240
00241 GPSXOffset,
00242 GPSYOffset,
00243 GPSHeadingOffset,
00244 };
00245
00246
00247 const char* const sensorNames[NumSensors+1] = {
00248
00249
00250
00251 "LeftEncoder",
00252 "RightEncoder",
00253 "LeftPwm",
00254 "RightPwm",
00255 "Charger",
00256 "Battery",
00257 "OverCurrent",
00258
00259
00260 "Docking0",
00261 "Docking1",
00262 "Docking2",
00263
00264
00265 "Angle",
00266 "AngleRate",
00267 "Acc0",
00268 "Acc1",
00269 "Acc2",
00270
00271
00272 "CliffBottom0",
00273 "CliffBottom1",
00274 "CliffBottom2",
00275
00276
00277 "Current0",
00278 "Current2",
00279
00280
00281 "FrameId",
00282 "FollowedDataLenght",
00283 "GyroParam0",
00284 "GyroParam1",
00285 "GyroParam2",
00286 "GyroParam3",
00287 "GyroParam4",
00288 "GyroParam5",
00289 "GyroParam6",
00290 "GyroParam7",
00291 "GyroParam8",
00292
00293
00294 "DigitalInput0",
00295 "AnalogInput0",
00296 "AnalogInput1",
00297 "AnalogInput2",
00298 "AnalogInput3",
00299 "AnalogInput4",
00300 "AnalogInput5",
00301 "AnalogInput6",
00302 "GPSX",
00303 "GPSY",
00304 "GPSHeading",
00305 NULL
00306
00307 };
00308
00309
00310
00311
00312
00313 const char* const outputNames[NumReferenceFrames+1] = {
00314 "Speed",
00315 "Radius",
00316 "LED1:Red",
00317 "LED1:Green",
00318 "LED2:Red",
00319 "LED2:Green",
00320 "BaseFrame",
00321 "CameraFrame",
00322 NULL
00323 };
00324
00325
00326 class CalliopeUCapabilities : public Capabilities {
00327 public:
00328
00329 CalliopeUCapabilities()
00330 : Capabilities(TargetName,NumReferenceFrames,outputNames,NumButtons,buttonNames,
00331 NumSensors,sensorNames,PIDJointOffset,NumPIDJoints,LEDOffset,NumLEDs,NumOutputs)
00332 {}
00333 };
00334
00335 extern const CalliopeUCapabilities capabilities;
00336
00337
00338 const float DefaultPIDs[NumPIDJoints+1][3] = {
00339 {1,0,0},
00340 {1,0,0},
00341 };
00342
00343
00344 const float MaxOutputSpeed[NumOutputs] = {
00345 0, 0,
00346 0, 0, 0, 0
00347 };
00348
00349 #ifndef RAD
00350
00351 #define RAD(deg) (((deg) * (float)M_PI ) / 180.0f)
00352
00353 #define __RI_RAD_FLAG
00354 #endif
00355
00356
00357 const float outputRanges[NumOutputs][2] =
00358 {
00359 { -500 , 500 },
00360 { -500 , 500 },
00361 { 0 , 1 },
00362 { 0 , 1 },
00363 { 0 , 1 },
00364 { 0 , 1 }
00365 };
00366
00367
00368
00369 const float mechanicalLimits[NumOutputs][2] =
00370 {
00371 { -500 , 500 },
00372 { -500 , 500 },
00373 { 0 , 1 },
00374 { 0 , 1 },
00375 { 0 , 1 },
00376 { 0 , 1 },
00377 };
00378
00379 #ifdef __RI_RAD_FLAG
00380 #undef RAD
00381 #undef __RI_RAD_FLAG
00382 #endif
00383 }
00384
00385
00386
00387
00388
00389
00390 #endif