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
schlangeforce.h
Go to the documentation of this file.
1 /************************************************************************/
2 /*schlangeforce.h */
3 /*Snake with torque added to joints */
4 /* */
5 /************************************************************************/
6 /***************************************************************************
7  * Copyright (C) 2005-2011 LpzRobots development team *
8  * Georg Martius <georg dot martius at web dot de> *
9  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
10  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
11  * Ralf Der <ralfder at mis dot mpg dot de> *
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the *
25  * Free Software Foundation, Inc., *
26  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
27  * *
28  ***************************************************************************/
29 #ifndef __SCHLANGEFORCE_H
30 #define __SCHLANGEFORCE_H
31 
32 #include "schlange.h"
33 
34 namespace lpzrobots {
35 
36  /**
37  * This is a class, which models a snake like robot.
38  * It consists of a number of equal elements, each linked
39  * by a joint powered by torques added to joints
40  **/
41  class SchlangeForce: public Schlange
42  {
43  public:
45  const SchlangeConf& conf,
46  const std::string& name, const std::string& revision);
47 
48 
49  virtual ~SchlangeForce();
50 
51  /**
52  *Reads the actual motor commands from an array,
53  *an sets all motors of the snake to this values.
54  *It is an linear allocation.
55  *@param motors pointer to the array, motor values are scaled to [-1,1]
56  *@param motornumber length of the motor array
57  **/
58  virtual void setMotorsIntern( const double* motors, int motornumber );
59 
60  /**
61  *Writes the sensor values to an array in the memory.
62  *@param sensors pointer to the array
63  *@param sensornumber length of the sensor array
64  *@return number of actually written sensors
65  **/
66  virtual int getSensorsIntern( sensor* sensors, int sensornumber );
67 
68  /** returns number of sensors
69  */
70  virtual int getSensorNumberIntern() { assert(created); return joints.size() * 2; }
71 
72  /** returns number of motors
73  */
74  virtual int getMotorNumberIntern(){ assert(created); return joints.size() * 2; }
75 
76  private:
77  virtual void create(const osg::Matrix& pose);
78  virtual void destroy();
79  };
80 
81 }
82 
83 #endif
Data structure for accessing the ODE.
Definition: odehandle.h:44
bool created
Definition: schlange.h:76
virtual int getMotorNumberIntern()
returns number of motors
Definition: schlangeforce.h:74
Matrixd Matrix
Definition: osgforwarddecl.h:47
virtual int getSensorsIntern(sensor *sensors, int sensornumber)
Writes the sensor values to an array in the memory.
Definition: schlangeforce.cpp:76
Definition: schlange.h:46
SchlangeForce(const OdeHandle &odeHandle, const OsgHandle &osgHandle, const SchlangeConf &conf, const std::string &name, const std::string &revision)
Definition: schlangeforce.cpp:30
Data structure for accessing the OpenSceneGraph.
Definition: osghandle.h:79
virtual int getSensorNumberIntern()
returns number of sensors
Definition: schlangeforce.h:70
virtual ~SchlangeForce()
Definition: schlangeforce.cpp:38
Joints joints
list of joints (should be populated by subclasses)
Definition: oderobot.h:267
This is a class, which models a snake like robot.
Definition: schlange.h:72
std::list< SensorAttachment > sensors
Definition: oderobot.h:269
OsgHandle osgHandle
Definition: oderobot.h:278
OdeHandle odeHandle
Definition: oderobot.h:277
SchlangeConf conf
Definition: schlange.h:79
This is a class, which models a snake like robot.
Definition: schlangeforce.h:41
virtual void setMotorsIntern(const double *motors, int motornumber)
Reads the actual motor commands from an array, an sets all motors of the snake to this values...
Definition: schlangeforce.cpp:47
double sensor
Definition: abstractrobot.h:43
std::list< MotorAttachment > motors
Definition: oderobot.h:270