iCub-main
Public Member Functions | Protected Attributes | List of all members
CanBusAnalogSensor Class Reference

canbusanalogsensor : driver for CAN communication with IIT's analog sensor boards, including the MAIS and STRAIN boards. More...

#include <CanBusAnalogSensor.h>

+ Inheritance diagram for CanBusAnalogSensor:

Public Member Functions

 CanBusAnalogSensor (int period=20)
 
 ~CanBusAnalogSensor ()
 
virtual bool open (yarp::os::Searchable &config)
 
virtual bool close ()
 
virtual int read (yarp::sig::Vector &out)
 
virtual int getState (int ch)
 
virtual int getChannels ()
 
int calibrateSensor ()
 
virtual int calibrateChannel (int ch, double v)
 
virtual int calibrateSensor (const yarp::sig::Vector &v)
 
virtual int calibrateChannel (int ch)
 
virtual bool threadInit ()
 
virtual void threadRelease ()
 
virtual void run ()
 

Protected Attributes

PolyDriver driver
 
ICanBus * pCanBus
 
ICanBufferFactory * pCanBufferFactory
 
CanBuffer inBuffer
 
CanBuffer outBuffer
 
int canDeviceNum
 
std::mutex mtx
 
unsigned int channelsNum
 
unsigned short boardId
 
short status
 
double timeStamp
 
AnalogDataFormat dataFormat
 
yarp::sig::Vector data
 
yarp::sig::Vector scaleFactor
 
unsigned short useCalibration
 
bool diagnostic
 

Detailed Description

canbusanalogsensor : driver for CAN communication with IIT's analog sensor boards, including the MAIS and STRAIN boards.

YARP device name
canbusanalogsensor

Parameters accepted in the config argument of the open method:

Parameter name Type Units Default Value Required Description Notes
canbusDevice string - - Yes Yarp device name of CAN Bus wrapper -
physDevice string - - Yes Yarp device name for the low level CAN device driver -
canDeviceNum int - - Yes ID of the CAN Bus line -
canAddress int - - Yes CAN Bus Address for the sensor board -
format int bits - Yes Format (i.e. number of bits) of analog data transmitted on the CAN bus (16 for STRAIN board, 8 for MAIS board) -
period int ms - Yes Publication period (in ms) of the sensor reading on the Can Bus -
channels int - - Yes Number of output channels of the sensor (6 for STRAIN board, 16 for MAIS board) -
useCalibration int - - No If useCalibration is present and set to 1 output the calibrated readings, otherwise output the raw values -
diagnostic int - - No If diagnostic is present and set to 1 properly return the state of the sensor, otherwise always return IAnalogSensor::AS_OK -

Definition at line 42 of file CanBusAnalogSensor.h.

Constructor & Destructor Documentation

◆ CanBusAnalogSensor()

CanBusAnalogSensor::CanBusAnalogSensor ( int  period = 20)
inline

Definition at line 81 of file CanBusAnalogSensor.h.

◆ ~CanBusAnalogSensor()

CanBusAnalogSensor::~CanBusAnalogSensor ( )
inline

Definition at line 85 of file CanBusAnalogSensor.h.

Member Function Documentation

◆ calibrateChannel() [1/2]

int CanBusAnalogSensor::calibrateChannel ( int  ch)
virtual

Definition at line 350 of file CanBusAnalogSensor.cpp.

◆ calibrateChannel() [2/2]

int CanBusAnalogSensor::calibrateChannel ( int  ch,
double  v 
)
virtual

Definition at line 338 of file CanBusAnalogSensor.cpp.

◆ calibrateSensor() [1/2]

int CanBusAnalogSensor::calibrateSensor ( )

Definition at line 332 of file CanBusAnalogSensor.cpp.

◆ calibrateSensor() [2/2]

int CanBusAnalogSensor::calibrateSensor ( const yarp::sig::Vector &  v)
virtual

Definition at line 344 of file CanBusAnalogSensor.cpp.

◆ close()

bool CanBusAnalogSensor::close ( )
virtual

Definition at line 288 of file CanBusAnalogSensor.cpp.

◆ getChannels()

int CanBusAnalogSensor::getChannels ( )
virtual

Definition at line 327 of file CanBusAnalogSensor.cpp.

◆ getState()

int CanBusAnalogSensor::getState ( int  ch)
virtual

Definition at line 319 of file CanBusAnalogSensor.cpp.

◆ open()

bool CanBusAnalogSensor::open ( yarp::os::Searchable &  config)
virtual

Definition at line 19 of file CanBusAnalogSensor.cpp.

◆ read()

int CanBusAnalogSensor::read ( yarp::sig::Vector &  out)
virtual

Definition at line 307 of file CanBusAnalogSensor.cpp.

◆ run()

void CanBusAnalogSensor::run ( )
virtual

Definition at line 446 of file CanBusAnalogSensor.cpp.

◆ threadInit()

bool CanBusAnalogSensor::threadInit ( )
virtual

Definition at line 356 of file CanBusAnalogSensor.cpp.

◆ threadRelease()

void CanBusAnalogSensor::threadRelease ( )
virtual

Definition at line 518 of file CanBusAnalogSensor.cpp.

Member Data Documentation

◆ boardId

unsigned short CanBusAnalogSensor::boardId
protected

Definition at line 71 of file CanBusAnalogSensor.h.

◆ canDeviceNum

int CanBusAnalogSensor::canDeviceNum
protected

Definition at line 66 of file CanBusAnalogSensor.h.

◆ channelsNum

unsigned int CanBusAnalogSensor::channelsNum
protected

Definition at line 70 of file CanBusAnalogSensor.h.

◆ data

yarp::sig::Vector CanBusAnalogSensor::data
protected

Definition at line 75 of file CanBusAnalogSensor.h.

◆ dataFormat

AnalogDataFormat CanBusAnalogSensor::dataFormat
protected

Definition at line 74 of file CanBusAnalogSensor.h.

◆ diagnostic

bool CanBusAnalogSensor::diagnostic
protected

Definition at line 78 of file CanBusAnalogSensor.h.

◆ driver

PolyDriver CanBusAnalogSensor::driver
protected

Definition at line 61 of file CanBusAnalogSensor.h.

◆ inBuffer

CanBuffer CanBusAnalogSensor::inBuffer
protected

Definition at line 64 of file CanBusAnalogSensor.h.

◆ mtx

std::mutex CanBusAnalogSensor::mtx
protected

Definition at line 68 of file CanBusAnalogSensor.h.

◆ outBuffer

CanBuffer CanBusAnalogSensor::outBuffer
protected

Definition at line 65 of file CanBusAnalogSensor.h.

◆ pCanBufferFactory

ICanBufferFactory* CanBusAnalogSensor::pCanBufferFactory
protected

Definition at line 63 of file CanBusAnalogSensor.h.

◆ pCanBus

ICanBus* CanBusAnalogSensor::pCanBus
protected

Definition at line 62 of file CanBusAnalogSensor.h.

◆ scaleFactor

yarp::sig::Vector CanBusAnalogSensor::scaleFactor
protected

Definition at line 76 of file CanBusAnalogSensor.h.

◆ status

short CanBusAnalogSensor::status
protected

Definition at line 72 of file CanBusAnalogSensor.h.

◆ timeStamp

double CanBusAnalogSensor::timeStamp
protected

Definition at line 73 of file CanBusAnalogSensor.h.

◆ useCalibration

unsigned short CanBusAnalogSensor::useCalibration
protected

Definition at line 77 of file CanBusAnalogSensor.h.


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