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

#include <nodes.h>

+ Inheritance diagram for iCub::perception::Node:

Public Member Functions

 Node ()
 Constructor. More...
 
std::string getName () const
 Retrieve the node name. More...
 
void attachSensor (Sensor &sensor)
 Attach a sensor object to the node. More...
 
void attachCallback (EventCallback &callback)
 Attach an event callback to the node. More...
 
void addNeighbor (Node &node)
 Add a node as a neighbor for the process of building the architecture. More...
 
bool removeNeighbor (const std::string &name)
 Remove a node previously added as neighbor. More...
 
NodegetNeighbor (const std::string &name) const
 Retrieve a neighbor node by its name. More...
 
virtual bool fromProperty (const yarp::os::Property &options)=0
 Configure the node taking its parameters from a Property object. More...
 
virtual void toProperty (yarp::os::Property &options) const =0
 Return a Property representation of all the node 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 nodes need to be calibrated to properly operate. More...
 
virtual bool isCalibrated () const =0
 Return the internal status of the calibration. More...
 
virtual bool getSensorsData (yarp::os::Value &data) const =0
 Retrieve data from the whole set of attached sensors, giving back a standard representation of it. More...
 
virtual bool getOutput (yarp::os::Value &out) const =0
 Retrieve the node output computed over the sensors data. More...
 
virtual ~Node ()
 Destructor. More...
 

Protected Attributes

std::string name
 
std::map< std::string, Sensor * > sensors
 
std::map< std::string, EventCallback * > callbacks
 
std::map< std::string, Node * > neighbors
 

Detailed Description

An abstract class that exposes the basic methods for the handling of data acquired through the attached sensors.

Definition at line 93 of file nodes.h.

Constructor & Destructor Documentation

◆ Node()

Node::Node ( )

Constructor.

Definition at line 33 of file nodes.cpp.

◆ ~Node()

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

Destructor.

Definition at line 217 of file nodes.h.

Member Function Documentation

◆ addNeighbor()

void Node::addNeighbor ( Node node)

Add a node as a neighbor for the process of building the architecture.

Parameters
nodea node lying in the neighborhood.

Definition at line 54 of file nodes.cpp.

◆ attachCallback()

void Node::attachCallback ( EventCallback callback)

Attach an event callback to the node.

Parameters
callbackthe callback to be attached and that can be raised upon a specific event.

Definition at line 47 of file nodes.cpp.

◆ attachSensor()

void Node::attachSensor ( Sensor sensor)

Attach a sensor object to the node.

Parameters
sensorthe sensor object to be attached, so that the node can use it.

Definition at line 40 of file nodes.cpp.

◆ calibrate()

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

Some kinds of nodes 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
For nodes that do not envisage any calibration, this method should always return true.

Implemented in iCub::perception::SpringyFinger, and iCub::perception::TactileFinger.

◆ fromProperty()

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

Configure the node taking its parameters from a Property object.

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

Implemented in iCub::perception::SpringyFinger, and iCub::perception::TactileFinger.

◆ getName()

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

Retrieve the node name.

Returns
a string containing the node name.

Definition at line 112 of file nodes.h.

◆ getNeighbor()

Node * Node::getNeighbor ( const std::string name) const

Retrieve a neighbor node by its name.

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

Definition at line 75 of file nodes.cpp.

◆ getOutput()

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

Retrieve the node output computed over the sensors data.

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

Implemented in iCub::perception::SpringyFinger, and iCub::perception::TactileFinger.

◆ getSensorsData()

virtual bool iCub::perception::Node::getSensorsData ( yarp::os::Value &  data) const
pure virtual

Retrieve data from the whole set of attached sensors, giving back a standard representation of it.

Parameters
dataa Value containing the representation of the data. It can be a double, a string, a collection of doubles and so on.
Returns
true/false on success/failure.

Implemented in iCub::perception::SpringyFinger, and iCub::perception::TactileFinger.

◆ isCalibrated()

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

Return the internal status of the calibration.

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

Implemented in iCub::perception::SpringyFinger, and iCub::perception::TactileFinger.

◆ removeNeighbor()

bool Node::removeNeighbor ( const std::string name)

Remove a node previously added as neighbor.

Parameters
namethe node name uniquely identified.
Returns
true/false on success/failure.

Definition at line 61 of file nodes.cpp.

◆ toProperty()

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

Return a Property representation of all the node parameters.

Parameters
optionsa Property filled with the configuration parameters.

Implemented in iCub::perception::SpringyFinger, and iCub::perception::TactileFinger.

◆ toStream()

virtual bool iCub::perception::Node::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::SpringyFinger, and iCub::perception::TactileFinger.

Member Data Documentation

◆ callbacks

std::map<std::string,EventCallback*> iCub::perception::Node::callbacks
protected

Definition at line 99 of file nodes.h.

◆ name

std::string iCub::perception::Node::name
protected

Definition at line 96 of file nodes.h.

◆ neighbors

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

Definition at line 100 of file nodes.h.

◆ sensors

std::map<std::string,Sensor*> iCub::perception::Node::sensors
protected

Definition at line 98 of file nodes.h.


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