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

canbusinertialmtb : driver for CAN communication with inertial sensors (accelerometers, gyroscopes) mounted on MTB boards. More...

#include <CanBusInertialMTB.h>

+ Inheritance diagram for CanBusInertialMTB:

Public Member Functions

 CanBusInertialMTB (int period=20)
 
 ~CanBusInertialMTB ()
 
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
 
std::mutex mtx
 
std::vector< MTBInertialBoardInfoboards
 
int nrOfTotalChannels
 
yarp::sig::Vector data
 
yarp::sig::Vector privateData
 
std::vector< short > sharedStatus
 
std::vector< short > privateStatus
 
short sharedGlobalStatus
 
short privateGlobalStatus
 
bool initted
 
int count
 

Detailed Description

canbusinertialmtb : driver for CAN communication with inertial sensors (accelerometers, gyroscopes) mounted on MTB boards.

The minimum MTB firmware version supported by this device is 2.10.17 .

It is possible to read from multiple MTB. This readings will be combined in a single vector.

YARP device name
canbusinertialmtb

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 vector of int - - Yes Vector of the CAN Bus Addresses for the sensor boards -
period int milliseconds 10 No Period of the thread reading messages from the CAN bus -
sensorType int - Yes Type of sensor to read from MTBs. Possible values: acc for the internal LIS331DLH accelerometer of the MTB, extAccAndGyro for the external LIS331DLH accelerometer and L3G4200D gyroscope.
sensorPeriod int milliseconds 5 No Every sensorPeriod milliseconds the MTB publishes the sensor measurements on the CAN Bus Possible values: from 1 to 255

Definition at line 60 of file CanBusInertialMTB.h.

Constructor & Destructor Documentation

◆ CanBusInertialMTB()

CanBusInertialMTB::CanBusInertialMTB ( int  period = 20)
inline

Definition at line 97 of file CanBusInertialMTB.h.

◆ ~CanBusInertialMTB()

CanBusInertialMTB::~CanBusInertialMTB ( )
inline

Definition at line 103 of file CanBusInertialMTB.h.

Member Function Documentation

◆ calibrateChannel() [1/2]

int CanBusInertialMTB::calibrateChannel ( int  ch)
virtual

Definition at line 307 of file CanBusInertialMTB.cpp.

◆ calibrateChannel() [2/2]

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

Definition at line 295 of file CanBusInertialMTB.cpp.

◆ calibrateSensor() [1/2]

int CanBusInertialMTB::calibrateSensor ( )

Definition at line 289 of file CanBusInertialMTB.cpp.

◆ calibrateSensor() [2/2]

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

Definition at line 301 of file CanBusInertialMTB.cpp.

◆ close()

bool CanBusInertialMTB::close ( )
virtual

Definition at line 255 of file CanBusInertialMTB.cpp.

◆ getChannels()

int CanBusInertialMTB::getChannels ( )
virtual

Definition at line 284 of file CanBusInertialMTB.cpp.

◆ getState()

int CanBusInertialMTB::getState ( int  ch)
virtual

Definition at line 278 of file CanBusInertialMTB.cpp.

◆ open()

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

Definition at line 135 of file CanBusInertialMTB.cpp.

◆ read()

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

Definition at line 271 of file CanBusInertialMTB.cpp.

◆ run()

void CanBusInertialMTB::run ( )
virtual

Definition at line 369 of file CanBusInertialMTB.cpp.

◆ threadInit()

bool CanBusInertialMTB::threadInit ( )
virtual

Definition at line 313 of file CanBusInertialMTB.cpp.

◆ threadRelease()

void CanBusInertialMTB::threadRelease ( )
virtual

Definition at line 489 of file CanBusInertialMTB.cpp.

Member Data Documentation

◆ boards

std::vector<MTBInertialBoardInfo> CanBusInertialMTB::boards
protected

Definition at line 83 of file CanBusInertialMTB.h.

◆ count

int CanBusInertialMTB::count
protected

Definition at line 95 of file CanBusInertialMTB.h.

◆ data

yarp::sig::Vector CanBusInertialMTB::data
protected

Definition at line 87 of file CanBusInertialMTB.h.

◆ driver

PolyDriver CanBusInertialMTB::driver
protected

Definition at line 75 of file CanBusInertialMTB.h.

◆ inBuffer

CanBuffer CanBusInertialMTB::inBuffer
protected

Definition at line 78 of file CanBusInertialMTB.h.

◆ initted

bool CanBusInertialMTB::initted
protected

Definition at line 94 of file CanBusInertialMTB.h.

◆ mtx

std::mutex CanBusInertialMTB::mtx
protected

Definition at line 81 of file CanBusInertialMTB.h.

◆ nrOfTotalChannels

int CanBusInertialMTB::nrOfTotalChannels
protected

Definition at line 85 of file CanBusInertialMTB.h.

◆ outBuffer

CanBuffer CanBusInertialMTB::outBuffer
protected

Definition at line 79 of file CanBusInertialMTB.h.

◆ pCanBufferFactory

ICanBufferFactory* CanBusInertialMTB::pCanBufferFactory
protected

Definition at line 77 of file CanBusInertialMTB.h.

◆ pCanBus

ICanBus* CanBusInertialMTB::pCanBus
protected

Definition at line 76 of file CanBusInertialMTB.h.

◆ privateData

yarp::sig::Vector CanBusInertialMTB::privateData
protected

Definition at line 88 of file CanBusInertialMTB.h.

◆ privateGlobalStatus

short CanBusInertialMTB::privateGlobalStatus
protected

Definition at line 92 of file CanBusInertialMTB.h.

◆ privateStatus

std::vector<short> CanBusInertialMTB::privateStatus
protected

Definition at line 90 of file CanBusInertialMTB.h.

◆ sharedGlobalStatus

short CanBusInertialMTB::sharedGlobalStatus
protected

Definition at line 91 of file CanBusInertialMTB.h.

◆ sharedStatus

std::vector<short> CanBusInertialMTB::sharedStatus
protected

Definition at line 89 of file CanBusInertialMTB.h.


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