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
measureadapter.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 __MEASUREADAPTER_H
25 #define __MEASUREADAPTER_H
26 
28 #include "backcaller.h"
29 #include "statistictools.h"
30 #include "complexmeasure.h"
31 
32 // begin forward declaration
33 // end forward declaration
34 
35 /**
36  * This is a passive controller adapter who is passive and can handle AbstractMeasures.
37  * Normally the sensor and/or motor values are measured.
38  * @see AbstractControllerAdapter
39  */
41 {
42 
43 public:
44 
45  /**
46  * Constructs the MeasureAdapter.
47  *
48  */
49  MeasureAdapter(AbstractController* controller, const std::string& name = "MeasureAdapter", const std::string& revision = "$ID$");
50 
51  virtual ~MeasureAdapter();
52 
53  /**
54  * Adds a ComplexMeasure for measuring sensor values. For each
55  * sensor a ComplexMeasure is created.
56  */
57  virtual std::list<ComplexMeasure*> addSensorComplexMeasure(char* measureName, ComplexMeasureMode mode,int numberBins, int stepSize);
58 
59  /****************************************************************************/
60  /* BEGIN methods of AbstractController */
61  /****************************************************************************/
62 
63  /** initialisation of the controller with the given sensor/ motornumber
64  * Must NORMALLY be called before use. For all ControllerAdapters
65  * call first AbstractControllerAdapter::init(sensornumber,motornumber)
66  * if you overwrite this method
67  */
68  virtual void init(int sensornumber, int motornumber, RandGen* randGen = 0);
69 
70  /** performs one step (includes learning).
71  Calculates motor commands from sensor inputs.
72  @param sensors sensors inputs scaled to [-1,1]
73  @param sensornumber length of the sensor array
74  @param motors motors outputs. MUST have enough space for motor values!
75  @param motornumber length of the provided motor array
76  */
77  virtual void step(const sensor* sensors, int sensornumber,
78  motor* motors, int motornumber);
79 
80  /** performs one step without learning.
81  @see step
82  */
83  virtual void stepNoLearning(const sensor* sensors , int sensornumber,
84  motor* motors, int motornumber);
85 
86  /****************************************************************************/
87  /* END methods of AbstractController */
88  /****************************************************************************/
89 
90  /****************************************************************************/
91  /* BEGIN methods of Storeable */
92  /****************************************************************************/
93 
94  /****************************************************************************/
95  /* END methods of Storeable */
96  /****************************************************************************/
97 
98  /****************************************************************************/
99  /* BEGIN methods of Inspectable */
100  /****************************************************************************/
101 
102  // nothing to overwrite
103 
104  /****************************************************************************/
105  /* END methods of Inspectable */
106  /****************************************************************************/
107 
108 
109  virtual StatisticTools* getStatisticTools() { return st; }
110 
111 protected:
116 
117 };
118 
119 #endif
virtual std::list< ComplexMeasure * > addSensorComplexMeasure(char *measureName, ComplexMeasureMode mode, int numberBins, int stepSize)
Adds a ComplexMeasure for measuring sensor values.
Definition: measureadapter.cpp:39
virtual ~MeasureAdapter()
Definition: measureadapter.cpp:34
Abstract class for robot controller (with some basic functionality).
Definition: abstractcontroller.h:46
virtual void step(const sensor *sensors, int sensornumber, motor *motors, int motornumber)
performs one step (includes learning).
Definition: measureadapter.cpp:82
StatisticTools * st
Definition: measureadapter.h:112
Abstract adapter class (interface) for robot controller.
Definition: abstractcontrolleradapter.h:52
double sensor
Definition: types.h:29
iparamkey name
Definition: inspectable.h:251
random generator with 48bit integer arithmentic
Definition: randomgenerator.h:34
AbstractController * controller
Definition: abstractcontrolleradapter.h:158
sensor * sensorValues
Definition: measureadapter.h:115
virtual StatisticTools * getStatisticTools()
Definition: measureadapter.h:109
virtual void stepNoLearning(const sensor *sensors, int sensornumber, motor *motors, int motornumber)
performs one step without learning.
Definition: measureadapter.cpp:92
motor * motorValues
Definition: measureadapter.h:114
MeasureAdapter(AbstractController *controller, const std::string &name="MeasureAdapter", const std::string &revision="$ID$")
Constructs the MeasureAdapter.
Definition: measureadapter.cpp:27
ComplexMeasureMode
measure modes of complex measures.
Definition: complexmeasure.h:34
This is a passive controller adapter who is passive and can handle AbstractMeasures.
Definition: measureadapter.h:40
double motor
Definition: types.h:30
virtual void init(int sensornumber, int motornumber, RandGen *randGen=0)
initialisation of the controller with the given sensor/ motornumber Must NORMALLY be called before us...
Definition: measureadapter.cpp:74
TODO: add possibility to pass description of a measure.
Definition: statistictools.h:45
bool initialized
Definition: measureadapter.h:113