Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

TentacleInfo.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_TentacleInfo_h
00003 #define INCLUDED_TentacleInfo_h
00004 
00005 #include <cmath>
00006 #include <stdlib.h>
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_TENTACLE)
00012 #  define TGT_IS_BIOLOID
00013 #  define TGT_IS_TENTACLE
00014 #  define TGT_HAS_CAMERA 1
00015 #  define TGT_HAS_ARMS 1
00016 #  define TGT_HAS_HEAD 1
00017 #  define TGT_HAS_LEDS 10
00018 #endif
00019 
00020 //! Declares configuration of the tentacle planar arm, such as number of joints, LEDs, etc.
00021 namespace TentacleInfo {
00022 
00023   // *******************************
00024   //       ROBOT CONFIGURATION
00025   // *******************************
00026 
00027   extern const char* const TargetName; //!< the name of the model, to be used for logging and remote GUIs
00028 
00029   const unsigned int FrameTime=32;        //!< time between frames in the motion system (milliseconds)
00030   const unsigned int NumFrames=1;        //!< the number of frames per buffer (don't forget also double buffered)
00031   const unsigned int SoundBufferTime=32; //!< the number of milliseconds per sound buffer... I'm not sure if this can be changed
00032   
00033   //!@name Output Types Information
00034   const unsigned NumWheels      =  0;
00035   
00036   const unsigned JointsPerArm   =  8;
00037   const unsigned NumArms        =  1;
00038   const unsigned NumArmJoints   =  JointsPerArm*NumArms;
00039   
00040   const unsigned JointsPerLeg   =  0; //!< The number of joints per leg
00041   const unsigned NumLegs        =  0; //!< The number of legs
00042   const unsigned NumLegJoints   =  JointsPerLeg*NumLegs; //!< the TOTAL number of joints on ALL legs
00043   const unsigned NumHeadJoints  =  2; //!< The number of joints in the pantilt
00044   const unsigned NumTailJoints  =  0; //!< The number of joints assigned to the tail
00045   const unsigned NumMouthJoints =  0; //!< the number of joints that control the mouth
00046   const unsigned NumEarJoints   =  0; //!< The number of joints which control the ears (NOT per ear, is total)
00047   const unsigned NumButtons     =  0; //!< the number of buttons that are available
00048   const unsigned NumSensors     =  0;  //!< the number of sensors available
00049   const unsigned NumFacePanelLEDs = 0; //!< The number of face panel LEDs
00050 
00051   const unsigned NumPIDJoints   = NumArmJoints + NumLegJoints+NumHeadJoints+NumTailJoints+NumMouthJoints;; //!< servo pins
00052   const unsigned NumLEDs        =  NumPIDJoints; //!< The number of LEDs which can be controlled (one per dynamixel servo)
00053   
00054   const unsigned NumOutputs     = NumWheels + NumPIDJoints + NumLEDs; //!< the total number of outputs
00055   const unsigned NumReferenceFrames = NumOutputs + 1 + NumArms + 1; //!< for the base, gripper (* NumArms), and camera reference frames
00056 
00057   using namespace Camera75DOF;
00058   //@}
00059 
00060 
00061   // *******************************
00062   //         OUTPUT OFFSETS
00063   // *******************************
00064 
00065   //!Corresponds to entries in ERS7Info::PrimitiveName, defined at the end of this file
00066   //!@name Output Offsets
00067 
00068   
00069   const unsigned PIDJointOffset = 0; //!< The beginning of the PID Joints
00070   const unsigned ArmOffset  = PIDJointOffset;   //!< the offset of the beginning of the arm joints
00071 
00072   const unsigned HeadOffset = ArmOffset + NumArmJoints; //!< the offset of the beginning of the head joints, add TPROffset_t to get specific joint
00073 
00074   const unsigned LEDOffset   = PIDJointOffset + NumPIDJoints; //!< the offset of LEDs in WorldState::outputs and MotionCommand functions, see LedOffset_t for specific offsets
00075 
00076   const unsigned BaseFrameOffset   = NumOutputs; //!< Use with kinematics to refer to base reference frame
00077   const unsigned GripperFrameOffset= BaseFrameOffset+1; //!< Use with kinematics to refer to paw reference frames (add appropriate LegOrder_t to specify which paw)
00078   const unsigned CameraFrameOffset = GripperFrameOffset+1;
00079   
00080     
00081   //! The offsets of appendages with pan (heading), tilt (elevation), note that this should be added to HeadOffset, otherwise use HeadOffset_t (#HeadPanOffset and #HeadTiltOffset)
00082   enum TPROffset_t {
00083     PanOffset = 0,      //!< pan/heading (horizontal)
00084     TiltOffset, //!< tilt/elevation (vertical)
00085   };
00086   
00087   //! These are 'absolute' offsets for the neck joints, don't need to add to HeadOffset like TPROffset_t values do
00088   enum HeadOffset_t {
00089     HeadPanOffset = HeadOffset,      //!< pan/heading (horizontal)
00090     HeadTiltOffset, //!< tilt/elevation (vertical)
00091   };
00092   
00093   //! The offsets of the individual LEDs -- except we don't have any idea what to 'name' the servos in a reconfigurable kit, so this is empty (just add numeric offsets)
00094   /*! @hideinitializer */
00095   enum LEDOffset_t { };
00096 
00097   typedef unsigned int LEDBitMask_t; //!< So you can be clear when you're refering to a LED bitmask
00098   //! LEDs for the face panel (all FaceLEDPanelMask<<(0:NumFacePanelLEDs-1) entries)
00099   const LEDBitMask_t FaceLEDMask = 0;
00100   //! selects all of the leds
00101   const LEDBitMask_t AllLEDMask  = (LEDBitMask_t)~0;
00102   //@}
00103 
00104 
00105   // *******************************
00106   //          INPUT OFFSETS
00107   // *******************************
00108 
00109 
00110   //! The order in which inputs should be stored
00111   //!@name Input Offsets
00112 
00113   //! holds offsets to different buttons in WorldState::buttons[]
00114   /*! Should be a straight mapping to the ButtonSourceIDs
00115    *
00116    *  Note that the chest (power) button is not a normal button.  It kills
00117    *  power to the motors at a hardware level, and isn't sensed in the
00118    *  normal way.  If you want to know when it is pressed (and you are
00119    *  about to shut down) see PowerSrcID::PauseSID.
00120    *
00121    *  @see WorldState::buttons @see ButtonSourceID_t
00122    * @hideinitializer */
00123   enum ButtonOffset_t { };
00124 
00125   //! Provides a string name for each button
00126   const char* const buttonNames[NumButtons+1] = { NULL }; // non-empty array to avoid gcc 3.4.2 internal error
00127 
00128   //! holds offset to different sensor values in WorldState::sensors[]
00129   /*! @see WorldState::sensors[] */
00130   enum SensorOffset_t { };
00131 
00132   //! Provides a string name for each sensor
00133   const char* const sensorNames[NumSensors+1] = { NULL }; // non-empty array to avoid gcc 3.4.2 internal error
00134 
00135   //@}
00136 
00137 
00138   //! Names for each of the outputs
00139   const char* const outputNames[NumReferenceFrames] = {
00140     "ARM:0", "ARM:1", "ARM:2", "ARM:3", "ARM:4", "ARM:5", "ARM:6", "ARM:7", "NECK:pan", "NECK:tilt",
00141     "LED:0", "LED:1", "LED:2", "LED:3", "LED:4", "LED:5", "LED:6", "LED:7", "LED:pan", "LED:tilt", 
00142     "BaseFrame", "GripperFrame", "CameraFrame"
00143   };
00144   
00145   //! allocation declared in RobotInfo.cc
00146   extern const Capabilities capabilities;
00147   
00148   //! Dynamixel servos don't use PID control.  Instead, these values indicate compliance slope (P), punch (add to P*error), compliance margin (min error to start applying torque) (see ServoParam_t)
00149   /*! I believe the torque calculation goes something like: torque = (error<compliance) ? 0 : punch + P*error
00150    *  Dynamixel servos allow different values to be supplied for CW vs. CCW motion, but we just use the same value for each */
00151   const float DefaultPIDs[NumPIDJoints][3] = {
00152     {32,32,0}, {32,32,0}, {32,32,0}, {32,32,0},
00153     {32,32,0}, {32,32,0}, {32,32,0}, {32,32,0}, {32,32,0}, {32,32,0}
00154   };
00155   
00156   //!These values are our recommended maximum joint velocities, in rad/sec
00157   /*! a value <= 0 means infinite speed (e.g. LEDs)
00158    *  
00159    *  These limits are <b>not</b> enforced by the framework.  They are simply available for you to use as you see fit.
00160    *  HeadPointerMC and PostureMC are primary examples of included classes which do respect these values (although they can be overridden)
00161    *  
00162    *  These values were obtained from the administrators of the Sony OPEN-R BBS */
00163   const float MaxOutputSpeed[NumOutputs] = {
00164     // servos
00165     0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f,
00166     // leds
00167     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
00168   };
00169 
00170   #ifndef RAD
00171     //!Just a little macro for converting degrees to radians
00172   #define RAD(deg) (((deg) * (float)M_PI ) / 180.0f)
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   //! This table holds the software limits of each of the outputs, first index is the output offset, second index is MinMaxRange_t (i.e. MinRange or MaxRange)
00178   const float outputRanges[NumOutputs][2] = {
00179     // servos
00180     {-RAD(90),RAD(90)}, {-RAD(90),RAD(90)}, {-RAD(90),RAD(90)}, {-RAD(90),RAD(90)},
00181     {-RAD(90),RAD(90)}, {-RAD(90),RAD(90)}, {-RAD(90),RAD(90)}, {-RAD(90),RAD(90)},
00182     {-RAD(150),RAD(150)}, {-RAD(90),RAD(90)},
00183 
00184     // LED
00185     {0,1}, {0,1}, {0,1}, {0,1},
00186     {0,1}, {0,1}, {0,1}, {0,1},
00187     {0,1}, {0,1},
00188   };
00189 
00190   //! This table holds the mechanical limits of each of the outputs, first index is the output offset, second index is MinMaxRange_t (i.e. MinRange or MaxRange)
00191   /*! Same as #outputRanges, don't know actual values because they were never specified by Sony */
00192   const float mechanicalLimits[NumOutputs][2] = {
00193     // servos
00194     {-RAD(90),RAD(90)}, {-RAD(90),RAD(90)}, {-RAD(90),RAD(90)}, {-RAD(90),RAD(90)},
00195     {-RAD(90),RAD(90)}, {-RAD(90),RAD(90)}, {-RAD(90),RAD(90)}, {-RAD(90),RAD(90)},
00196     {-RAD(150),RAD(150)},{-RAD(90),RAD(90)},
00197     
00198     // LED
00199     {0,1}, {0,1}, {0,1}, {0,1},
00200     {0,1}, {0,1}, {0,1}, {0,1},
00201     {0,1}, {0,1},
00202   };
00203 
00204 #ifdef __RI_RAD_FLAG
00205 #undef RAD
00206 #undef __RI_RAD_FLAG
00207 #endif
00208 }
00209 
00210 /*! @file
00211  * @brief Defines some capabilities of the tentacle planar arm
00212  * @author ejt (Creator)
00213  */
00214 
00215 #endif
00216 

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