fourwheeled.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005-2011 LpzRobots development team                    *
00003  *    Georg Martius  <georg dot martius at web dot de>                     *
00004  *    Frank Guettler <guettler at informatik dot uni-leipzig dot de        *
00005  *    Frank Hesse    <frank at nld dot ds dot mpg dot de>                  *
00006  *    Ralf Der       <ralfder at mis dot mpg dot de>                       *
00007  *                                                                         *
00008  *   This program is free software; you can redistribute it and/or modify  *
00009  *   it under the terms of the GNU General Public License as published by  *
00010  *   the Free Software Foundation; either version 2 of the License, or     *
00011  *   (at your option) any later version.                                   *
00012  *                                                                         *
00013  *   This program is distributed in the hope that it will be useful,       *
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00016  *   GNU General Public License for more details.                          *
00017  *                                                                         *
00018  *   You should have received a copy of the GNU General Public License     *
00019  *   along with this program; if not, write to the                         *
00020  *   Free Software Foundation, Inc.,                                       *
00021  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00022  *                                                                         *
00023  ***************************************************************************/
00024 #ifndef __FOUR_WHEELED__
00025 #define __FOUR_WHEELED__
00026 
00027 #include "nimm4.h"
00028 #include "raysensorbank.h"
00029 
00030 namespace lpzrobots {
00031 
00032   class Primitive; 
00033   class Hinge2Joint; 
00034   class Joint; 
00035 
00036   typedef struct {
00037     double size;
00038     double force;
00039     double speed;
00040     bool sphereWheels;
00041     bool useBumper;
00042     bool useButton; ///< use yellow Button at the back
00043     bool twoWheelMode; ///< if true then the robot emulates 2 wheels
00044     bool irFront;
00045     bool irBack;
00046     bool irSide;
00047     double irRangeFront;
00048     double irRangeBack;
00049     double irRangeSide;
00050     Substance wheelSubstance;
00051   } FourWheeledConf;
00052   
00053   /** Robot is based on nimm4 with 
00054       4 wheels and a capsule like body   
00055   */
00056   class FourWheeled : public Nimm4{
00057   public:
00058   
00059     /**
00060      * constructor of nimm4 robot
00061      * @param odeHandle data structure for accessing ODE
00062      * @param osgHandle ata structure for accessing OSG
00063      * @param conf configuration structure
00064      * @param name name of the robot
00065      */
00066     FourWheeled(const OdeHandle& odeHandle, const OsgHandle& osgHandle, FourWheeledConf conf, const std::string& name);
00067 
00068     static FourWheeledConf getDefaultConf(){
00069       FourWheeledConf conf;
00070       conf.size         = 1;
00071       conf.force        = 3;
00072       conf.speed        = 15;
00073       conf.sphereWheels = true;
00074       conf.twoWheelMode = false;
00075       conf.useBumper    = true;
00076       conf.useButton    = false;
00077       conf.irFront      = false;
00078       conf.irBack       = false;
00079       conf.irSide       = false;
00080       conf.irRangeFront = 3;
00081       conf.irRangeSide  = 2;
00082       conf.irRangeBack  = 2;
00083       conf.wheelSubstance.toRubber(40);
00084       return conf;
00085     }
00086 
00087     virtual ~FourWheeled();
00088 
00089     /**
00090      * updates the OSG nodes of the vehicle
00091      */
00092     virtual void update();
00093 
00094     virtual int getSensorNumber();
00095     virtual int getMotorNumber();
00096 
00097     virtual int getSensors(sensor* sensors, int sensornumber);
00098     
00099     virtual void setMotors(const motor* motors, int motornumber);
00100 
00101     /** this function is called in each timestep. It should perform robot-internal checks, 
00102         like space-internal collision detection, sensor resets/update etc.
00103         @param globalData structure that contains global data from the simulation environment
00104     */
00105     virtual void doInternalStuff(GlobalData& globalData);
00106 
00107     // returns the joint with index i
00108     virtual Joint* getJoint(int i);
00109 
00110   protected:
00111     /** creates vehicle at desired pose
00112         @param pose 4x4 pose matrix
00113     */
00114     virtual void create(const osg::Matrix& pose); 
00115 
00116     /** destroys vehicle and space
00117      */
00118     virtual void destroy();
00119 
00120     FourWheeledConf conf;
00121     RaySensorBank irSensorBank; // a collection of ir sensors
00122     Primitive* bumpertrans;
00123     Primitive* bumper;
00124   };
00125 
00126 }
00127 
00128 #endif
Generated on Thu Jun 28 14:45:36 2012 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.6.3