Robot Simulator of the Robotics Group for Self-Organization of Control: fourwheeled.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

- File List
- File Members

# 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.4  2009/05/11 17:03:07  martius
    00026  *   minor substance change
    00027  *
    00028  *   Revision 1.3  2008/04/23 07:17:16  martius
    00029  *   makefiles cleaned
    00030  *   new also true realtime factor displayed,
    00031  *    warning if out of sync
    00032  *   drawinterval in full speed is 10 frames, independent of the speed
    00033  *
    00034  *   Revision 1.2  2007/11/07 13:21:15  martius
    00035  *   doInternal stuff changed signature
    00036  *
    00037  *   Revision 1.1  2007/08/24 11:49:35  martius
    00038  *   initial
    00039  *
    00040  *                                                                 *
    00041  ***************************************************************************/
    00042 #ifndef __FOUR_WHEELED__
    00043 #define __FOUR_WHEELED__
    00044
    00045 #include "nimm4.h"
    00046 #include "raysensorbank.h"
    00047
    00048 namespace lpzrobots {
    00049
    00050   class Primitive;
    00051   class Hinge2Joint;
    00052
    00053   typedef struct {
    00054     double size;
    00055     double force;
    00056     double speed;
    00057     bool sphereWheels;
    00058     bool irFront;
    00059     bool irBack;
    00060     bool irSide;
    00061     double irRangeFront;
    00062     double irRangeBack;
    00063     double irRangeSide;
    00064     Substance wheelSubstance;
    00065   } FourWheeledConf;
    00066
    00067   /** Robot is based on nimm4 with
    00068       4 wheels and a capsule like body
    00069   */
    00070   class FourWheeled : public Nimm4{
    00071   public:
    00072
    00073     /**
    00074      * constructor of nimm4 robot
    00075      * @param odeHandle data structure for accessing ODE
    00076      * @param osgHandle ata structure for accessing OSG
    00077      * @param conf configuration structure
    00078      * @param name name of the robot
    00079      */
    00080     FourWheeled(const OdeHandle& odeHandle, const OsgHandle& osgHandle, FourWheeledConf conf, const std::string& name);
    00081
    00082     static FourWheeledConf getDefaultConf(){
    00083       FourWheeledConf conf;
    00084       conf.size=1;
    00085       conf.force=3;
    00086       conf.speed=15;
    00087       conf.sphereWheels=true;
    00088       conf.irFront=false;
    00089       conf.irBack=false;
    00090       conf.irSide=false;
    00091       conf.irRangeFront=3;
    00092       conf.irRangeSide=2;
    00093       conf.irRangeBack=2;
    00094       conf.wheelSubstance.toRubber(40);
    00095       return conf;
    00096     }
    00097
    00098     virtual ~FourWheeled();
    00099
    00100     /**
    00101      * updates the OSG nodes of the vehicle
    00102      */
    00103     virtual void update();
    00104
    00105     virtual int getSensorNumber();
    00106
    00107     /** returns actual sensorvalues
    00108         @param sensors sensors scaled to [-1,1]
    00109         @param sensornumber length of the sensor array
    00110         @return number of actually written sensors
    00111     */
    00112     virtual int getSensors(sensor* sensors, int sensornumber);
    00113
    00114     /** this function is called in each timestep. It should perform robot-internal checks,
    00115         like space-internal collision detection, sensor resets/update etc.
    00116         @param globalData structure that contains global data from the simulation environment
    00117     */
    00118     virtual void doInternalStuff(GlobalData& globalData);
    00119
    00120
    00121   protected:
    00122     /** creates vehicle at desired pose
    00123         @param pose 4x4 pose matrix
    00124     */
    00125     virtual void create(const osg::Matrix& pose);
    00126
    00127     /** destroys vehicle and space
    00128      */
    00129     virtual void destroy();
    00130
    00131     FourWheeledConf conf;
    00132     RaySensorBank irSensorBank; // a collection of ir sensors
    00133     Primitive* bumpertrans;
    00134     Primitive* bumper;
    00135   };
    00136
    00137 }
    00138
    00139 #endif