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
nimm4.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 __NIMM4_H
25 #define __NIMM4_H
26 
27 #include "oderobot.h"
28 
29 namespace lpzrobots {
30 
31  class Primitive;
32  class Hinge2Joint;
33 
34  /** Robot that looks like a Nimm 2 Bonbon :-)
35  4 wheels and a capsule like body
36  Wheelorder: front left, front right, rear left, rear right
37 
38  */
39  class Nimm4 : public OdeRobot{
40  public:
41 
42  /**
43  * constructor of nimm4 robot
44  * @param odeHandle data structure for accessing ODE
45  * @param osgHandle ata structure for accessing OSG
46  * @param size scaling of robot
47  * @param force maximal used force to realize motorcommand
48  * @param speed factor for changing speed of robot
49  * @param sphereWheels switches between spheres and 'normal' wheels
50  */
51  Nimm4(const OdeHandle& odeHandle, const OsgHandle& osgHandle, const std::string& name,
52  double size=1, double force=3, double speed=15, bool sphereWheels=true);
53 
54  virtual ~Nimm4(){
55  destroy();
56  };
57 
58  /**
59  * updates the OSG nodes of the vehicle
60  */
61  virtual void update();
62 
63 
64  /** sets the pose of the vehicle
65  @param pose desired pose matrix
66  */
67  virtual void placeIntern(const osg::Matrix& pose);
68 
69  /** returns actual sensorvalues
70  @param sensors sensors scaled to [-1,1]
71  @param sensornumber length of the sensor array
72  @return number of actually written sensors
73  */
74  virtual int getSensorsIntern(double* sensors, int sensornumber);
75 
76  /** sets actual motorcommands
77  @param motors motors scaled to [-1,1]
78  @param motornumber length of the motor array
79  */
80  virtual void setMotorsIntern(const double* motors, int motornumber);
81 
82  /** returns number of sensors
83  */
84  virtual int getSensorNumberIntern(){
85  return sensorno;
86  };
87 
88  /** returns number of motors
89  */
90  virtual int getMotorNumberIntern(){
91  return motorno;
92  };
93 
94 
95  protected:
96  /** creates vehicle at desired pose
97  @param pose 4x4 pose matrix
98  */
99  virtual void create(const osg::Matrix& pose);
100 
101  /** destroys vehicle and space
102  */
103  virtual void destroy();
104 
105  /** additional things for collision handling can be done here
106  */
107  static void mycallback(void *data, dGeomID o1, dGeomID o2);
108 
109  double length; // chassis length
110  double width; // chassis width
111  double height; // chassis height
112  double radius; // wheel radius
113  double wheelthickness; // thickness of the wheels
114  bool sphereWheels; // draw spherical wheels?
115  double cmass; // chassis mass
116  double wmass; // wheel mass
117  int sensorno; // number of sensors
118  int motorno; // number of motors
119  int segmentsno; // number of motorsvehicle segments
120  double speed; // factor for adjusting speed of robot
121 
122  double max_force; // maximal force for motors
123 
124  bool created; // true if robot was created
125 
126  Substance wheelsubstance; // material of wheel
127 
128  };
129 
130 }
131 
132 #endif
Data structure for accessing the ODE.
Definition: odehandle.h:44
int segmentsno
Definition: nimm4.h:119
virtual void create(const osg::Matrix &pose)
creates vehicle at desired pose
Definition: nimm4.cpp:156
virtual void destroy()
destroys vehicle and space
Definition: nimm4.cpp:222
double width
Definition: nimm4.h:110
Physical substance definition, used for collision detection/treatment What we need is mu...
Definition: substance.h:103
double wheelthickness
Definition: nimm4.h:113
Matrixd Matrix
Definition: osgforwarddecl.h:47
double radius
Definition: nimm4.h:112
bool created
Definition: nimm4.h:124
virtual int getSensorsIntern(double *sensors, int sensornumber)
returns actual sensorvalues
Definition: nimm4.cpp:108
double wmass
Definition: nimm4.h:116
Data structure for accessing the OpenSceneGraph.
Definition: osghandle.h:79
double length
Definition: nimm4.h:109
Nimm4(const OdeHandle &odeHandle, const OsgHandle &osgHandle, const std::string &name, double size=1, double force=3, double speed=15, bool sphereWheels=true)
constructor of nimm4 robot
Definition: nimm4.cpp:47
bool sphereWheels
Definition: nimm4.h:114
virtual int getSensorNumberIntern()
returns number of sensors
Definition: nimm4.h:84
int motorno
Definition: nimm4.h:118
virtual void update()
updates the OSG nodes of the vehicle
Definition: nimm4.cpp:139
double max_force
Definition: nimm4.h:122
virtual ~Nimm4()
Definition: nimm4.h:54
virtual void placeIntern(const osg::Matrix &pose)
sets the pose of the vehicle
Definition: nimm4.cpp:126
std::list< SensorAttachment > sensors
Definition: oderobot.h:269
virtual void setMotorsIntern(const double *motors, int motornumber)
sets actual motorcommands
Definition: nimm4.cpp:88
virtual int getMotorNumberIntern()
returns number of motors
Definition: nimm4.h:90
OsgHandle osgHandle
Definition: oderobot.h:278
OdeHandle odeHandle
Definition: oderobot.h:277
Abstract class for ODE robots.
Definition: oderobot.h:64
Robot that looks like a Nimm 2 Bonbon :-) 4 wheels and a capsule like body Wheelorder: front left...
Definition: nimm4.h:39
Substance wheelsubstance
Definition: nimm4.h:126
double cmass
Definition: nimm4.h:115
int sensorno
Definition: nimm4.h:117
static void mycallback(void *data, dGeomID o1, dGeomID o2)
additional things for collision handling can be done here
std::list< MotorAttachment > motors
Definition: oderobot.h:270
double speed
Definition: nimm4.h:120
double height
Definition: nimm4.h:111