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 IConfig.
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
iCub
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.
Definition: emotionInterface.h:17
iCub::learningmachine::FixedRangeScaler::setLowerBoundOut
virtual void setLowerBoundOut(double lo)
Mutator for the desired lower bound.
Definition: FixedRangeScaler.h:115
iCub::learningmachine::FixedRangeScaler::upperBoundOut
double upperBoundOut
The desired upper bound for the output range.
Definition: FixedRangeScaler.h:59
iCub::learningmachine::FixedRangeScaler::FixedRangeScaler
FixedRangeScaler(double li=-1., double ui=1., double lo=-1., double uo=1.)
Constructor.
Definition: FixedRangeScaler.cpp:32
iCub::learningmachine::FixedRangeScaler::upperBoundIn
double upperBoundIn
The expected upper bound in the sample values.
Definition: FixedRangeScaler.h:49
iCub::learningmachine::FixedRangeScaler::lowerBoundIn
double lowerBoundIn
The expected lower bound in the sample values.
Definition: FixedRangeScaler.h:44
iCub::learningmachine::FixedRangeScaler::setLowerBoundIn
virtual void setLowerBoundIn(double li)
Mutator for the expected lower bound.
Definition: FixedRangeScaler.h:145
iCub::learningmachine::FixedRangeScaler::updateScales
void updateScales()
Updates the scale and offset according to the specified expected and desired ranges.
Definition: FixedRangeScaler.cpp:38
iCub::learningmachine::FixedRangeScaler::readBottle
virtual void readBottle(yarp::os::Bottle &bot)
Unserializes a scaler from a bottle.
Definition: FixedRangeScaler.cpp:61
iCub::learningmachine::IScaler
Definition: IScaler.h:41
iCub::learningmachine::FixedRangeScaler::clone
FixedRangeScaler * clone()
Asks the scaler to return a new object of its type.
Definition: FixedRangeScaler.h:101
IScaler.h
string
string(REPLACE "-rdynamic" "" CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}") include_directories($
Definition: CMakeLists.txt:9
iCub::learningmachine::FixedRangeScaler::configure
virtual bool configure(yarp::os::Searchable &config)
Definition: FixedRangeScaler.cpp:70
iCub::learningmachine::FixedRangeScaler
Definition: FixedRangeScaler.h:39
iCub::learningmachine::FixedRangeScaler::getUpperBoundOut
virtual double getUpperBoundOut()
Accessor for the desired upper bound.
Definition: FixedRangeScaler.h:123
iCub::learningmachine::FixedRangeScaler::getInfo
virtual std::string getInfo()
Asks the learning machine to return a string containing statistics on its operation so far.
Definition: FixedRangeScaler.cpp:44
iCub::learningmachine::FixedRangeScaler::getLowerBoundOut
virtual double getLowerBoundOut()
Accessor for the desired lower bound.
Definition: FixedRangeScaler.h:108
iCub::learningmachine::FixedRangeScaler::getUpperBoundIn
virtual double getUpperBoundIn()
Accessor for the expected upper bound.
Definition: FixedRangeScaler.h:153
iCub::learningmachine::FixedRangeScaler::lowerBoundOut
double lowerBoundOut
The desired lower bound for the output range.
Definition: FixedRangeScaler.h:54
iCub::learningmachine::FixedRangeScaler::getLowerBoundIn
virtual double getLowerBoundIn()
Accessor for the expected lower bound.
Definition: FixedRangeScaler.h:138
iCub::learningmachine::FixedRangeScaler::writeBottle
virtual void writeBottle(yarp::os::Bottle &bot)
Writes a serialization of the scaler into a bottle.
Definition: FixedRangeScaler.cpp:54
iCub::learningmachine::FixedRangeScaler::setUpperBoundOut
virtual void setUpperBoundOut(double uo)
Mutator for the desired upper bound.
Definition: FixedRangeScaler.h:130
iCub::learningmachine::FixedRangeScaler::setUpperBoundIn
virtual void setUpperBoundIn(double ui)
Mutator for the expected upper bound.
Definition: FixedRangeScaler.h:160