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
abstractrobot.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 __ABSTRACTROBOT_H
25 #define __ABSTRACTROBOT_H
26 
27 #include <vector>
28 #include <list>
29 #include <string>
30 
31 #include "trackable.h"
32 #include "configurable.h"
33 #include "position.h"
34 #include "sensormotorinfo.h"
35 
36 /**
37  * Abstract class (interface) for robot in general
38  *
39  *
40  */
41 class AbstractRobot : public Trackable, public Configurable {
42 public:
43  typedef double sensor;
44  typedef double motor;
45 
46  /**
47  * Constructor
48  * @param name name of the robot
49  * @param revision revision number of the file (Hint: use CVS variable \verbatim $ID$ \endverbatim )
50  */
51  AbstractRobot(const std::string& name="abstractRobot", const std::string& revision = "$ID$")
52  : Configurable(name, revision) {
53  };
54 
55  virtual ~AbstractRobot(){}
56 
57  /** returns actual sensorvalues
58  @param sensors sensors scaled to [-1,1]
59  @param sensornumber length of the sensor array
60  @return number of actually written sensors
61  */
62  virtual int getSensors(sensor* sensors, int sensornumber)=0;
63 
64  /** sets actual motorcommands
65  @param motors motors scaled to [-1,1]
66  @param motornumber length of the motor array
67  */
68  virtual void setMotors(const motor* motors, int motornumber)=0;
69 
70  /** returns number of sensors
71  */
72  virtual int getSensorNumber()=0;
73 
74  /** returns number of motors
75  */
76  virtual int getMotorNumber()=0;
77 
78  virtual std::string getTrackableName() const {return getName();}
79 
80  /** returns the information for the sensors.
81  The following relation has to hold: getSensorNames().size() == getSensorNumber()
82  */
83  virtual std::list<SensorMotorInfo> getSensorInfos()
84  { return std::list<SensorMotorInfo>(getSensorNumber());};
85 
86  /** returns the information for the motors.
87  The following relation has to hold: getMotorNames().size() == getMotorNumber()
88  */
89  virtual std::list<SensorMotorInfo> getMotorInfos()
90  { return std::list<SensorMotorInfo>(getMotorNumber());};
91 
92 
93 };
94 
95 #endif
96 
Abstract class (interface) for trackable objects (used for robots)
Definition: trackable.h:39
double sensor
Definition: types.h:29
virtual std::string getTrackableName() const
returns name of trackable
Definition: abstractrobot.h:78
virtual std::list< SensorMotorInfo > getMotorInfos()
returns the information for the motors.
Definition: abstractrobot.h:89
virtual int getMotorNumber()=0
returns number of motors
virtual std::list< SensorMotorInfo > getSensorInfos()
returns the information for the sensors.
Definition: abstractrobot.h:83
Abstact class for configurable objects.
Definition: configurable.h:81
double motor
Definition: types.h:30
virtual int getSensorNumber()=0
returns number of sensors
AbstractRobot(const std::string &name="abstractRobot", const std::string &revision="$ID$")
Constructor.
Definition: abstractrobot.h:51
virtual int getSensors(sensor *sensors, int sensornumber)=0
returns actual sensorvalues
double sensor
Definition: abstractrobot.h:43
virtual ~AbstractRobot()
Definition: abstractrobot.h:55
double motor
Definition: abstractrobot.h:44
virtual void setMotors(const motor *motors, int motornumber)=0
sets actual motorcommands
Abstract class (interface) for robot in general.
Definition: abstractrobot.h:41
virtual paramkey getName() const
return the name of the object
Definition: configurable.h:264