fourwheeled.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Robot Group Leipzig                             *
00003  *    martius@informatik.uni-leipzig.de                                    *
00004  *    fhesse@informatik.uni-leipzig.de                                     *
00005  *    der@informatik.uni-leipzig.de                                        *
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00021  *                                                                         *
00022  *  A robot with 4 wheels based on nimm4 with IR sensors                   *
00023  *                                                                         *
00024  *   $Log: fourwheeled.h,v $
00025  *   Revision 1.3  2008/04/23 07:17:16  martius
00026  *   makefiles cleaned
00027  *   new also true realtime factor displayed,
00028  *    warning if out of sync
00029  *   drawinterval in full speed is 10 frames, independent of the speed
00030  *
00031  *   Revision 1.2  2007/11/07 13:21:15  martius
00032  *   doInternal stuff changed signature
00033  *
00034  *   Revision 1.1  2007/08/24 11:49:35  martius
00035  *   initial
00036  *
00037  *                                                                 *
00038  ***************************************************************************/
00039 #ifndef __FOUR_WHEELED__
00040 #define __FOUR_WHEELED__
00041 
00042 #include "nimm4.h"
00043 #include "raysensorbank.h"
00044 
00045 namespace lpzrobots {
00046 
00047   class Primitive; 
00048   class Hinge2Joint; 
00049 
00050   typedef struct {
00051     double size;
00052     double force;
00053     double speed;
00054     bool sphereWheels;
00055     bool irFront;
00056     bool irBack;
00057     bool irSide;
00058     double irRangeFront;
00059     double irRangeBack;
00060     double irRangeSide;
00061   } FourWheeledConf;
00062   
00063   /** Robot is based on nimm4 with 
00064       4 wheels and a capsule like body   
00065   */
00066   class FourWheeled : public Nimm4{
00067   public:
00068   
00069     /**
00070      * constructor of nimm4 robot
00071      * @param odeHandle data structure for accessing ODE
00072      * @param osgHandle ata structure for accessing OSG
00073      * @param conf configuration structure
00074      * @param name name of the robot
00075      */
00076     FourWheeled(const OdeHandle& odeHandle, const OsgHandle& osgHandle, FourWheeledConf conf, const std::string& name);
00077 
00078     static FourWheeledConf getDefaultConf(){
00079       FourWheeledConf conf;
00080       conf.size=1;
00081       conf.force=3;
00082       conf.speed=15;
00083       conf.sphereWheels=true;
00084       conf.irFront=false;
00085       conf.irBack=false;
00086       conf.irSide=false;
00087       conf.irRangeFront=3;
00088       conf.irRangeSide=2;
00089       conf.irRangeBack=2;
00090       return conf;
00091     }
00092 
00093     virtual ~FourWheeled();
00094 
00095     /**
00096      * updates the OSG nodes of the vehicle
00097      */
00098     virtual void update();
00099 
00100     virtual int getSensorNumber();
00101 
00102     /** returns actual sensorvalues
00103         @param sensors sensors scaled to [-1,1] 
00104         @param sensornumber length of the sensor array
00105         @return number of actually written sensors
00106     */
00107     virtual int getSensors(sensor* sensors, int sensornumber);
00108 
00109     /** this function is called in each timestep. It should perform robot-internal checks, 
00110         like space-internal collision detection, sensor resets/update etc.
00111         @param globalData structure that contains global data from the simulation environment
00112     */
00113     virtual void doInternalStuff(GlobalData& globalData);
00114 
00115 
00116   protected:
00117     /** creates vehicle at desired pose
00118         @param pose 4x4 pose matrix
00119     */
00120     virtual void create(const osg::Matrix& pose); 
00121 
00122     /** destroys vehicle and space
00123      */
00124     virtual void destroy();
00125 
00126     FourWheeledConf conf;
00127     RaySensorBank irSensorBank; // a collection of ir sensors
00128     Primitive* bumpertrans;
00129     Primitive* bumper;
00130   };
00131 
00132 }
00133 
00134 #endif

Generated on Tue Sep 16 22:00:22 2008 for Robotsystem of the Robot Group Leipzig by  doxygen 1.4.7