Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

Regis1Info.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_Regis1Info_h
00003 #define INCLUDED_Regis1Info_h
00004 
00005 #include <stdlib.h>
00006 #include <cmath>
00007 #include "CommonInfo.h"
00008 using namespace RobotInfo;
00009 
00010 // see http://tekkotsu.org/porting.html#configuration for more information on TGT_HAS_* flags
00011 #if defined(TGT_REGIS1)
00012 #  define TGT_HAS_WHEELS 2
00013 #  define TGT_HAS_ARMS 1
00014 #  define TGT_HAS_CAMERA 1
00015 #  define TGT_HAS_HEAD 1
00016 #endif
00017 
00018 namespace Regis1Info  {
00019 
00020   // *******************************
00021   //       ROBOT CONFIGURATION
00022   // *******************************
00023 
00024   extern const char* const TargetName; //!< the name of the model, to be used for logging and remote GUIs
00025 
00026   const unsigned int FrameTime=15;        //!< time between frames in the motion system (milliseconds)
00027   const unsigned int NumFrames=1;        //!< the number of frames per buffer (don't forget also double buffered)
00028   const unsigned int SoundBufferTime=32; //!< the number of milliseconds per sound buffer... I'm not sure if this can be changed
00029   
00030   //!@name Output Types Information
00031   const unsigned NumWheels      =  2; //!<Left and Right Wheels
00032   
00033   const unsigned JointsPerArm   =  6;//!< Base, Shoulder, Elbow, Wrist (Yaw, Roll), Gripper
00034   const unsigned NumArms        =  1;
00035   const unsigned NumArmJoints   =  JointsPerArm*NumArms;
00036   
00037   const unsigned JointsPerLeg   =  0; 
00038   const unsigned NumLegs        =  0; 
00039   const unsigned NumLegJoints   =  JointsPerLeg*NumLegs;
00040   const unsigned NumHeadJoints  =  4;   // Goose neck
00041   const unsigned NumTailJoints  =  0; 
00042   const unsigned NumMouthJoints =  0; 
00043   const unsigned NumEarJoints   =  0; 
00044   const unsigned NumButtons     =  0; 
00045   const unsigned NumSensors     =  0;  
00046   const unsigned NumLEDs        =  0; 
00047   const unsigned NumFacePanelLEDs = 0; 
00048   
00049   const unsigned NumPIDJoints   = NumWheels+NumArmJoints+NumLegJoints+NumHeadJoints+NumTailJoints+NumMouthJoints; //!< The number of joints which use PID motion - everything except ears
00050   const unsigned NumBinJoints   = NumEarJoints; //!< The number of binary joints - just the ears
00051   const unsigned NumOutputs     = NumPIDJoints + NumBinJoints + NumLEDs; //!< the total number of outputs
00052   const unsigned NumReferenceFrames = NumOutputs + 1 + NumArms + 1; //!< for the base, gripper (* NumArms), and camera reference frames
00053 
00054   // webcam ?
00055   const float CameraHorizFOV=56.9/180*M_PI; //!< horizontal field of view (radians)
00056   const float CameraVertFOV=45.2/180*M_PI; //!< vertical field of view (radians)
00057   const float CameraFOV=CameraHorizFOV; //!< should be set to maximum of #CameraHorizFOV or #CameraVertFOV
00058   const unsigned int CameraResolutionX=320; //!< the number of pixels available in the 'full' layer
00059   const unsigned int CameraResolutionY=240; //!< the number of pixels available in the 'full' layer
00060   //@}
00061 
00062 
00063   // *******************************
00064   //         OUTPUT OFFSETS
00065   // *******************************
00066 
00067   //!Corresponds to entries in ERS7Info::PrimitiveName, defined at the end of this file
00068   //!@name Output Offsets
00069 
00070   const unsigned PIDJointOffset = 0; //!< The beginning of the PID Joints
00071   const unsigned WheelOffset = PIDJointOffset; //!< beginning of wheel velocities, don't need to add anything, just use WheelOffset_t entries directly
00072   const unsigned ArmOffset   = WheelOffset+NumWheels;  //!< beginning of arm joints, don't add anything, just use ArmOffset_t entries directly
00073   const unsigned HeadOffset  = ArmOffset+NumArmJoints;   //!< the offset of the beginning of the head joints, add TPROffset_t to get specific joint
00074 
00075   const unsigned LEDOffset   = PIDJointOffset + NumPIDJoints; //!< the offset of LEDs in WorldState::outputs and MotionCommand functions, see LedOffset_t for specific offsets
00076   const unsigned BinJointOffset = LEDOffset + NumLEDs;   //!< The beginning of the binary joints
00077   const unsigned EarOffset   = BinJointOffset;           //!< the offset of the beginning of the ear joints - note that ears aren't sensed.  They can be flicked by the environment and you won't know.
00078 
00079   const unsigned BaseFrameOffset   = NumOutputs; //!< Use with kinematics to refer to base reference frame
00080   const unsigned GripperFrameOffset    = BaseFrameOffset+1; //!< Use with kinematics to refer to paw reference frames (add appropriate LegOrder_t to specify which paw)
00081   const unsigned CameraFrameOffset = GripperFrameOffset+NumArms; //!< Use with kinematics to refer to camera reference frame
00082 
00083   enum WheelOffset_t {
00084     LWheelOffset=WheelOffset,
00085     RWheelOffset
00086   };
00087   
00088   //! these are all 'absolute' offsets -- no need to add to HeadOffset
00089   enum HeadOffset_t {
00090     HeadBaseOffset = HeadOffset,
00091     HeadPanOffset = HeadBaseOffset, // alias HeadPanOffset
00092     HeadShoulderOffset,
00093     HeadElbowOffset,
00094     HeadTiltOffset = HeadElbowOffset, // alias HeadTiltOffset
00095     HeadWristOffset,
00096     HeadNodOffset = HeadWristOffset // alias HeadNodOffset
00097   };
00098   
00099   //! these are the traditional sub-offsets, relative to HeadOffset
00100   enum TPROffset_t {
00101     PanOffset = HeadBaseOffset - HeadOffset, //!< pan/heading (horizontal)
00102     TiltOffset = HeadElbowOffset - HeadOffset, //!< tilt/elevation (vertical)
00103     NodOffset = HeadWristOffset - HeadOffset //!< replicated tilt (could be left undefined instead...)
00104   };
00105   
00106   enum ArmOffset_t {
00107     ArmBaseOffset = ArmOffset,
00108     ArmShoulderOffset,
00109     ArmElbowOffset,
00110     ArmWristOffset,
00111     ArmWristRotateOffset,
00112     ArmGripperOffset
00113   };
00114 
00115   enum LEDOffset_t { };
00116   
00117   typedef unsigned int LEDBitMask_t;
00118   
00119   const LEDBitMask_t FaceLEDMask = 0;
00120   
00121   const LEDBitMask_t AllLEDMask  = (LEDBitMask_t)~0;
00122   
00123   enum ButtonOffset_t { };
00124   
00125   const char* const buttonNames[NumButtons + 1] = { NULL };
00126   
00127   enum SensorOffset_t { };
00128   
00129   const char* const sensorNames[NumSensors + 1] = { NULL };
00130   
00131   //! Names for each of the outputs
00132   const char* const outputNames[NumOutputs] = {
00133     "WHEEL:L",
00134     "WHEEL:R",
00135     "Arm:Base","Arm:Shldr","Arm:Elbow","Arm:Yaw","Arm:Roll","Arm:Grpr",
00136     "GNk:Pan","GNk:Shldr","GNk:Elbow","GNk:Pitch",
00137   };
00138 
00139   //! provides polymorphic robot capability detection/mapping
00140   class Regis1Capabilities : public Capabilities {
00141   public:
00142     //! constructor
00143     Regis1Capabilities()
00144     : Capabilities(TargetName,NumOutputs,outputNames,NumButtons,buttonNames,NumSensors,sensorNames,PIDJointOffset,NumPIDJoints,LEDOffset,NumLEDs)
00145     {
00146       // alias neck joints
00147       outputToIndex["NECK:tilt"]=HeadTiltOffset;
00148       outputToIndex["NECK:pan"]=HeadPanOffset;
00149       outputToIndex["NECK:nod"]=HeadNodOffset;
00150     }
00151   };
00152   //! allocation declared in RobotInfo.cc
00153   extern Regis1Capabilities capabilities;
00154   
00155   const float DefaultPIDs[NumPIDJoints][3] = {
00156     {1,0,0},
00157     {1,0,0},
00158     {1,0,0},{1,0,0},{1,0,0},{1,0,0},{1,0,0},{1,0,0},
00159     {1,0,0},{1,0,0},{1,0,0},{1,0,0}
00160   };
00161   
00162   //! haven't determined safe speeds for regis yet
00163   const float MaxOutputSpeed[NumOutputs] = {
00164     1e-3,
00165     1e-3,
00166     1e-3,1e-3,1e-3,1e-3,1e-3,1e-3,
00167     1e-3,1e-3,1e-3,1e-3
00168   };
00169   
00170   #ifndef RAD
00171     //!Just a little macro for converting degrees to radians
00172   #define RAD(deg) (((deg) * M_PI ) / 180.0)
00173     //!a flag so we undef these after we're done - do you have a cleaner solution?
00174   #define __RI_RAD_FLAG
00175   #endif
00176   
00177   //! the range that can be reached by the joint controller (i.e. the domain of the output commands)
00178   const double outputRanges[NumOutputs][2] = {
00179       { -1 , 1 },//Wheels
00180       { -1 , 1 },
00181       { RAD(-90),RAD(90) },{ RAD(-90),RAD(90) },{ RAD(-90),RAD(90) },{ RAD(-90),RAD(90) },{ RAD(-90),RAD(90) },{ RAD(-90),RAD(90) }, //Arm
00182       { RAD(-100),RAD(100) },{ RAD(-10.0),RAD(190.0) },{ RAD(-140),RAD(60) },{ RAD(-150),RAD(50) }//Goose Neck
00183   };
00184   
00185   //! the range that can be reached by external interaction (i.e. the domain of the output feedback)
00186   /*! This is probably identical to #outputRanges, but may differ if the outputs have some built-in safety margin... */
00187   const double mechanicalLimits[NumOutputs][2] = {
00188       { -1 , 1 },//Wheels
00189       { -1 , 1 },
00190       { RAD(-90),RAD(90) },{ RAD(-90),RAD(90) },{ RAD(-90),RAD(90) },{ RAD(-90),RAD(90) },{ RAD(-90),RAD(90) },{ RAD(-90),RAD(90) }, //Arm
00191       { RAD(-100),RAD(100) },{ RAD(-10.0),RAD(190.0) },{ RAD(-140),RAD(60) },{ RAD(-150),RAD(50) }//Goose Neck
00192   };
00193 
00194     
00195 #ifdef __RI_RAD_FLAG
00196 #undef RAD
00197 #undef __RI_RAD_FLAG
00198 #endif
00199 }
00200 
00201 #endif

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