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
derivativesensor.h
Go to the documentation of this file.
1 #ifndef __DERIVATIVESENSOR_H
2 #define __DERIVATIVESENSOR_H
3 
4 #include "sensor.h"
5 
6 namespace lpzrobots {
7 
8  /**
9  * Class for measuring (time) derivatives of a given sensor.
10  */
11  class DerivativeSensor : public Sensor {
12  public:
13 
14  /**
15  * @param attachedSensor Sensor of which the derivative is computed
16  * @param factor Scaling factor for derivative
17  */
19 
20  virtual ~DerivativeSensor() {}
21 
22  virtual void init(Primitive* own, Joint* joint = 0);
23 
24  virtual int getSensorNumber() const;
25 
26  virtual bool sense(const GlobalData& globaldata);
27 
28  virtual std::list<sensor> getList() const;
29 
30  protected:
31  //Current time step of the simulation
32  double timeStepSize;
33  //Values of last time step
34  mutable std::list<sensor> oldValues;
35  //Sensor of which to measure derivatives
37  //Scaling factor for derivative (if derivative is too small)
38  double factor;
39 
40  };
41 
42 
43 }
44 
45 #endif
Class for measuring (time) derivatives of a given sensor.
Definition: derivativesensor.h:11
virtual bool sense(const GlobalData &globaldata)
performs sense action
Definition: derivativesensor.cpp:20
virtual void init(Primitive *own, Joint *joint=0)
initialises sensor with a body of robot and optionally with a joint.
Definition: derivativesensor.cpp:11
virtual std::list< sensor > getList() const
returns a list of sensor values (usually in the range [-1,1] ) This function should be overloaded...
Definition: derivativesensor.cpp:26
Definition: joint.h:41
virtual ~DerivativeSensor()
Definition: derivativesensor.h:20
Sensor * attachedSensor
Definition: derivativesensor.h:36
Abstract class for sensors that can be plugged into a robot.
Definition: sensor.h:43
Interface class for primitives represented in the physical and graphical world.
Definition: primitive.h:80
virtual int getSensorNumber() const
returns the number of sensors values produced by this sensor
Definition: derivativesensor.cpp:16
Data structure holding all essential global information.
Definition: globaldata.h:57
std::list< sensor > oldValues
Definition: derivativesensor.h:34
DerivativeSensor(Sensor *attachedSensor, double factor=1)
Definition: derivativesensor.cpp:5
double factor
Definition: derivativesensor.h:38
double timeStepSize
Definition: derivativesensor.h:32