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
shortcircuit.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 __SHORTCIRCUIT_H
25 #define __SHORTCIRCUIT_H
26 
27 
28 #include "oderobot.h"
29 #include "primitive.h"
30 
31 namespace lpzrobots {
32 
33  /**
34  *
35  */
36  class ShortCircuit : public OdeRobot{
37  public:
38  ShortCircuit(const OdeHandle& odeHandle, const OsgHandle& osgHandle, int sensornumber, int motornumber);
39 
40  virtual ~ShortCircuit();
41 
42 
43 
44  /** sets the pose of the vehicle
45  @param pose desired 4x4 pose matrix
46  */
47  virtual void placeIntern(const osg::Matrix& pose) {}
48 
49  /** returns actual sensorvalues
50  @param sensors sensors scaled to [-1,1]
51  @param sensornumber length of the sensor array
52  @return number of actually written sensors
53  */
54  virtual int getSensorsIntern(sensor* sensors, int sensornumber);
55 
56  /** sets actual motorcommands
57  @param motors motors scaled to [-1,1]
58  @param motornumber length of the motor array
59  */
60  virtual void setMotorsIntern(const double* motors, int motornumber);
61 
62  /** returns number of sensors
63  */
64  virtual int getSensorNumberIntern() {return sensorno; }
65 
66  /** returns number of motors
67  */
68  virtual int getMotorNumberIntern() {return motorno; }
69 
70  /** this function is called in each timestep. It should perform robot-internal checks,
71  like space-internal collision detection, sensor resets/update etc.
72  @param globalData structure that contains global data from the simulation environment
73  */
74  virtual void doInternalStuff(GlobalData& globalData) {}
75 
76  protected:
77  /** the main object of the robot, which is used for position and speed tracking */
78  virtual Primitive* getMainPrimitive() const { return dummy; }
79 
80  protected:
82  int sensorno; //number of sensors
83  int motorno; // number of motors
84  double* motors;
85  } ;
86 
87 }
88 
89 #endif
90 
Data structure for accessing the ODE.
Definition: odehandle.h:44
virtual int getSensorNumberIntern()
returns number of sensors
Definition: shortcircuit.h:64
Matrixd Matrix
Definition: osgforwarddecl.h:47
virtual void setMotorsIntern(const double *motors, int motornumber)
sets actual motorcommands
Definition: shortcircuit.cpp:55
double sensor
Definition: types.h:29
Data structure for accessing the OpenSceneGraph.
Definition: osghandle.h:79
int sensorno
Definition: shortcircuit.h:82
DummyPrimitive * dummy
Definition: shortcircuit.h:81
int motorno
Definition: shortcircuit.h:83
Interface class for primitives represented in the physical and graphical world.
Definition: primitive.h:80
virtual void placeIntern(const osg::Matrix &pose)
sets the pose of the vehicle
Definition: shortcircuit.h:47
Data structure holding all essential global information.
Definition: globaldata.h:57
virtual int getMotorNumberIntern()
returns number of motors
Definition: shortcircuit.h:68
std::list< SensorAttachment > sensors
Definition: oderobot.h:269
Definition: shortcircuit.h:36
OsgHandle osgHandle
Definition: oderobot.h:278
OdeHandle odeHandle
Definition: oderobot.h:277
virtual Primitive * getMainPrimitive() const
the main object of the robot, which is used for position and speed tracking
Definition: shortcircuit.h:78
Abstract class for ODE robots.
Definition: oderobot.h:64
virtual ~ShortCircuit()
Definition: shortcircuit.cpp:47
double * motors
Definition: shortcircuit.h:84
Dummy Primitive which returns 0 for geom and body.
Definition: primitive.h:452
virtual int getSensorsIntern(sensor *sensors, int sensornumber)
returns actual sensorvalues
Definition: shortcircuit.cpp:65
ShortCircuit(const OdeHandle &odeHandle, const OsgHandle &osgHandle, int sensornumber, int motornumber)
Definition: shortcircuit.cpp:33
virtual void doInternalStuff(GlobalData &globalData)
this function is called in each timestep.
Definition: shortcircuit.h:74