Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

WiiMoteInfo.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_WiiMoteInfo_h
00003 #define INCLUDED_WiiMoteInfo_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_WIIMOTE)
00012 #  define TGT_HAS_LEDS 2
00013 #endif
00014 
00015 //! Contains information about the WiiMote remote control
00016 namespace WiiMoteInfo {
00017   
00018   // *******************************
00019   //       ROBOT CONFIGURATION
00020   // *******************************
00021 
00022   extern const char* const TargetName; //!< the name of the model, to be used for logging and remote GUIs
00023 
00024   const unsigned int FrameTime=15;        //!< time between frames in the motion system (milliseconds)
00025   const unsigned int NumFrames=1;        //!< the number of frames per buffer (don't forget also double buffered)
00026   const unsigned int SoundBufferTime=32; //!< the number of milliseconds per sound buffer... I'm not sure if this can be changed
00027   
00028   //!@name Output Types Information
00029   const unsigned NumWheels      =  0;
00030   
00031   const unsigned JointsPerArm   =  0;
00032   const unsigned NumArms        =  0;
00033   const unsigned NumArmJoints   =  0;
00034   
00035   const unsigned JointsPerLeg   =  0; //!< The number of joints per leg
00036   const unsigned NumLegs        =  0; //!< The number of legs
00037   const unsigned NumLegJoints   =  0;
00038   const unsigned NumHeadJoints  =  0; //!< The number of joints in the neck
00039   const unsigned NumTailJoints  =  0; //!< The number of joints assigned to the tail
00040   const unsigned NumMouthJoints =  0; //!< the number of joints that control the mouth
00041   const unsigned NumEarJoints   =  0; //!< The number of joints which control the ears (NOT per ear, is total)
00042   const unsigned NumButtons     =  11; //!< the number of buttons that are available, 2 head, 4 paws, 3 back, 1 underbelly see ERS7Info::ButtonOffset_t
00043   const unsigned NumSensors     =  3;  //!< the number of sensors available
00044   const unsigned NumLEDs        =  4; //!< The number of LEDs which can be controlled
00045   const unsigned NumFacePanelLEDs = 0; //!< The number of face panel LEDs
00046   
00047   const unsigned NumPIDJoints   = NumWheels; //!< servo pins
00048   const unsigned NumOutputs     = NumWheels + NumLEDs; //!< the total number of outputs
00049   const unsigned NumReferenceFrames = NumOutputs + 1 + NumArms; //!< for the base, gripper (* NumArms)
00050 
00051   // webcam ?
00052   const float CameraHorizFOV=0;
00053   const float CameraVertFOV=0;
00054   const float CameraFOV=0;
00055   const unsigned int CameraResolutionX=0;
00056   const unsigned int CameraResolutionY=0;
00057   //@}
00058 
00059 
00060   // *******************************
00061   //         OUTPUT OFFSETS
00062   // *******************************
00063 
00064   //!Corresponds to entries in ERS7Info::PrimitiveName, defined at the end of this file
00065   //!@name Output Offsets
00066 
00067   
00068   const unsigned PIDJointOffset = 0; //!< The beginning of the PID Joints
00069   const unsigned WheelOffset = PIDJointOffset;
00070 
00071   const unsigned LEDOffset   = WheelOffset+NumWheels;
00072   
00073   const unsigned MODE_OFFSET = LEDOffset + NumLEDs;
00074   const unsigned DEMO_OFFSET = MODE_OFFSET+1;
00075 
00076   const unsigned BaseFrameOffset   = NumOutputs; //!< Use with kinematics to refer to base reference frame
00077 
00078   enum WheelOffset_t { };
00079   
00080   //! The offsets of the individual LEDs on the head and tail.  Note that left/right are robot's point of view.  See also LEDBitMask_t
00081   /*! @hideinitializer */
00082   enum LEDOffset_t {
00083     LED0_Offset=LEDOffset,
00084     LED1_Offset,
00085     LED2_Offset,
00086     LED3_Offset
00087   };
00088   
00089   typedef unsigned int LEDBitMask_t; //!< So you can be clear when you're refering to a LED bitmask
00090   //! LEDs for the face panel (all FaceLEDPanelMask<<(0:NumFacePanelLEDs-1) entries)
00091   const LEDBitMask_t FaceLEDMask = 0;
00092   //! selects all of the leds
00093   const LEDBitMask_t AllLEDMask  = (LEDBitMask_t)~0;
00094   //@}
00095 
00096   enum InterfaceMode_t {
00097   };
00098 
00099   // *******************************
00100   //          INPUT OFFSETS
00101   // *******************************
00102 
00103 
00104   //! The order in which inputs should be stored
00105   //!@name Input Offsets
00106 
00107   //! holds offsets to different buttons in WorldState::buttons[]
00108   /*! Should be a straight mapping to the ButtonSourceIDs
00109    *
00110    *  @see WorldState::buttons
00111    * @hideinitializer */
00112   enum ButtonOffset_t {
00113     BUTTON_2,
00114     BUTTON_1,
00115     BUTTON_B,
00116     BUTTON_A,
00117     BUTTON_MINUS,
00118     BUTTON_HOME,
00119     BUTTON_LEFT,
00120     BUTTON_RIGHT,
00121     BUTTON_DOWN,
00122     BUTTON_UP,
00123     BUTTON_PLUS
00124   };
00125 
00126   //! Provides a string name for each button
00127   const char* const buttonNames[NumButtons+1] = 
00128     { "button 2", 
00129       "button 1", 
00130       "button B", 
00131       "button A", 
00132       "button minus", 
00133       "button home", 
00134       "button left", 
00135       "button right", 
00136       "button down", 
00137       "button up", 
00138       "button pus", 
00139       NULL
00140     }; // non-empty array to avoid gcc 3.4.2 internal error
00141 
00142   //! holds offset to different sensor values in WorldState::sensors[]
00143   /*! @see WorldState::sensors[] */
00144   enum SensorOffset_t { 
00145     X_OFFSET,
00146     Y_OFFSET,
00147     Z_OFFSET
00148   };
00149   
00150   enum IRComm_t {
00151     IR_X,
00152     IR_Y
00153   };
00154   /*const unsigned IR_BASE_MASK=240;
00155   const unsigned IR_BASE_RED_MASK=8;
00156   const unsigned IR_BASE_GREEN_MASK=4;
00157   const unsigned IR_BASE_FORCE_MASK=2;*/
00158     
00159   //! Provides a string name for each sensor
00160   const char* const sensorNames[NumSensors+1] = { 
00161     "x",
00162     "y",
00163     "z",
00164     NULL
00165   }; // non-empty array to avoid gcc 3.4.2 internal error
00166 
00167   //@}
00168 
00169 
00170   //! Names for each of the outputs
00171   const char* const outputNames[NumReferenceFrames+1] = {
00172     "LED 0",
00173     "LED 1",
00174     "LED 2",
00175     "LED 3",
00176     "BaseFrame",
00177     NULL
00178   };
00179   
00180   //! allocation declared in RobotInfo.cc
00181   extern const Capabilities capabilities;
00182   
00183   //! This table holds the default PID values for each joint.  see PIDMC
00184   const float DefaultPIDs[NumPIDJoints+1][3] = {
00185     {0,0,0} // extra value to avoid error in older versions of gcc (doesn't like empty array
00186   };
00187   
00188   //!These values are our recommended maximum joint velocities, in rad/ms
00189   const float MaxOutputSpeed[NumOutputs] = {
00190     0, 0, 0, 0
00191   };
00192 
00193   //! 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)
00194   const float outputRanges[NumOutputs][2] =
00195     {
00196       { -1 , 1 },
00197       { -1 , 1 },
00198       { -1 , 1 },
00199       { -1 , 1 },
00200     };
00201 
00202   //! 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)
00203   /*! Same as #outputRanges, don't know actual values because they were never specified by Sony */
00204   const float mechanicalLimits[NumOutputs][2] =
00205     {
00206       { -1 , 1 },
00207       { -1 , 1 },
00208       { -1 , 1 },
00209       { -1 , 1 },
00210     };
00211 
00212 }
00213 
00214 /*! @file
00215  * @brief Defines some capabilities of the WiiMote
00216  * @author ejt (Creator)
00217  */
00218 
00219 #endif

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