YARP
Yet Another Robot Platform
AnalogSensorClient Class Reference

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

#include <AnalogSensorClient/AnalogSensorClient.h>

+ Inheritance diagram for AnalogSensorClient:

Public Member Functions

 AnalogSensorClient ()=default
 
 AnalogSensorClient (const AnalogSensorClient &)=delete
 
 AnalogSensorClient (AnalogSensorClient &&)=delete
 
AnalogSensorClientoperator= (const AnalogSensorClient &)=delete
 
AnalogSensorClientoperator= (AnalogSensorClient &&)=delete
 
 ~AnalogSensorClient () override=default
 
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
 ~DeviceDriver () override=default
 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 ()
 

Protected Member Functions

void removeLeadingTrailingSlashesOnly (std::string &name)
 

Protected Attributes

InputPortProcessor inputPort
 
yarp::os::Port rpcPort
 
std::string local
 
std::string remote
 
yarp::os::Stamp lastTs
 
std::string robotName
 
std::string deviceId
 
std::string sensorType
 
std::string portPrefix
 

Additional Inherited Members

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

Detailed Description

analogsensorclient: 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 89 of file AnalogSensorClient.h.

Constructor & Destructor Documentation

◆ AnalogSensorClient() [1/3]

AnalogSensorClient::AnalogSensorClient ( )
default

◆ AnalogSensorClient() [2/3]

AnalogSensorClient::AnalogSensorClient ( const AnalogSensorClient )
delete

◆ AnalogSensorClient() [3/3]

AnalogSensorClient::AnalogSensorClient ( AnalogSensorClient &&  )
delete

◆ ~AnalogSensorClient()

AnalogSensorClient::~AnalogSensorClient ( )
overridedefault

Member Function Documentation

◆ calibrateChannel() [1/2]

int AnalogSensorClient::calibrateChannel ( int  ch)
overridevirtual

Calibrates one single channel.

Parameters
chchannel number.
Returns
status.

Implements yarp::dev::IAnalogSensor.

Definition at line 289 of file AnalogSensorClient.cpp.

◆ calibrateChannel() [2/2]

int 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 299 of file AnalogSensorClient.cpp.

◆ calibrateSensor() [1/2]

int AnalogSensorClient::calibrateSensor ( )
overridevirtual

Calibrates the whole sensor.

Returns
status.

Implements yarp::dev::IAnalogSensor.

Definition at line 268 of file AnalogSensorClient.cpp.

◆ calibrateSensor() [2/2]

int 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 277 of file AnalogSensorClient.cpp.

◆ close()

bool AnalogSensorClient::close ( )
overridevirtual

Close the DeviceDriver.

Returns
true/false on success/failure.

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 245 of file AnalogSensorClient.cpp.

◆ getChannels()

int 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 263 of file AnalogSensorClient.cpp.

◆ getLastInputStamp()

Stamp AnalogSensorClient::getLastInputStamp ( )
overridevirtual

Get the time stamp for the last read data.

Returns
last time stamp.

Implements yarp::dev::IPreciselyTimed.

Definition at line 310 of file AnalogSensorClient.cpp.

◆ getState()

int 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 257 of file AnalogSensorClient.cpp.

◆ open()

bool 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 189 of file AnalogSensorClient.cpp.

◆ operator=() [1/2]

AnalogSensorClient& AnalogSensorClient::operator= ( AnalogSensorClient &&  )
delete

◆ operator=() [2/2]

AnalogSensorClient& AnalogSensorClient::operator= ( const AnalogSensorClient )
delete

◆ read()

int 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 252 of file AnalogSensorClient.cpp.

◆ removeLeadingTrailingSlashesOnly()

void AnalogSensorClient::removeLeadingTrailingSlashesOnly ( std::string &  name)
protected

Definition at line 162 of file AnalogSensorClient.cpp.

Member Data Documentation

◆ deviceId

std::string AnalogSensorClient::deviceId
protected

Definition at line 101 of file AnalogSensorClient.h.

◆ inputPort

InputPortProcessor AnalogSensorClient::inputPort
protected

Definition at line 95 of file AnalogSensorClient.h.

◆ lastTs

yarp::os::Stamp AnalogSensorClient::lastTs
protected

Definition at line 99 of file AnalogSensorClient.h.

◆ local

std::string AnalogSensorClient::local
protected

Definition at line 97 of file AnalogSensorClient.h.

◆ portPrefix

std::string AnalogSensorClient::portPrefix
protected

Definition at line 103 of file AnalogSensorClient.h.

◆ remote

std::string AnalogSensorClient::remote
protected

Definition at line 98 of file AnalogSensorClient.h.

◆ robotName

std::string AnalogSensorClient::robotName
protected

Definition at line 100 of file AnalogSensorClient.h.

◆ rpcPort

yarp::os::Port AnalogSensorClient::rpcPort
protected

Definition at line 96 of file AnalogSensorClient.h.

◆ sensorType

std::string AnalogSensorClient::sensorType
protected

Definition at line 102 of file AnalogSensorClient.h.


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