00001
00002 #ifndef INCLUDED_QBotPlusInfo_h
00003 #define INCLUDED_QBotPlusInfo_h
00004
00005 #include <cmath>
00006 #include <stdlib.h>
00007 #include "CommonInfo.h"
00008 using namespace RobotInfo;
00009
00010
00011 #if defined(TGT_QBOTPLUS)
00012 # define TGT_IS_QWERK
00013 # define TGT_HAS_WEBCAM 1
00014 # define TGT_HAS_CAMERA 1
00015 # define TGT_HAS_WHEELS 2
00016 # define TGT_HAS_LEDS 14
00017 # define TGT_HAS_HEAD 1
00018 # define TGT_HAS_BUTTONS 4
00019 #endif
00020
00021
00022 namespace QBotPlusInfo {
00023
00024
00025
00026
00027
00028 extern const char* const TargetName;
00029
00030 const unsigned int FrameTime=25;
00031 const unsigned int NumFrames=1;
00032 const unsigned int SoundBufferTime=32;
00033
00034
00035 const unsigned NumWheels = 2;
00036
00037 const unsigned JointsPerArm = 0;
00038 const unsigned NumArms = 0;
00039 const unsigned NumArmJoints = JointsPerArm*NumArms;
00040
00041 const unsigned JointsPerLeg = 0;
00042 const unsigned NumLegs = 0;
00043 const unsigned NumLegJoints = JointsPerLeg*NumLegs;
00044 const unsigned NumHeadJoints = 2;
00045 const unsigned NumTailJoints = 0;
00046 const unsigned NumMouthJoints = 0;
00047 const unsigned NumEarJoints = 0;
00048 const unsigned NumButtons = 8;
00049 const unsigned NumSensors = 17;
00050 const unsigned NumLEDs = 14;
00051 const unsigned NumFacePanelLEDs = 0;
00052
00053 const unsigned NumPIDJoints = NumWheels + NumArmJoints + NumLegJoints+NumHeadJoints+NumTailJoints+NumMouthJoints;
00054 const unsigned NumOutputs = NumPIDJoints + NumLEDs;
00055 const unsigned NumReferenceFrames = NumOutputs + 1 + NumArms + 1;
00056
00057 using namespace CameraSTX;
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 const unsigned PIDJointOffset = 0;
00070 const unsigned WheelOffset = PIDJointOffset;
00071 const unsigned HeadOffset = WheelOffset+NumWheels;
00072
00073 const unsigned LEDOffset = PIDJointOffset + NumPIDJoints;
00074
00075 const unsigned BaseFrameOffset = NumOutputs;
00076 const unsigned CameraFrameOffset = BaseFrameOffset + 1;
00077
00078
00079 enum TPROffset_t {
00080 PanOffset = 0,
00081 TiltOffset,
00082 NodOffset = TiltOffset
00083 };
00084
00085
00086 enum HeadOffset_t {
00087 HeadPanOffset = HeadOffset,
00088 HeadTiltOffset,
00089 };
00090
00091
00092 enum WheelOffset_t {
00093 LWheelOffset=WheelOffset,
00094 RWheelOffset
00095 };
00096
00097
00098
00099 enum LEDOffset_t { };
00100
00101 typedef unsigned int LEDBitMask_t;
00102
00103 const LEDBitMask_t FaceLEDMask = 0;
00104
00105 const LEDBitMask_t AllLEDMask = (LEDBitMask_t)~0;
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127 enum ButtonOffset_t { Button0, Button1, Button2, Button3,
00128 Button4, Button5, Button6, Button7 };
00129
00130
00131 const char* const buttonNames[NumButtons+1] =
00132 { "Button0", "Button1", "Button2", "Button3",
00133 "Button4", "Button5", "Button6", "Button7",
00134 NULL };
00135
00136
00137
00138 enum SensorOffset_t { AnalogInValues0, AnalogInValues1,
00139 AnalogInValues2, AnalogInValues3,
00140 AnalogInValues4, AnalogInValues5,
00141 AnalogInValues6, AnalogInValues7,
00142 DigitalInStates0, DigitalInStates1,
00143 DigitalInStates2, DigitalInStates3,
00144 DigitalInStates4, DigitalInStates5,
00145 DigitalInStates6, DigitalInStates7,
00146 BatteryVoltage };
00147
00148
00149 const char* const sensorNames[NumSensors] = {
00150 "analogInValues0",
00151 "analogInValues1",
00152 "analogInValues2",
00153 "analogInValues3",
00154 "analogInValues4",
00155 "analogInValues5",
00156 "analogInValues6",
00157 "analogInValues7",
00158 "digitalInStates0",
00159 "digitalInStates1",
00160 "digitalInStates2",
00161 "digitalInStates3",
00162 "digitalInStates4",
00163 "digitalInStates5",
00164 "digitalInStates6",
00165 "digitalInStates7",
00166 "BatteryVoltage"
00167 };
00168
00169
00170
00171
00172
00173 const char* const outputNames[NumReferenceFrames+1] = {
00174 "WHEEL:L",
00175 "WHEEL:R",
00176 "NECK:pan",
00177 "NECK:tilt",
00178 "LED:00000",
00179 "LED:00001",
00180 "LED:00002",
00181 "LED:00003",
00182 "LED:00004",
00183 "LED:00005",
00184 "LED:00006",
00185 "LED:00007",
00186 "LED:00008",
00187 "LED:00009",
00188 "LED:00010",
00189 "LED:00011",
00190 "LED:00012",
00191 "LED:00013",
00192
00193 "BaseFrame",
00194 "CameraFrame",
00195 NULL
00196 };
00197
00198
00199 class QBotPlusCapabilities : public Capabilities {
00200 public:
00201
00202 QBotPlusCapabilities()
00203 : Capabilities(TargetName,NumReferenceFrames,outputNames,NumButtons,buttonNames,NumSensors,sensorNames,PIDJointOffset,NumPIDJoints,LEDOffset,NumLEDs,NumOutputs)
00204 {
00205
00206 frameToIndex["WHEEL:000"]=LWheelOffset;
00207 frameToIndex["WHEEL:001"]=RWheelOffset;
00208 frameToIndex["SERVO:000"]=HeadPanOffset;
00209 frameToIndex["SERVO:001"]=HeadTiltOffset;
00210
00211 frameToIndex["NECK:nod"]=HeadTiltOffset;
00212 }
00213 };
00214
00215 extern const QBotPlusCapabilities capabilities;
00216
00217
00218 const float DefaultPIDs[NumPIDJoints][3] = {
00219 {1,0,0},
00220 {1,0,0},
00221 {1,0,0},
00222 {1,0,0}
00223 };
00224
00225
00226
00227
00228
00229
00230
00231
00232 const float MaxOutputSpeed[NumOutputs] = {
00233 1.f,
00234 1.f,
00235 6.28f,
00236 3.14f,
00237
00238 0,0,0,0,0,0,0,0,0,0
00239 };
00240
00241 #ifndef RAD
00242
00243 #define RAD(deg) (((deg) * (float)M_PI ) / 180.0f)
00244
00245 #define __RI_RAD_FLAG
00246 #endif
00247
00248
00249 const float outputRanges[NumOutputs][2] =
00250 {
00251 { -1 , 1 },
00252 { -1 , 1 },
00253 { RAD(-90) , RAD(90) },
00254 { RAD(-90) , RAD(90) },
00255
00256
00257 {0,1}, {0,1}, {0,1}, {0,1}, {0,1},
00258 {0,1}, {0,1}, {0,1}, {0,1}, {0,1},
00259 {0,1}, {0,1}, {0,1}, {0,1}
00260 };
00261
00262
00263
00264 const float mechanicalLimits[NumOutputs][2] =
00265 {
00266 { -1 , 1 },
00267 { -1 , 1 },
00268 { RAD(-90) , RAD(90) },
00269 { RAD(-90) , RAD(90) },
00270
00271
00272 {0,1}, {0,1}, {0,1}, {0,1}, {0,1},
00273 {0,1}, {0,1}, {0,1}, {0,1}, {0,1},
00274 {0,1}, {0,1}, {0,1}, {0,1}
00275 };
00276
00277 #ifdef __RI_RAD_FLAG
00278 #undef RAD
00279 #undef __RI_RAD_FLAG
00280 #endif
00281 }
00282
00283
00284
00285
00286
00287
00288 #endif