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
formel1.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 __FORMEL1_H
25 #define __FORMEL1_H
26 
27 #include "oderobot.h"
28 
29 namespace lpzrobots {
30 
31  class Primitive;
32  class Joint;
33 
34  /** Robot that looks like a Nimm 2 Bonbon :-)
35  4 wheels and a capsule like body
36  */
37  class Formel1 : public OdeRobot{
38  public:
39 
41  double size=1, double force=3, double speed=15, bool sphereWheels=true);
42 
43  virtual ~Formel1(){};
44 
45  /**
46  * updates the OSG nodes of the vehicle
47  */
48  virtual void update();
49 
50 
51  /** sets the pose of the vehicle
52  @param pose desired pose matrix
53  */
54  virtual void placeIntern(const osg::Matrix& pose);
55 
56  /** returns actual sensorvalues
57  @param sensors sensors scaled to [-1,1]
58  @param sensornumber length of the sensor array
59  @return number of actually written sensors
60  */
61  virtual int getSensorsIntern(double* sensors, int sensornumber);
62 
63  /** sets actual motorcommands
64  @param motors motors scaled to [-1,1]
65  @param motornumber length of the motor array
66  */
67  virtual void setMotorsIntern(const double* motors, int motornumber);
68 
69  /** returns number of sensors
70  */
71  virtual int getSensorNumberIntern(){
72  return sensorno;
73  };
74 
75  /** returns number of motors
76  */
77  virtual int getMotorNumberIntern(){
78  return motorno;
79  };
80 
81 
82  protected:
83  /** the main object of the robot, which is used for position and speed tracking */
84  virtual Primitive* getMainPrimitive() const { return object[0]; }
85 
86  /** creates vehicle at desired pose
87  @param pose 4x4 pose matrix
88  */
89  virtual void create(const osg::Matrix& pose);
90 
91  /** destroys vehicle and space
92  */
93  virtual void destroy();
94 
95  /** additional things for collision handling can be done here
96  */
97  static void mycallback(void *data, dGeomID o1, dGeomID o2);
98 
99  double length; // chassis length
100  double width; // chassis width
101  double height; // chassis height
102  double radius; // wheel radius
103  double wheelthickness; // thickness of the wheels
104  bool sphereWheels; // draw spherical wheels?
105  double cmass; // chassis mass
106  double wmass; // wheel mass
107  int sensorno; //number of sensors
108  int motorno; // number of motors
109  int segmentsno; // number of motorsvehicle segments
110  double speed; //
111 
112  double max_force; // maximal force for motors
113 
114  bool created; // true if robot was created
115 
116  Primitive* object[5]; // 1 capsule, 4 wheels
117  Hinge2Joint* joint[4]; // joints between cylinder and each wheel
118 
119  };
120 
121 }
122 
123 
124 #endif
Data structure for accessing the ODE.
Definition: odehandle.h:44
virtual void placeIntern(const osg::Matrix &pose)
sets the pose of the vehicle
Definition: formel1.cpp:133
Matrixd Matrix
Definition: osgforwarddecl.h:47
bool sphereWheels
Definition: formel1.h:104
virtual int getMotorNumberIntern()
returns number of motors
Definition: formel1.h:77
static void mycallback(void *data, dGeomID o1, dGeomID o2)
additional things for collision handling can be done here
Definition: formel1.cpp:161
Data structure for accessing the OpenSceneGraph.
Definition: osghandle.h:79
bool created
Definition: formel1.h:114
Formel1(const OdeHandle &odeHandle, const OsgHandle &osgHandle, double size=1, double force=3, double speed=15, bool sphereWheels=true)
Definition: formel1.cpp:45
int motorno
Definition: formel1.h:108
double height
Definition: formel1.h:101
double max_force
Definition: formel1.h:112
double wmass
Definition: formel1.h:106
double radius
Definition: formel1.h:102
double wheelthickness
Definition: formel1.h:103
Interface class for primitives represented in the physical and graphical world.
Definition: primitive.h:80
std::list< SensorAttachment > sensors
Definition: oderobot.h:269
virtual ~Formel1()
Definition: formel1.h:43
Definition: joint.h:211
double length
Definition: formel1.h:99
OsgHandle osgHandle
Definition: oderobot.h:278
OdeHandle odeHandle
Definition: oderobot.h:277
virtual void destroy()
destroys vehicle and space
Definition: formel1.cpp:226
Robot that looks like a Nimm 2 Bonbon :-) 4 wheels and a capsule like body.
Definition: formel1.h:37
virtual void setMotorsIntern(const double *motors, int motornumber)
sets actual motorcommands
Definition: formel1.cpp:83
Hinge2Joint * joint[4]
Definition: formel1.h:117
double width
Definition: formel1.h:100
Abstract class for ODE robots.
Definition: oderobot.h:64
virtual void create(const osg::Matrix &pose)
creates vehicle at desired pose
Definition: formel1.cpp:179
virtual int getSensorsIntern(double *sensors, int sensornumber)
returns actual sensorvalues
Definition: formel1.cpp:115
double speed
Definition: formel1.h:110
virtual void update()
updates the OSG nodes of the vehicle
Definition: formel1.cpp:146
int segmentsno
Definition: formel1.h:109
virtual int getSensorNumberIntern()
returns number of sensors
Definition: formel1.h:71
double cmass
Definition: formel1.h:105
std::list< MotorAttachment > motors
Definition: oderobot.h:270
virtual Primitive * getMainPrimitive() const
the main object of the robot, which is used for position and speed tracking
Definition: formel1.h:84
int sensorno
Definition: formel1.h:107