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
speedsensor.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 __SPEEDSENSOR_H
25 #define __SPEEDSENSOR_H
26 
27 #include "sensor.h"
28 
29 namespace lpzrobots {
30 
31  /** Class for speed sensing of robots.
32  The sensor values are normalised speeds, either translational or rotational
33  */
34  class SpeedSensor : public Sensor {
35  public:
36 
37  /// Sensor mode
38  enum Mode { Translational, ///< measures translational speed in world coordinates (Linear velocity)
39  TranslationalRel, ///< measures translational speed in body coordinates (Linear velocity)
40  Rotational, ///< measures roational velocity around the world axis
41  RotationalRel ///< measures roational velocity around the body axis
42  };
43 
44  /**
45  @param maxSpeed maximal speed that is expected used for normalisation of sensor value
46  @param dimensions bit mask for the dimensions to sense. Default: X | Y | Z (all dimensions)
47  @see Dimensions
48  */
49  SpeedSensor(double maxSpeed, Mode mode = Translational, short dimensions = X | Y | Z );
50  virtual ~SpeedSensor() {}
51 
52  virtual void init(Primitive* own, Joint* joint = 0);
53  virtual int getSensorNumber() const;
54 
55  virtual bool sense(const GlobalData& globaldata);
56  virtual std::list<sensor> getList() const;
57  virtual int get(sensor* sensors, int length) const;
58  protected:
60 
61  protected:
62  double maxSpeed;
64  short dimensions;
66  };
67 
68 
69 }
70 
71 #endif
Matrix type.
Definition: matrix.h:65
Definition: sensor.h:46
double maxSpeed
Definition: speedsensor.h:62
Definition: sensor.h:46
virtual ~SpeedSensor()
Definition: speedsensor.h:50
Definition: joint.h:41
Mode mode
Definition: speedsensor.h:63
double sensor
Definition: types.h:29
Abstract class for sensors that can be plugged into a robot.
Definition: sensor.h:43
measures roational velocity around the world axis
Definition: speedsensor.h:40
virtual int getSensorNumber() const
returns the number of sensors values produced by this sensor
Definition: speedsensor.cpp:58
virtual bool sense(const GlobalData &globaldata)
performs sense action
Definition: speedsensor.cpp:62
Interface class for primitives represented in the physical and graphical world.
Definition: primitive.h:80
matrix::Matrix getSenseMatrix() const
Definition: speedsensor.cpp:78
measures translational speed in world coordinates (Linear velocity)
Definition: speedsensor.h:38
virtual std::list< sensor > getList() const
returns a list of sensor values (usually in the range [-1,1] ) This function should be overloaded...
Definition: speedsensor.cpp:64
Data structure holding all essential global information.
Definition: globaldata.h:57
Class for speed sensing of robots.
Definition: speedsensor.h:34
virtual void init(Primitive *own, Joint *joint=0)
initialises sensor with a body of robot and optionally with a joint.
Definition: speedsensor.cpp:54
measures roational velocity around the body axis
Definition: speedsensor.h:41
Primitive * own
Definition: speedsensor.h:65
measures translational speed in body coordinates (Linear velocity)
Definition: speedsensor.h:39
short dimensions
Definition: speedsensor.h:64
SpeedSensor(double maxSpeed, Mode mode=Translational, short dimensions=X|Y|Z)
Definition: speedsensor.cpp:37
Definition: sensor.h:46
Mode
Sensor mode.
Definition: speedsensor.h:38