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_WEBCAM 1
00014 #  define TGT_HAS_WHEELS 4
00015 #  define TGT_HAS_LEDS 10
00016 #endif
00017 
00018 //! Declares configuration of the generic Qwerk target, such as number of joints, LEDs, etc.
00019 namespace QwerkInfo {
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=25;        //!< 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      =  4;
00033   
00034   const unsigned JointsPerArm   =  0;
00035   const unsigned NumArms        =  0;
00036   const unsigned NumArmJoints   =  JointsPerArm*NumArms;
00037   
00038   const unsigned JointsPerLeg   =  0; //!< The number of joints per leg
00039   const unsigned NumLegs        =  0; //!< The number of legs
00040   const unsigned NumLegJoints   =  JointsPerLeg*NumLegs; //!< the TOTAL number of joints on ALL legs
00041   const unsigned NumHeadJoints  =  0; //!< The number of joints in the pantilt
00042   const unsigned NumTailJoints  =  0; //!< The number of joints assigned to the tail
00043   const unsigned NumMouthJoints =  0; //!< the number of joints that control the mouth
00044   const unsigned NumEarJoints   =  0; //!< The number of joints which control the ears (NOT per ear, is total)
00045   const unsigned NumButtons     =  4; //!< the number of buttons that are available
00046   const unsigned NumSensors     =  17;  //!< the number of sensors available
00047   const unsigned NumLEDs        =  10; //!< The number of LEDs which can be controlled
00048   const unsigned NumFacePanelLEDs = 0; //!< The number of face panel LEDs
00049   
00050   const unsigned NumPIDJoints   = NumWheels + NumArmJoints + NumLegJoints+NumHeadJoints+NumTailJoints+NumMouthJoints;; //!< servo pins
00051   const unsigned NumOutputs     = NumWheels + 16 + NumLEDs; //!< the total number of outputs
00052   const unsigned NumReferenceFrames = NumOutputs + 1 + NumArms; //!< for the base, gripper (* NumArms)
00053 
00054   using namespace CameraGeneric60;
00055   //@}
00056 
00057 
00058   // *******************************
00059   //         OUTPUT OFFSETS
00060   // *******************************
00061 
00062   //!Corresponds to entries in ERS7Info::PrimitiveName, defined at the end of this file
00063   //!@name Output Offsets
00064 
00065   
00066   const unsigned PIDJointOffset = 0; //!< The beginning of the PID Joints
00067   const unsigned WheelOffset = PIDJointOffset;
00068 
00069   const unsigned LEDOffset   = PIDJointOffset + NumPIDJoints; //!< the offset of LEDs in WorldState::outputs and MotionCommand functions, see LedOffset_t for specific offsets
00070 
00071   const unsigned BaseFrameOffset   = NumOutputs; //!< Use with kinematics to refer to base reference frame
00072 
00073   enum WheelOffset_t {
00074     LWheelOffset=WheelOffset,
00075     RWheelOffset
00076   };
00077   
00078   //! The offsets of the individual LEDs -- except the qwerk board doesn't have any particularly symbolic LEDs, just use numeric values...
00079   /*! @hideinitializer */
00080   enum LEDOffset_t { };
00081   
00082   typedef unsigned int LEDBitMask_t; //!< So you can be clear when you're refering to a LED bitmask
00083   //! LEDs for the face panel (all FaceLEDPanelMask<<(0:NumFacePanelLEDs-1) entries)
00084   const LEDBitMask_t FaceLEDMask = 0;
00085   //! selects all of the leds
00086   const LEDBitMask_t AllLEDMask  = (LEDBitMask_t)~0;
00087   //@}
00088 
00089 
00090   // *******************************
00091   //          INPUT OFFSETS
00092   // *******************************
00093 
00094 
00095   //! The order in which inputs should be stored
00096   //!@name Input Offsets
00097 
00098   //! holds offsets to different buttons in WorldState::buttons[]
00099   /*! Should be a straight mapping to the ButtonSourceIDs
00100    *
00101    *  Note that the chest (power) button is not a normal button.  It kills
00102    *  power to the motors at a hardware level, and isn't sensed in the
00103    *  normal way.  If you want to know when it is pressed (and you are
00104    *  about to shut down) see PowerSrcID::PauseSID.
00105    *
00106    *  @see WorldState::buttons @see ButtonSourceID_t
00107    * @hideinitializer */
00108   enum ButtonOffset_t { Button0, Button1, Button2, Button3 };
00109 
00110   //! Provides a string name for each button
00111   const char* const buttonNames[NumButtons+1] = { "Button0", "Button1", "Button2", "Button3", NULL }; // non-empty array to avoid gcc 3.4.2 internal error
00112 
00113   //! holds offset to different sensor values in WorldState::sensors[]
00114   /*! @see WorldState::sensors[] */
00115   enum SensorOffset_t { AnalogInValues0, AnalogInValues1, 
00116                         AnalogInValues2, AnalogInValues3, 
00117                         AnalogInValues4, AnalogInValues5, 
00118                         AnalogInValues6, AnalogInValues7, 
00119                         DigitalInStates0, DigitalInStates1, 
00120                         DigitalInStates2, DigitalInStates3, 
00121                         DigitalInStates4, DigitalInStates5, 
00122                         DigitalInStates6, DigitalInStates7, 
00123                         BatteryVoltage };
00124 
00125   //! Provides a string name for each sensor
00126   const char* const sensorNames[NumSensors] = { 
00127     "analogInValues0",
00128     "analogInValues1",
00129     "analogInValues2",
00130     "analogInValues3",
00131     "analogInValues4",
00132     "analogInValues5",
00133     "analogInValues6",
00134     "analogInValues7",
00135     "digitalInStates0",
00136     "digitalInStates1",
00137     "digitalInStates2",
00138     "digitalInStates3",
00139     "digitalInStates4",
00140     "digitalInStates5",
00141     "digitalInStates6",
00142     "digitalInStates7",
00143     "BatteryVoltage"
00144   };
00145 
00146   //@}
00147 
00148 
00149   //! Names for each of the outputs
00150   const char* const outputNames[NumReferenceFrames+1] = {
00151     "WHEEL:000",
00152     "WHEEL:001",
00153     "WHEEL:002",
00154     "WHEEL:003",
00155     "SERVO:000",
00156     "SERVO:001",
00157     "SERVO:002",
00158     "SERVO:003",
00159     "SERVO:004",
00160     "SERVO:005",
00161     "SERVO:006",
00162     "SERVO:007",
00163     "SERVO:008",
00164     "SERVO:009",
00165     "SERVO:010",
00166     "SERVO:011",
00167     "SERVO:012",
00168     "SERVO:013",
00169     "SERVO:014",
00170     "SERVO:015",
00171     "LED:00000",
00172     "LED:00001",
00173     "LED:00002",
00174     "LED:00003",
00175     "LED:00004",
00176     "LED:00005",
00177     "LED:00006",
00178     "LED:00007",
00179     "LED:00008",
00180     "LED:00009",
00181     
00182     "BaseFrame",
00183     NULL
00184   };
00185   
00186   //! allocation declared in RobotInfo.cc
00187   extern const Capabilities capabilities;
00188   
00189   //! This table holds the default PID values for each joint.  see PIDMC
00190   const float DefaultPIDs[NumPIDJoints+1][3] = { {0,0,0} };
00191   
00192   //!These values are our recommended maximum joint velocities, in rad/ms
00193   /*! a value <= 0 means infinite speed (e.g. LEDs)
00194    *  
00195    *  These limits are <b>not</b> enforced by the framework.  They are simply available for you to use as you see fit.
00196    *  HeadPointerMC and PostureMC are primary examples of included classes which do respect these values (although they can be overridden)
00197    *  
00198    *  These values were obtained from the administrators of the Sony OPEN-R BBS */
00199   const float MaxOutputSpeed[NumOutputs] = {
00200     1.f, //Wheels: left, right
00201     1.f,
00202     3.14f, // Neck: tilt, pan
00203     6.28f,
00204 
00205     0,0,0,0,0,0,0,0,0,0 // LED
00206   };
00207 
00208   #ifndef RAD
00209     //!Just a little macro for converting degrees to radians
00210   #define RAD(deg) (((deg) * (float)M_PI ) / 180.0f)
00211     //!a flag so we undef these after we're done - do you have a cleaner solution?
00212   #define __RI_RAD_FLAG
00213   #endif
00214   
00215   //! 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)
00216   const float outputRanges[NumOutputs][2] =
00217     {
00218       { -1 , 1 },
00219       { -1 , 1 },
00220       { RAD(-90) , RAD(90) },
00221       { RAD(-90) , RAD(90) },
00222 
00223       // LED
00224       {0,1}, {0,1}, {0,1}, {0,1}, {0,1},
00225       {0,1}, {0,1}, {0,1}, {0,1}, {0,1}
00226     };
00227 
00228   //! 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)
00229   /*! Same as #outputRanges, don't know actual values because they were never specified by Sony */
00230   const float mechanicalLimits[NumOutputs][2] =
00231     {
00232       { -1 , 1 },
00233       { -1 , 1 },
00234       { RAD(-90) , RAD(90) },
00235       { RAD(-90) , RAD(90) },
00236 
00237       // LED
00238       {0,1}, {0,1}, {0,1}, {0,1}, {0,1},
00239       {0,1}, {0,1}, {0,1}, {0,1}, {0,1}
00240     };
00241 
00242 #ifdef __RI_RAD_FLAG
00243 #undef RAD
00244 #undef __RI_RAD_FLAG
00245 #endif
00246 }
00247 
00248 /*! @file
00249  * @brief Defines some capabilities of a generic "Qwerk" based robot
00250  * @author ejt (Creator)
00251  */
00252 
00253 #endif

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