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

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:50 2016 by Doxygen 1.6.3