iCub-main
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
iCub::perception::Model Class Referenceabstract

An abstract class that provides basic methods for interfacing with the data acquisition. More...

#include <models.h>

+ Inheritance diagram for iCub::perception::Model:

Public Member Functions

 Model ()
 Constructor. More...
 
std::string getName () const
 Retrieve the model name. More...
 
void attachNode (Node &node)
 Attach a node object to the model. More...
 
NodegetNode (const std::string &name) const
 Retrieve an attached node by its name. More...
 
virtual bool fromProperty (const yarp::os::Property &options)=0
 Configure the model taking its parameters from a Property object. More...
 
virtual void toProperty (yarp::os::Property &options) const =0
 Return a Property representation of all the model parameters. More...
 
virtual bool toStream (std::ostream &str) const =0
 Similar to the toProperty() method but it operates on output streams (e.g. More...
 
virtual bool calibrate (const yarp::os::Property &options)=0
 Some kinds of models need to be calibrated to properly operate. More...
 
virtual bool isCalibrated () const =0
 Return the internal status of the calibration. More...
 
virtual bool getOutput (yarp::os::Value &out) const =0
 Provide the higher layers with the model output computed over the attached sensors. More...
 
virtual ~Model ()
 Destructor. More...
 

Protected Member Functions

virtual void printMessage (const int logtype, const int level, const char *format,...) const
 

Protected Attributes

std::string name
 
int verbosity
 
std::map< std::string, Node * > nodes
 

Detailed Description

An abstract class that provides basic methods for interfacing with the data acquisition.

Definition at line 61 of file models.h.

Constructor & Destructor Documentation

◆ Model()

Model::Model ( )

Constructor.

Definition at line 32 of file models.cpp.

◆ ~Model()

virtual iCub::perception::Model::~Model ( )
inlinevirtual

Destructor.

Definition at line 159 of file models.h.

Member Function Documentation

◆ attachNode()

void Model::attachNode ( Node node)

Attach a node object to the model.

Parameters
nodethe node object to be attached, so that the mode can employ it.

Definition at line 73 of file models.cpp.

◆ calibrate()

virtual bool iCub::perception::Model::calibrate ( const yarp::os::Property &  options)
pure virtual

Some kinds of models need to be calibrated to properly operate.

This method executes the calibration phase.

Parameters
optionsa Property containing the calibration parameters.
Returns
true/false on success/failure.
Note
Usually this method should call the corresponding calibrate method of all the nodes attached to the model.
For models that do not envisage any calibration, this method should always return true.

Implemented in iCub::perception::TactileFingersModel, and iCub::perception::SpringyFingersModel.

◆ fromProperty()

virtual bool iCub::perception::Model::fromProperty ( const yarp::os::Property &  options)
pure virtual

Configure the model taking its parameters from a Property object.

Parameters
optionsa Property containing the configuration parameters.
Returns
true/false on success/failure.

Implemented in iCub::perception::TactileFingersModel, and iCub::perception::SpringyFingersModel.

◆ getName()

std::string iCub::perception::Model::getName ( ) const
inline

Retrieve the model name.

Returns
a string containing the model name.

Definition at line 82 of file models.h.

◆ getNode()

Node * Model::getNode ( const std::string &  name) const

Retrieve an attached node by its name.

Parameters
namethe name of the attached node.
Returns
the pointer to the node.

Definition at line 80 of file models.cpp.

◆ getOutput()

virtual bool iCub::perception::Model::getOutput ( yarp::os::Value &  out) const
pure virtual

Provide the higher layers with the model output computed over the attached sensors.

Parameters
outa Value containing the model output.
Returns
true/false on success/failure.

Implemented in iCub::perception::TactileFingersModel, and iCub::perception::SpringyFingersModel.

◆ isCalibrated()

virtual bool iCub::perception::Model::isCalibrated ( ) const
pure virtual

Return the internal status of the calibration.

Returns
true/false on calibrated/uncalibrated-failure.
Note
For models that do not envisage any calibration, this method should always return true.

Implemented in iCub::perception::TactileFingersModel, and iCub::perception::SpringyFingersModel.

◆ printMessage()

void Model::printMessage ( const int  logtype,
const int  level,
const char *  format,
  ... 
) const
protectedvirtual

Definition at line 39 of file models.cpp.

◆ toProperty()

virtual void iCub::perception::Model::toProperty ( yarp::os::Property &  options) const
pure virtual

Return a Property representation of all the model parameters.

Parameters
optionsa Property filled with the configuration parameters.

Implemented in iCub::perception::TactileFingersModel, and iCub::perception::SpringyFingersModel.

◆ toStream()

virtual bool iCub::perception::Model::toStream ( std::ostream &  str) const
pure virtual

Similar to the toProperty() method but it operates on output streams (e.g.

string, ofstream, ...). It allows to better manage the storing of the configuration over files.

Parameters
strthe reference to the output stream.
Returns
true/false on success/failure.
See also
toProperty

Implemented in iCub::perception::TactileFingersModel, and iCub::perception::SpringyFingersModel.

Member Data Documentation

◆ name

std::string iCub::perception::Model::name
protected

Definition at line 64 of file models.h.

◆ nodes

std::map<std::string,Node*> iCub::perception::Model::nodes
protected

Definition at line 67 of file models.h.

◆ verbosity

int iCub::perception::Model::verbosity
protected

Definition at line 65 of file models.h.


The documentation for this class was generated from the following files: