Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

RobotInfo.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_RobotInfo_h
00003 #define INCLUDED_RobotInfo_h
00004 
00005 #include <map>
00006 #include <string>
00007 
00008 // If creating a new robot configuration, add a new entry in the list below
00009 
00010 #if TGT_ERS210
00011 # include "Shared/ERS210Info.h"
00012 namespace RobotInfo { using namespace ERS210Info; }
00013 
00014 #elif TGT_ERS220
00015 # include "Shared/ERS220Info.h"
00016 namespace RobotInfo { using namespace ERS220Info; }
00017 
00018 #elif TGT_ERS2xx
00019 # include "Shared/ERS2xxInfo.h"
00020 namespace RobotInfo { using namespace ERS2xxInfo; }
00021 
00022 #elif TGT_ERS7
00023 # include "Shared/ERS7Info.h"
00024 namespace RobotInfo { using namespace ERS7Info; }
00025 
00026 #elif TGT_LYNXARM6
00027 # include "Shared/LynxArm6Info.h"
00028 namespace RobotInfo { using namespace LynxArm6Info; }
00029 
00030 #elif TGT_REGIS1
00031 # include "Shared/Regis1Info.h"
00032 namespace RobotInfo { using namespace Regis1Info; }
00033 
00034 #elif TGT_QBOTPLUS
00035 # include "Shared/QBotPlusInfo.h"
00036 namespace RobotInfo { using namespace QBotPlusInfo; }
00037 
00038 #elif TGT_QWERK
00039 # include "Shared/QwerkInfo.h"
00040 namespace RobotInfo { using namespace QwerkInfo; }
00041 
00042 #elif TGT_CREATE
00043 # include "Shared/CreateInfo.h"
00044 namespace RobotInfo { using namespace CreateInfo; }
00045 
00046 #else //default case, currently ERS-7
00047 # warning "TGT_<model> undefined or unknown model set - defaulting to ERS7"
00048 # include "Shared/ERS7Info.h"
00049 namespace RobotInfo { using namespace ERS7Info; }
00050 #endif //model selection
00051 
00052 
00053 //! Contains information about the robot, such as number of joints, PID defaults, timing information, etc.
00054 /*! This is just a wrapper for whichever namespace corresponds to the current
00055 *  robot target setting (one of TGT_ERS7, TGT_ERS210, TGT_ERS220, or the cross-booting TGT_ERS2xx)
00056 *
00057 *  You probably should look at ERS7Info, ERS210Info, ERS220Info, or ERS2xxInfo for the actual
00058 *  constants used for each model, although some common information shared by all of these namespaces
00059 *  is defined in CommonInfo.h */
00060 namespace RobotInfo {
00061   
00062   //! Accessor for Capabilities::caps, returns the Capabilities instance for a specified robot model (or NULL if robot is unknown or didn't provide a Capabilities instance)
00063   /*! Use this if you have a robot name in string form and want to check or map its capabilities.
00064    *  (For example, if you are communicating with another robot of a different type over the network.)
00065    *  If you know at compile time the type of the robot in question, you could just directly access
00066    *  its 'capabilities' instance via its RobotInfo namespace.  (e.g. ERS210Info::capabilities)
00067    *  If you want the capabilities for the current robot, just use the global 'capabilities' instance
00068    *  as RobotInfo.h will automatically import the current robot's namespace into the global space. */
00069   inline Capabilities* getCapabilities(const std::string& robName) {
00070     const std::map<std::string, class Capabilities*>& caps = Capabilities::getCaps();
00071     std::map<std::string, class Capabilities*>::const_iterator it = caps.find(robName);
00072     return it==caps.end() ? NULL : it->second;
00073   }
00074   
00075 }
00076 
00077 using namespace RobotInfo;
00078   
00079 /*! @file
00080  * @brief Checks the define's to load the appropriate header and namespace
00081  * @author ejt (Creator)
00082  *
00083  * $Author: ejt $
00084  * $Name: tekkotsu-4_0 $
00085  * $Revision: 1.29 $
00086  * $State: Exp $
00087  * $Date: 2007/11/18 06:47:05 $
00088  */
00089 
00090 #endif

Tekkotsu v4.0
Generated Thu Nov 22 00:54:55 2007 by Doxygen 1.5.4