YARP
Yet Another Robot Platform
yarp::dev::AnalogSensorClient Class Reference

Device that reads an AnalogSensor (using the IAnalogSensor interface) from the YARP network. More...

#include <AnalogSensorClient/AnalogSensorClient.h>

+ Inheritance diagram for yarp::dev::AnalogSensorClient:

Detailed Description

Device that reads an AnalogSensor (using the IAnalogSensor interface) from the YARP network.

Description of input parameters

This device will connect to a port opened by the AnalogWrapper device and read the data broadcasted making them available to use for the user application. It also made available some function to check and control the state of the remote sensor.

Parameters accepted in the config argument of the open method:

Parameter name Type Units Default Value Required Description Notes
local string Yes full name if the port opened by the device must start with a '/' character
remote string Yes full name of the port the device need to connect to must start with a '/' character
carrier string udp No type of carrier to use, like tcp, udp and so on ... -

The device will create a port with name <local> and will connect to a port colled <remote> at startup, ex: /myModule/left_arm/ForceTorque , and will connect to a port called /icub/left_arm/ForceTorque.

Definition at line 99 of file AnalogSensorClient.h.

Public Member Functions

bool open (yarp::os::Searchable &config) override
 Open the DeviceDriver. More...
 
bool close () override
 Close the DeviceDriver. More...
 
int read (yarp::sig::Vector &out) override
 Read a vector from the sensor. More...
 
int getState (int ch) override
 Check the state value of a given channel. More...
 
int getChannels () override
 Get the number of channels of the sensor. More...
 
int calibrateSensor () override
 Calibrates the whole sensor. More...
 
int calibrateSensor (const yarp::sig::Vector &value) override
 Calibrates the whole sensor, using an vector of calibration values. More...
 
int calibrateChannel (int ch) override
 Calibrates one single channel. More...
 
int calibrateChannel (int ch, double value) override
 Calibrates one single channel, using a calibration value. More...
 
yarp::os::Stamp getLastInputStamp () override
 Get the time stamp for the last read data. More...
 
- Public Member Functions inherited from yarp::dev::DeviceDriver
virtual ~DeviceDriver ()
 Destructor. More...
 
template<class T >
bool view (T *&x)
 Get an interface to the device driver. More...
 
virtual DeviceDrivergetImplementation ()
 Some drivers are bureaucrats, pointing at others. More...
 
- Public Member Functions inherited from yarp::os::IConfig
virtual ~IConfig ()
 Destructor. More...
 
virtual bool configure (Searchable &config)
 Change online parameters. More...
 
- Public Member Functions inherited from yarp::dev::IPreciselyTimed
virtual ~IPreciselyTimed ()
 
- Public Member Functions inherited from yarp::dev::IAnalogSensor
virtual ~IAnalogSensor ()
 

Additional Inherited Members

- Public Types inherited from yarp::dev::IAnalogSensor
enum  {
  AS_OK =0,
  AS_ERROR =1,
  AS_OVF =2,
  AS_TIMEOUT =3
}
 

Member Function Documentation

◆ calibrateChannel() [1/2]

int yarp::dev::AnalogSensorClient::calibrateChannel ( int  ch)
overridevirtual

Calibrates one single channel.

Parameters
chchannel number.
Returns
status.

Implements yarp::dev::IAnalogSensor.

Definition at line 285 of file AnalogSensorClient.cpp.

◆ calibrateChannel() [2/2]

int yarp::dev::AnalogSensorClient::calibrateChannel ( int  ch,
double  value 
)
overridevirtual

Calibrates one single channel, using a calibration value.

Parameters
chchannel number.
valuecalibration value.
Returns
status.

Implements yarp::dev::IAnalogSensor.

Definition at line 295 of file AnalogSensorClient.cpp.

◆ calibrateSensor() [1/2]

int yarp::dev::AnalogSensorClient::calibrateSensor ( )
overridevirtual

Calibrates the whole sensor.

Returns
status.

Implements yarp::dev::IAnalogSensor.

Definition at line 264 of file AnalogSensorClient.cpp.

◆ calibrateSensor() [2/2]

int yarp::dev::AnalogSensorClient::calibrateSensor ( const yarp::sig::Vector value)
overridevirtual

Calibrates the whole sensor, using an vector of calibration values.

Parameters
valuea vector of calibration values.
Returns
status.

Implements yarp::dev::IAnalogSensor.

Definition at line 273 of file AnalogSensorClient.cpp.

◆ close()

bool yarp::dev::AnalogSensorClient::close ( void  )
overridevirtual

Close the DeviceDriver.

Returns
true/false on success/failure.

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 241 of file AnalogSensorClient.cpp.

◆ getChannels()

int yarp::dev::AnalogSensorClient::getChannels ( )
overridevirtual

Get the number of channels of the sensor.

Returns
number of channels (0 in case of errors).

Implements yarp::dev::IAnalogSensor.

Definition at line 259 of file AnalogSensorClient.cpp.

◆ getLastInputStamp()

Stamp yarp::dev::AnalogSensorClient::getLastInputStamp ( )
overridevirtual

Get the time stamp for the last read data.

Returns
last time stamp.

Implements yarp::dev::IPreciselyTimed.

Definition at line 306 of file AnalogSensorClient.cpp.

◆ getState()

int yarp::dev::AnalogSensorClient::getState ( int  ch)
overridevirtual

Check the state value of a given channel.

Parameters
chchannel number.
Returns
status.

Implements yarp::dev::IAnalogSensor.

Definition at line 253 of file AnalogSensorClient.cpp.

◆ open()

bool yarp::dev::AnalogSensorClient::open ( yarp::os::Searchable config)
overridevirtual

Open the DeviceDriver.

Parameters
configis a list of parameters for the device. Which parameters are effective for your device can vary. See device invocation examples. If there is no example for your device, you can run the "yarpdev" program with the verbose flag set to probe what parameters the device is checking. If that fails too, you'll need to read the source code (please nag one of the yarp developers to add documentation for your device).
Returns
true/false upon success/failure

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 185 of file AnalogSensorClient.cpp.

◆ read()

int yarp::dev::AnalogSensorClient::read ( yarp::sig::Vector out)
overridevirtual

Read a vector from the sensor.

Parameters
outa vector containing the sensor's last readings.
Returns
AS_OK or return code. AS_TIMEOUT if the sensor timed-out.

Implements yarp::dev::IAnalogSensor.

Definition at line 248 of file AnalogSensorClient.cpp.


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