~robot3d-team/robot3d/trunk

« back to all changes in this revision

Viewing changes to inc/srSensor/sampleSensor.h

  • Committer: Anne van Rossum
  • Date: 2010-08-10 15:58:55 UTC
  • Revision ID: anne@gamix-20100810155855-kve7x2vwouagdij9
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * sampleSensor.h
 
3
 *
 
4
 *  Created on: Nov 28, 2008
 
5
 *      Author: winkler
 
6
 */
 
7
 
 
8
#ifndef SAMPLESENSOR_H_
 
9
#define SAMPLESENSOR_H_
 
10
 
 
11
// The following todo list do not refer to this class, but to the whole directory.
 
12
// The model/sensor directory is quite a stub. Please help to improve it ;)
 
13
 
 
14
/* TODO:        improved sensor model. Different kind of sensor deviations should be considered to be included in such a model, including:
 
15
 *                      - noise
 
16
 *                      - resolution
 
17
 *                      - measurement of a property other than the one the sensor has to measure (such as temperature)
 
18
 *                      - offset /bias
 
19
 *                      - drift (short term / long term)
 
20
 *                      - hysteresis
 
21
 *                      - sample rate
 
22
 */
 
23
 
 
24
/* TODO:        humidity / temperature / gas dispersion sensor,
 
25
 *                      including a model that describes the dispersion of this environmental property. A special GMComponent need to be implemented,
 
26
 *                      that simulates the gas dispersion and the sensor requests the current value at its given transform.
 
27
 */
 
28
 
 
29
/* TODO:        When an improved sensor model has been defined and it is clear what sensors will be on the real robot, these sensors need
 
30
 *                      to be implemented accordingly.
 
31
 */
 
32
 
 
33
#include <srCore/sensor/sensorBase.h>
 
34
 
 
35
namespace srCore {
 
36
 
 
37
class SampleSensor : public SensorBase
 
38
{
 
39
public:
 
40
        SampleSensor(dtCore::RefPtr<BodyBase> attachedBody = NULL,
 
41
                        osg::Vec3f translation = osg::Vec3f(2,0,0), osg::Vec3f orientation= osg::Vec3f(0,0,0),
 
42
                        std::string name = "noName",
 
43
                        bool active = true);
 
44
 
 
45
        virtual ~SampleSensor();
 
46
 
 
47
        /**
 
48
         * \brief  Writes the parameter value in parameter
 
49
         *
 
50
         *              The available parameters can be retrieved by calling getParameterList()
 
51
         *              See also: ObjectBase::getParameter()
 
52
         *
 
53
         *
 
54
         */
 
55
        void getParameter(const std::string &name, ParameterReturnValue  parameter);
 
56
 
 
57
        /**
 
58
         * \brief  Sets a parameter
 
59
         *
 
60
         *              See also getParameter()
 
61
         *
 
62
         */
 
63
        void setParameter(const std::string &name, ParameterReturnValue  parameter);
 
64
 
 
65
        //! sends command to retrieve data
 
66
        void evaluate(ParameterReturnValue srv);
 
67
 
 
68
        float myFancySimulatedEnvironmentFunction(osg::Vec3f pos, osg::Vec3f rot);
 
69
 
 
70
        /**
 
71
         * \brief Request to get new data
 
72
         *
 
73
         *              Put here your algorithms for simulated temperature, humidity and  what so ever that can be expressed by function depending on the position and orientation.
 
74
         *
 
75
         */
 
76
        void requestData();
 
77
 
 
78
        /**
 
79
         * \brief       Calculates a new sensor value
 
80
         *
 
81
         * It will be called every time step if it is an active sensor, otherwise it needs to be called by the controller
 
82
         *
 
83
         */
 
84
        virtual void getNewSensorValue();
 
85
 
 
86
        //! sets up sensor
 
87
        void setup() {};
 
88
 
 
89
        //! Will be called in RobotActorBase::TickLocal()
 
90
        void update(float deltaSimTme);
 
91
 
 
92
 
 
93
protected:
 
94
        virtual void getSensorValue(std::ostream& theStream) const;
 
95
 
 
96
private:
 
97
 
 
98
        float sensorValue;
 
99
 
 
100
};
 
101
}
 
102
 
 
103
#endif /* SAMPLESENSOR_H_ */