00001 #include "RobotInfo.h"
00002 #include <iostream>
00003
00004 #if defined(TGT_ERS2xx) && defined(PLATFORM_APERIOS)
00005 # include <OPENR/OPENRAPI.h>
00006 #endif
00007
00008
00009
00010
00011 #include "ERS210Info.h"
00012 namespace ERS210Info {
00013 const char* const TargetName="ERS-210";
00014 const ERS210Capabilities capabilities;
00015 }
00016
00017 #include "ERS220Info.h"
00018 namespace ERS220Info {
00019 const char* const TargetName="ERS-220";
00020 const ERS220Capabilities capabilities;
00021 }
00022
00023 #include "ERS2xxInfo.h"
00024 namespace ERS2xxInfo {
00025 const char* const TargetName="ERS-2xx";
00026 const ERS2xxCapabilities capabilities;
00027 }
00028
00029 #include "ERS7Info.h"
00030 namespace ERS7Info {
00031 const char* const TargetName="ERS-7";
00032 const ERS7Capabilities capabilities;
00033 const char CameraModelName[] = "ERS-7-Camera";
00034 }
00035
00036 #include "LynxArm6Info.h"
00037 namespace LynxArm6Info {
00038 const char* const TargetName="LynxArm6";
00039 const Capabilities capabilities(TargetName,NumReferenceFrames,outputNames,NumButtons,buttonNames,NumSensors,sensorNames,PIDJointOffset,NumPIDJoints,0,0,NumOutputs);
00040 }
00041
00042 #include "Regis1Info.h"
00043 namespace Regis1Info {
00044 const char* const TargetName="Regis1";
00045 const Regis1Capabilities capabilities;
00046 }
00047
00048 #include "QBotPlusInfo.h"
00049 namespace QBotPlusInfo {
00050 const char* const TargetName="QBotPlus";
00051 const QBotPlusCapabilities capabilities;
00052 }
00053
00054 #include "QwerkInfo.h"
00055 namespace QwerkInfo {
00056 const char* const TargetName="Qwerk";
00057 const Capabilities capabilities(TargetName,NumReferenceFrames,outputNames,NumButtons,buttonNames,NumSensors,sensorNames,PIDJointOffset,NumPIDJoints,LEDOffset,NumLEDs,NumOutputs);
00058 }
00059
00060 #include "CreateInfo.h"
00061 namespace CreateInfo {
00062 const char* const TargetName="Create";
00063 const Capabilities capabilities(TargetName,NumReferenceFrames,outputNames,NumButtons,buttonNames,NumSensors,sensorNames,PIDJointOffset,NumPIDJoints,LEDOffset,NumLEDs,NumOutputs);
00064 }
00065
00066 #include "CalliopeInfo.h"
00067 namespace CalliopeInfo {
00068 const char* const TargetName="Calliope";
00069 const CalliopeCapabilities capabilities;
00070 }
00071
00072 namespace CalliopeLPInfo {
00073 const char* const TargetName="CalliopeLP";
00074 const CalliopeLPCapabilities capabilities;
00075 }
00076
00077 namespace CalliopeSPInfo {
00078 const char* const TargetName="CalliopeSP";
00079 const CalliopeSPCapabilities capabilities;
00080 }
00081
00082 namespace Calliope2SPInfo {
00083 const char* const TargetName="Calliope2SP";
00084 const Calliope2SPCapabilities capabilities;
00085 }
00086
00087 namespace Calliope5SPInfo {
00088 const char* const TargetName="Calliope5SP";
00089 const Calliope5SPCapabilities capabilities;
00090 }
00091
00092 namespace Calliope5KPInfo {
00093 const char* const TargetName="Calliope5KP";
00094 const Calliope5KPCapabilities capabilities;
00095 }
00096 #include "Calliope3Info.h"
00097 namespace Calliope3Info {
00098 const char* const TargetName="Calliope3";
00099 const Calliope3Capabilities capabilities;
00100 }
00101 #include "CalliopeUInfo.h"
00102 namespace CalliopeUInfo {
00103 const char* const TargetName="CalliopeU";
00104 const CalliopeUCapabilities capabilities;
00105 }
00106
00107 #include "WiiMoteInfo.h"
00108 namespace WiiMoteInfo {
00109 const char* const TargetName="WiiMote";
00110 const Capabilities capabilities(TargetName,NumReferenceFrames,outputNames,NumButtons,buttonNames,NumSensors,sensorNames,PIDJointOffset,NumPIDJoints,LEDOffset,NumLEDs,NumOutputs);
00111 }
00112
00113 #include "BioloidInfo.h"
00114 namespace BioloidInfo {
00115 const char* const TargetName="Bioloid";
00116 const Capabilities capabilities(TargetName,NumReferenceFrames,outputNames,NumButtons,buttonNames,NumSensors,sensorNames,PIDJointOffset,NumPIDJoints,LEDOffset,NumLEDs,NumOutputs);
00117 }
00118
00119 #include "PanTiltInfo.h"
00120 namespace PanTiltInfo {
00121 const char* const TargetName="PanTilt";
00122 const Capabilities capabilities(TargetName,NumReferenceFrames,outputNames,NumButtons,buttonNames,NumSensors,sensorNames,PIDJointOffset,NumPIDJoints,LEDOffset,NumLEDs,NumOutputs);
00123 }
00124
00125 #include "HandEyeInfo.h"
00126 namespace HandEyeInfo {
00127 const char* const TargetName="HandEye";
00128 const HandEyeCapabilities capabilities;
00129 }
00130
00131 #include "HandEyeZInfo.h"
00132 namespace HandEyeZInfo {
00133 const char* const TargetName="HandEyeZ";
00134 const HandEyeZCapabilities capabilities;
00135 }
00136
00137
00138 #include "TentacleInfo.h"
00139 namespace TentacleInfo {
00140 const char* const TargetName="Tentacle";
00141 const Capabilities capabilities(TargetName,NumReferenceFrames,outputNames,NumButtons,buttonNames,NumSensors,sensorNames,PIDJointOffset,NumPIDJoints,LEDOffset,NumLEDs,NumOutputs);
00142 }
00143
00144 #include "ChiaraInfo.h"
00145 namespace ChiaraInfo {
00146 const char* const TargetName="Chiara";
00147 const ChiaraCapabilities capabilities;
00148 }
00149
00150 #include "Chiara2Info.h"
00151 namespace Chiara2Info {
00152 const char* const TargetName="Chiara2";
00153 const ChiaraCapabilities capabilities;
00154 }
00155
00156 #include "KHR2Info.h"
00157 namespace KHR2Info {
00158 const char* const TargetName="KHR2";
00159 const Capabilities capabilities(TargetName,NumReferenceFrames,outputNames,NumButtons,buttonNames,NumSensors,sensorNames,PIDJointOffset,NumPIDJoints,LEDOffset,NumLEDs,NumOutputs);
00160 }
00161
00162 #include "MantisArmInfo.h"
00163 namespace MantisArmInfo {
00164 const char* const TargetName="MantisArm";
00165 const MantisArmCapabilities capabilities;
00166 }
00167
00168 #include "MantisLegInfo.h"
00169 namespace MantisLegInfo {
00170 const char* const TargetName="MantisLeg";
00171 const MantisLegCapabilities capabilities;
00172 }
00173
00174 #include "MantisInfo.h"
00175 namespace MantisInfo {
00176 const char* const TargetName="Mantis";
00177 const MantisCapabilities capabilities;
00178 }
00179
00180 namespace CameraGeneric60 {
00181 const char CameraModelName[] = "Generic60";
00182 }
00183
00184 namespace Camera75DOF {
00185 const char CameraModelName[] = "QuickCam-Pro-9000";
00186 }
00187
00188 namespace CameraKinect {
00189 const char CameraModelName[] = "Kinect-Camera";
00190 }
00191
00192 namespace CameraSTX {
00193 const char CameraModelName[] = "QuickCam-STX";
00194 }
00195
00196 namespace CameraERS2xx {
00197 const char CameraModelName[] = "ERS-2xx-Camera";
00198 }
00199
00200 namespace CameraLifeCam {
00201 const char CameraModelName[] = "LifeCam-HD-5000";
00202 }
00203
00204 namespace RobotInfo {
00205
00206 const char* const detectModel() {
00207 #ifdef TGT_ERS2xx
00208 # ifdef PLATFORM_APERIOS
00209
00210 char robotDesignStr[orobotdesignNAME_MAX + 1];
00211 memset(robotDesignStr, 0, sizeof(robotDesignStr));
00212 if (OPENR::GetRobotDesign(robotDesignStr) != oSUCCESS) {
00213 std::cout << "OPENR::GetRobotDesign() failed." << std::endl;
00214 return TargetName;
00215 } else {
00216 if(strcmp(robotDesignStr,"ERS-210")==0)
00217 return ERS210Info::TargetName;
00218 else if(strcmp(robotDesignStr,"ERS-220")==0)
00219 return ERS220Info::TargetName;
00220 else {
00221 std::cerr << "ERROR: Unknown name '" << robotDesignStr << "' for target ERS2xx" << std::endl;
00222 return TargetName;
00223 }
00224 }
00225 # else
00226 # warning TGT_ERS2xx assuming ERS-210 for simulation on local platform
00227 return ERS210Info::TargetName;
00228 # endif
00229
00230 #else
00231
00232 return TargetName;
00233 #endif
00234 }
00235
00236 #if defined(TGT_HAS_CAMERA) || defined(TGT_HAS_WEBCAM)
00237 const char* CameraName = CameraModelName;
00238 fmat::Matrix<3,3> CameraHomography = fmat::Matrix<3,3>::identity();
00239 #endif
00240
00241 #ifndef PLATFORM_APERIOS
00242 const char* const RobotName = detectModel();
00243 #else // have to use a string because aperios is annoying like that
00244 const std::string RobotName = detectModel();
00245 #endif
00246
00247
00248 Capabilities::Capabilities(const char* robName, size_t numFrame, const char * const frameNames[],
00249 size_t numBut, const char * const butNames[],
00250 size_t numSen, const char * const senNames[],
00251 size_t pidOff, size_t numPID, size_t ledOff, size_t numLED, size_t numTotalOutputs) :
00252 name(robName),
00253 frames(frameNames,frameNames+numFrame), buttons(butNames,butNames+numBut), sensors(senNames,senNames+numSen),
00254 frameToIndex(), buttonToIndex(), sensorToIndex(),
00255 pidJointOffset(pidOff), numPIDJoints(numPID),
00256 ledOffset(ledOff), numLEDs(numLED),
00257 numOutputs(numTotalOutputs), fakeOutputs() {
00258 for(size_t i=0; i<frames.size(); ++i)
00259 frameToIndex[frames[i]]=i;
00260 for(size_t i=0; i<buttons.size(); ++i)
00261 buttonToIndex[buttons[i]]=i;
00262 for(size_t i=0; i<sensors.size(); ++i)
00263 sensorToIndex[sensors[i]]=i;
00264
00265 std::map<std::string, const Capabilities*>::const_iterator it=getCaps().find(robName);
00266 if(it!=getCaps().end())
00267 std::cerr << "WARNING: RobotInfo '" << robName
00268 << "' capabilities has already been registered! Name conflict? Replacing previous..." << std::endl;
00269 getCaps()[robName]=this;
00270 }
00271
00272 std::map<std::string, const Capabilities*>& Capabilities::getCaps() {
00273 static std::map<std::string, const Capabilities*> caps;
00274 return caps;
00275 }
00276
00277 }