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
discretesizable.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 __DISCRETESIZABLE_H
25 #define __DISCRETESIZABLE_H
26 
27 //#include <iostream>
28 //#include <list>
29 //#include <utility>
30 //#include <string>
31 //#include <map>
32 //#include "stl_adds.h"
33 
34 
35 
36 /**
37  * Abstact class for discretesizable controllers. Implements the methods
38  * step(...) and stepNoLearning(...) and defines the methods dStep(...)
39  * respectively dStepNoLearning(...), which are called from the implemented
40  * one.
41  *
42  * Hint: Do not mistake dStep(...) for a method from the ODE.
43  *
44  * Additionally the controller implementing this interface must give the range
45  * and intervalCount in the constructor of this interface for configuring the
46  * discretization correctly.
47  *
48  * Note: This interface does only discretesize the sensor values.
49  */
51 public:
52 
53  /** Initializes the discretization.
54  * @param intervalCount sets the number of intervals
55  * @param mapToInteger if true, all intervals are mapped to 0..(intervalCount-1)
56  * @param minSensorValue is neccessary if the sensor range is not in [-1,1]
57  * @param maxSensorValue is neccessary if the sensor range is not in [-1,1]
58  */
59  Discretesizable(int intervalCount, boolean mapToInteger=true, double minSensorValue=-1.0, double maxSensorValue=1.0);
60 
61  virtual ~Discretesizable() {};
62 
63  /** performs one step (includes learning).
64  * Calculates motor commands from sensor inputs.
65  * @note This method cannot be overwritten, use @see dStep instead.
66  * @param sensors sensors inputs scaled to [-1,1]
67  * @param sensornumber length of the sensor array
68  * @param motors motors outputs. MUST have enough space for motor values!
69  * @param motornumber length of the provided motor array
70  */
71  void step(const sensor* sensors, int sensornumber, motor* motors, int motornumber) {
72  DiscreteControllerAdapter::step( sensors,sensornumber, motors, motornumber);
73  }
74 
75  /** performs one step without learning.
76  * @see step
77  * @note This method cannot be overwritten, use @see dStepNoLearning
78  * instead.
79  */
80  void stepNoLearning(const sensor* sensors , int sensornumber,
81  motor* motors, int motornumber) {
82  DiscreteControllerAdapter::step( sensors,sensornumber, motors, motornumber);
83  }
84 
85 protected:
86  ;
87 
88 private:
89 
90 };
91 
92 
93 #endif
void stepNoLearning(const sensor *sensors, int sensornumber, motor *motors, int motornumber)
performs one step without learning.
Definition: discretesizable.h:80
double sensor
Definition: abstractcontroller.h:48
Adapter class for robot controller.
Definition: discretecontrolleradapter.h:53
virtual ~Discretesizable()
Definition: discretesizable.h:61
void step(const sensor *sensors, int sensornumber, motor *motors, int motornumber)
performs one step (includes learning).
Definition: discretesizable.h:71
Discretesizable(int intervalCount, boolean mapToInteger=true, double minSensorValue=-1.0, double maxSensorValue=1.0)
Initializes the discretization.
double motor
Definition: abstractcontroller.h:49
Abstact class for discretesizable controllers.
Definition: discretesizable.h:50
virtual void step(const sensor *sensors, int sensornumber, motor *motors, int motornumber)
performs one step (includes learning).
Definition: discretecontrolleradapter.cpp:115