Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

QwerkInfo.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_QwerkInfo_h
00003 #define INCLUDED_QwerkInfo_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_QWERK)
00012 #  define TGT_IS_QWERK
00013 #  define TGT_HAS_WHEELS 4
00014 #  define TGT_HAS_LEDS 10
00015 #endif
00016 
00017 namespace QwerkInfo {
00018 
00019   // *******************************
00020   //       ROBOT CONFIGURATION
00021   // *******************************
00022 
00023   extern const char* const TargetName; //!< the name of the model, to be used for logging and remote GUIs
00024 
00025   const unsigned int FrameTime=15;        //!< time between frames in the motion system (milliseconds)
00026   const unsigned int NumFrames=1;        //!< the number of frames per buffer (don't forget also double buffered)
00027   const unsigned int SoundBufferTime=32; //!< the number of milliseconds per sound buffer... I'm not sure if this can be changed
00028   
00029   //!@name Output Types Information
00030   const unsigned NumWheels      =  4;
00031   
00032   const unsigned JointsPerArm   =  0;
00033   const unsigned NumArms        =  0;
00034   const unsigned NumArmJoints   =  JointsPerArm*NumArms;
00035   
00036   const unsigned JointsPerLeg   =  0; //!< The number of joints per leg
00037   const unsigned NumLegs        =  0; //!< The number of legs
00038   const unsigned NumLegJoints   =  JointsPerLeg*NumLegs; //!< the TOTAL number of joints on ALL legs
00039   const unsigned NumHeadJoints  =  0; //!< The number of joints in the pantilt
00040   const unsigned NumTailJoints  =  0; //!< The number of joints assigned to the tail
00041   const unsigned NumMouthJoints =  0; //!< the number of joints that control the mouth
00042   const unsigned NumEarJoints   =  0; //!< The number of joints which control the ears (NOT per ear, is total)
00043   const unsigned NumButtons     =  0; //!< the number of buttons that are available
00044   const unsigned NumSensors     =  9;  //!< the number of sensors available
00045   const unsigned NumLEDs        =  10; //!< The number of LEDs which can be controlled
00046   const unsigned NumFacePanelLEDs = 0; //!< The number of face panel LEDs
00047   
00048   const unsigned NumPIDJoints   = NumWheels + NumArmJoints + NumLegJoints+NumHeadJoints+NumTailJoints+NumMouthJoints;; //!< servo pins
00049   const unsigned NumOutputs     = NumWheels + 16 + NumLEDs; //!< the total number of outputs
00050   const unsigned NumReferenceFrames = NumOutputs + 1 + NumArms + 1; //!< for the base, gripper (* NumArms), and camera reference frames
00051 
00052   // webcam ?
00053   const float CameraHorizFOV=56.9/180*M_PI; //!< horizontal field of view (radians)
00054   const float CameraVertFOV=45.2/180*M_PI; //!< vertical field of view (radians)
00055   const float CameraFOV=CameraHorizFOV; //!< should be set to maximum of #CameraHorizFOV or #CameraVertFOV
00056   const unsigned int CameraResolutionX=320; //!< the number of pixels available in the 'full' layer
00057   const unsigned int CameraResolutionY=240; //!< the number of pixels available in the 'full' layer
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 WheelOffset = PIDJointOffset;
00071 
00072   const unsigned LEDOffset   = PIDJointOffset + NumPIDJoints; //!< the offset of LEDs in WorldState::outputs and MotionCommand functions, see LedOffset_t for specific offsets
00073 
00074   const unsigned BaseFrameOffset   = NumOutputs; //!< Use with kinematics to refer to base reference frame
00075 
00076   enum WheelOffset_t {
00077     LWheelOffset=WheelOffset,
00078     RWheelOffset
00079   };
00080   
00081   //! The offsets of the individual LEDs -- except the qwerk board doesn't have any particularly symbolic LEDs, just use numeric values...
00082   /*! @hideinitializer */
00083   enum LEDOffset_t { };
00084   
00085   typedef unsigned int LEDBitMask_t; //!< So you can be clear when you're refering to a LED bitmask
00086   //! LEDs for the face panel (all FaceLEDPanelMask<<(0:NumFacePanelLEDs-1) entries)
00087   const LEDBitMask_t FaceLEDMask = 0;
00088   //! selects all of the leds
00089   const LEDBitMask_t AllLEDMask  = (LEDBitMask_t)~0;
00090   //@}
00091 
00092 
00093   // *******************************
00094   //          INPUT OFFSETS
00095   // *******************************
00096 
00097 
00098   //! The order in which inputs should be stored
00099   //!@name Input Offsets
00100 
00101   //! holds offsets to different buttons in WorldState::buttons[]
00102   /*! Should be a straight mapping to the ButtonSourceIDs
00103    *
00104    *  Note that the chest (power) button is not a normal button.  It kills
00105    *  power to the motors at a hardware level, and isn't sensed in the
00106    *  normal way.  If you want to know when it is pressed (and you are
00107    *  about to shut down) see PowerSrcID::PauseSID.
00108    *
00109    *  @see WorldState::buttons @see ButtonSourceID_t
00110    * @hideinitializer */
00111   enum ButtonOffset_t { };
00112 
00113   //! Provides a string name for each button
00114   const char* const buttonNames[NumButtons+1] = { NULL }; // non-empty array to avoid gcc 3.4.2 internal error
00115 
00116   //! holds offset to different sensor values in WorldState::sensors[]
00117   /*! @see WorldState::sensors[] */
00118   enum SensorOffset_t { BatteryVoltage };
00119 
00120   //! Provides a string name for each sensor
00121   const char* const sensorNames[NumSensors] = { 
00122     "BatteryVoltage",
00123     "AnalogIn0",
00124     "AnalogIn1",
00125     "AnalogIn2",
00126     "AnalogIn3",
00127     "AnalogIn4",
00128     "AnalogIn5",
00129     "AnalogIn6",
00130     "AnalogIn7",
00131   };
00132 
00133   //@}
00134 
00135 
00136   //! Names for each of the outputs
00137   const char* const outputNames[NumOutputs] = {
00138     "WHEEL:000",
00139     "WHEEL:001",
00140     "WHEEL:002",
00141     "WHEEL:003",
00142     "SERVO:000",
00143     "SERVO:001",
00144     "SERVO:002",
00145     "SERVO:003",
00146     "SERVO:004",
00147     "SERVO:005",
00148     "SERVO:006",
00149     "SERVO:007",
00150     "SERVO:008",
00151     "SERVO:009",
00152     "SERVO:010",
00153     "SERVO:011",
00154     "SERVO:012",
00155     "SERVO:013",
00156     "SERVO:014",
00157     "SERVO:015",
00158     "LED:00000",
00159     "LED:00001",
00160     "LED:00002",
00161     "LED:00003",
00162     "LED:00004",
00163     "LED:00005",
00164     "LED:00006",
00165     "LED:00007",
00166     "LED:00008",
00167     "LED:00009"
00168   };
00169   
00170   //! allocation declared in RobotInfo.cc
00171   extern Capabilities capabilities;
00172   
00173   //! This table holds the default PID values for each joint.  see PIDMC
00174   const float DefaultPIDs[NumPIDJoints+1][3] = { {0,0,0} };
00175   
00176   //!These values are our recommended maximum joint velocities, in rad/ms
00177   /*! a value <= 0 means infinite speed (e.g. LEDs)
00178    *  
00179    *  These limits are <b>not</b> enforced by the framework.  They are simply available for you to use as you see fit.
00180    *  HeadPointerMC and PostureMC are primary examples of included classes which do respect these values (although they can be overridden)
00181    *  
00182    *  These values were obtained from the administrators of the Sony OPEN-R BBS */
00183   const float MaxOutputSpeed[NumOutputs] = {
00184     1e-3, //Wheels: left, right
00185     1e-3,
00186     3.14e-3, // Neck: tilt, pan
00187     6.28e-3,
00188 
00189     0,0,0,0,0,0,0,0,0,0 // LED
00190   };
00191 
00192   #ifndef RAD
00193     //!Just a little macro for converting degrees to radians
00194   #define RAD(deg) (((deg) * M_PI ) / 180.0)
00195     //!a flag so we undef these after we're done - do you have a cleaner solution?
00196   #define __RI_RAD_FLAG
00197   #endif
00198   
00199   //! 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)
00200   const double outputRanges[NumOutputs][2] =
00201     {
00202       { -1 , 1 },
00203       { -1 , 1 },
00204       { RAD(-90) , RAD(90) },
00205       { RAD(-90) , RAD(90) },
00206 
00207       // LED
00208       {0,1}, {0,1}, {0,1}, {0,1}, {0,1},
00209       {0,1}, {0,1}, {0,1}, {0,1}, {0,1}
00210     };
00211 
00212   //! 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)
00213   /*! Same as #outputRanges, don't know actual values because they were never specified by Sony */
00214   const double mechanicalLimits[NumOutputs][2] =
00215     {
00216       { -1 , 1 },
00217       { -1 , 1 },
00218       { RAD(-90) , RAD(90) },
00219       { RAD(-90) , RAD(90) },
00220 
00221       // LED
00222       {0,1}, {0,1}, {0,1}, {0,1}, {0,1},
00223       {0,1}, {0,1}, {0,1}, {0,1}, {0,1}
00224     };
00225 
00226 #ifdef __RI_RAD_FLAG
00227 #undef RAD
00228 #undef __RI_RAD_FLAG
00229 #endif
00230 }
00231 
00232 #endif

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