22 #include <yarp/os/Bottle.h>
23 #include <yarp/os/Value.h>
28 namespace learningmachine {
41 std::ostringstream buffer;
42 buffer <<
"Type: " << this->
getName() <<
", ";
43 buffer <<
"Offset: " << this->
offset <<
", ";
44 buffer <<
"Scale: " << this->
scale <<
", ";
45 buffer <<
"Update: " << (this->
updateEnabled ?
"enabled" :
"disabled");
50 yarp::os::Bottle model;
52 return model.toString().c_str();
56 yarp::os::Bottle model(str.c_str());
62 bot.addFloat64(this->
offset);
63 bot.addFloat64(this->
scale);
69 this->
scale = bot.pop().asFloat64();
70 this->
offset = bot.pop().asFloat64();
77 if(!config.findGroup(
"update").isNull()) {
83 if(!config.findGroup(
"enable").isNull()) {
89 if(!config.findGroup(
"disable").isNull()) {
virtual std::string getInfo()
Asks the learning machine to return a string containing statistics on its operation so far.
virtual std::string toString()
Asks the scaler to return a string serialization.
std::string getName() const
Retrieve the name of this scaler.
virtual void writeBottle(yarp::os::Bottle &bot)
Writes a serialization of the scaler into a bottle.
double scale
The scale for the linear transformation.
virtual void update(double val)
Feeds a single sample into the scaler, so that it can use this sample to update the offset and scale.
bool updateEnabled
Boolean indicating whether the scaler has to update each sample.
virtual double transform(double val)
Transforms a single sample value according to the state of the scaler.
virtual void setUpdateEnabled(bool u)
Mutator for the update state.
virtual bool fromString(const std::string &str)
Asks the scaler to initialize from a string serialization.
virtual void readBottle(yarp::os::Bottle &bot)
Unserializes a scaler from a bottle.
virtual bool getUpdateEnabled()
Accessor for the update state.
double offset
The offset for the linear transformation.
virtual bool configure(yarp::os::Searchable &config)
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.