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