iCub-main
FixedRangeScaler.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2011 RobotCub Consortium, European Commission FP6 Project IST-004370
3  * author: Arjan Gijsberts
4  * email: arjan.gijsberts@iit.it
5  * website: www.robotcub.org
6  * Permission is granted to copy, distribute, and/or modify this program
7  * under the terms of the GNU General Public License, version 2 or any
8  * later version published by the Free Software Foundation.
9  *
10  * A copy of the license can be found at
11  * http://www.robotcub.org/icub/license/gpl.txt
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16  * Public License for more details
17  */
18 
19 #ifndef LM_FIXEDRANGESCALER__
20 #define LM_FIXEDRANGESCALER__
21 
23 
24 
25 namespace iCub {
26 namespace learningmachine {
27 
39 class FixedRangeScaler : public IScaler {
40 protected:
44  double lowerBoundIn;
45 
49  double upperBoundIn;
50 
54  double lowerBoundOut;
55 
59  double upperBoundOut;
60 
65  void updateScales();
66 
67  /*
68  * Inherited from IScaler
69  */
70  virtual void writeBottle(yarp::os::Bottle& bot);
71 
72  /*
73  * Inherited from IScaler
74  */
75  virtual void readBottle(yarp::os::Bottle& bot);
76 
77 public:
86  FixedRangeScaler(double li = -1., double ui = 1., double lo = -1., double uo = 1.);
87 
88  /*
89  * Inherited from IScaler
90  */
91  virtual std::string getInfo();
92 
93  /*
94  * Inherited from IScaler.
95  */
96  virtual bool configure(yarp::os::Searchable& config);
97 
98  /*
99  * Inherited from IScaler.
100  */
102  return new FixedRangeScaler(*this);
103  }
104 
108  virtual double getLowerBoundOut() { return this->lowerBoundOut; }
109 
115  virtual void setLowerBoundOut(double lo) {
116  this->lowerBoundOut = lo;
117  this->updateScales();
118  }
119 
123  virtual double getUpperBoundOut() { return this->upperBoundOut; }
124 
130  virtual void setUpperBoundOut(double uo) {
131  this->upperBoundOut = uo;
132  this->updateScales();
133  }
134 
138  virtual double getLowerBoundIn() { return this->lowerBoundIn; }
139 
145  virtual void setLowerBoundIn(double li) {
146  this->lowerBoundIn = li;
147  this->updateScales();
148  }
149 
153  virtual double getUpperBoundIn() { return this->upperBoundIn; }
154 
160  virtual void setUpperBoundIn(double ui) {
161  this->upperBoundIn = ui;
162  this->updateScales();
163  }
164 
165 };
166 
167 } // learningmachine
168 } // iCub
169 
170 #endif
A class that implements preprocessing based on a fixed range of outputs to a fixed range of outputs.
virtual double getLowerBoundOut()
Accessor for the desired lower bound.
virtual double getLowerBoundIn()
Accessor for the expected lower bound.
double upperBoundIn
The expected upper bound in the sample values.
double upperBoundOut
The desired upper bound for the output range.
virtual std::string getInfo()
Asks the learning machine to return a string containing statistics on its operation so far.
virtual void writeBottle(yarp::os::Bottle &bot)
Writes a serialization of the scaler into a bottle.
virtual void readBottle(yarp::os::Bottle &bot)
Unserializes a scaler from a bottle.
FixedRangeScaler(double li=-1., double ui=1., double lo=-1., double uo=1.)
Constructor.
virtual void setUpperBoundOut(double uo)
Mutator for the desired upper bound.
virtual double getUpperBoundIn()
Accessor for the expected upper bound.
virtual void setUpperBoundIn(double ui)
Mutator for the expected upper bound.
virtual void setLowerBoundOut(double lo)
Mutator for the desired lower bound.
double lowerBoundIn
The expected lower bound in the sample values.
double lowerBoundOut
The desired lower bound for the output range.
virtual double getUpperBoundOut()
Accessor for the desired upper bound.
void updateScales()
Updates the scale and offset according to the specified expected and desired ranges.
virtual void setLowerBoundIn(double li)
Mutator for the expected lower bound.
virtual bool configure(yarp::os::Searchable &config)
FixedRangeScaler * clone()
Asks the scaler to return a new object of its type.
The IScaler is a linear scaler based scaler.
Definition: IScaler.h:41
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.