Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fourwheeled.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2011 LpzRobots development team *
3  * Georg Martius <georg dot martius at web dot de> *
4  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
5  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
6  * Ralf Der <ralfder at mis dot mpg dot de> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22  * *
23  ***************************************************************************/
24 #ifndef __FOUR_WHEELED__
25 #define __FOUR_WHEELED__
26 
27 #include "nimm4.h"
28 #include "raysensorbank.h"
29 
30 namespace lpzrobots {
31 
32  class Primitive;
33  class Hinge2Joint;
34  class Joint;
35 
36  typedef struct {
37  double size;
38  double force;
39  double speed;
41  bool useBumper;
42  bool useButton; ///< use yellow Button at the back
43  bool twoWheelMode; ///< if true then the robot emulates 2 wheels
44  bool irFront;
45  bool irBack;
46  bool irSide;
47  double irRangeFront;
48  double irRangeBack;
49  double irRangeSide;
52 
53  /** Robot is based on nimm4 with
54  4 wheels and a capsule like body
55  */
56  class FourWheeled : public Nimm4{
57  public:
58 
59  /**
60  * constructor of nimm4 robot
61  * @param odeHandle data structure for accessing ODE
62  * @param osgHandle ata structure for accessing OSG
63  * @param conf configuration structure
64  * @param name name of the robot
65  */
66  FourWheeled(const OdeHandle& odeHandle, const OsgHandle& osgHandle, FourWheeledConf conf, const std::string& name);
67 
70  conf.size = 1;
71  conf.force = 3;
72  conf.speed = 15;
73  conf.sphereWheels = true;
74  conf.twoWheelMode = false;
75  conf.useBumper = true;
76  conf.useButton = false;
77  conf.irFront = false;
78  conf.irBack = false;
79  conf.irSide = false;
80  conf.irRangeFront = 3;
81  conf.irRangeSide = 2;
82  conf.irRangeBack = 2;
83  conf.wheelSubstance.toRubber(40);
84  return conf;
85  }
86 
87  virtual ~FourWheeled();
88 
89  virtual int getSensorNumberIntern();
90  virtual int getMotorNumberIntern();
91 
92  virtual int getSensorsIntern(sensor* sensors, int sensornumber);
93 
94  virtual void setMotorsIntern(const double* motors, int motornumber);
95 
96  // returns the joint with index i
97  virtual Joint* getJoint(int i);
98 
99  protected:
100  /** creates vehicle at desired pose
101  @param pose 4x4 pose matrix
102  */
103  virtual void create(const osg::Matrix& pose);
104 
105  /** destroys vehicle and space
106  */
107  virtual void destroy();
108 
112  };
113 
114 }
115 
116 #endif
FourWheeled(const OdeHandle &odeHandle, const OsgHandle &osgHandle, FourWheeledConf conf, const std::string &name)
constructor of nimm4 robot
Definition: fourwheeled.cpp:40
Data structure for accessing the ODE.
Definition: odehandle.h:44
virtual void destroy()
destroys vehicle and space
Definition: fourwheeled.cpp:183
bool irFront
Definition: fourwheeled.h:44
Physical substance definition, used for collision detection/treatment What we need is mu...
Definition: substance.h:103
Robot is based on nimm4 with 4 wheels and a capsule like body.
Definition: fourwheeled.h:56
Matrixd Matrix
Definition: osgforwarddecl.h:47
Definition: joint.h:41
double sensor
Definition: types.h:29
FourWheeledConf conf
Definition: fourwheeled.h:109
virtual void setMotorsIntern(const double *motors, int motornumber)
sets actual motorcommands
Definition: fourwheeled.cpp:83
bool sphereWheels
Definition: fourwheeled.h:40
Data structure for accessing the OpenSceneGraph.
Definition: osghandle.h:79
static FourWheeledConf getDefaultConf()
Definition: fourwheeled.h:68
Substance wheelSubstance
Definition: fourwheeled.h:50
void toRubber(float hardness)
high roughness, no slip, very elastic, hardness : [5-50]
Definition: substance.cpp:129
double irRangeBack
Definition: fourwheeled.h:48
bool irBack
Definition: fourwheeled.h:45
double size
Definition: fourwheeled.h:37
Interface class for primitives represented in the physical and graphical world.
Definition: primitive.h:80
Primitive * bumpertrans
Definition: fourwheeled.h:110
std::list< SensorAttachment > sensors
Definition: oderobot.h:269
bool twoWheelMode
if true then the robot emulates 2 wheels
Definition: fourwheeled.h:43
bool irSide
Definition: fourwheeled.h:46
OsgHandle osgHandle
Definition: oderobot.h:278
double speed
Definition: fourwheeled.h:39
OdeHandle odeHandle
Definition: oderobot.h:277
bool useButton
use yellow Button at the back
Definition: fourwheeled.h:42
double irRangeSide
Definition: fourwheeled.h:49
double force
Definition: fourwheeled.h:38
Robot that looks like a Nimm 2 Bonbon :-) 4 wheels and a capsule like body Wheelorder: front left...
Definition: nimm4.h:39
virtual int getSensorsIntern(sensor *sensors, int sensornumber)
returns actual sensorvalues
Definition: fourwheeled.cpp:62
virtual void create(const osg::Matrix &pose)
creates vehicle at desired pose
Definition: fourwheeled.cpp:100
virtual int getSensorNumberIntern()
returns number of sensors
Definition: fourwheeled.cpp:54
bool useBumper
Definition: fourwheeled.h:41
Primitive * bumper
Definition: fourwheeled.h:111
double irRangeFront
Definition: fourwheeled.h:47
virtual Joint * getJoint(int i)
Definition: fourwheeled.cpp:174
virtual int getMotorNumberIntern()
returns number of motors
Definition: fourwheeled.cpp:76
std::list< MotorAttachment > motors
Definition: oderobot.h:270
virtual ~FourWheeled()
Definition: fourwheeled.cpp:50
Definition: fourwheeled.h:36