imuBosch_BNO055
: This device will connect to the proper analogServer and read the data broadcasted making them available to use for the user application.
More...
#include <imuBosch_BNO055/imuBosch_BNO055.h>
Public Member Functions | |
BoschIMU () | |
~BoschIMU () | |
bool | open (yarp::os::Searchable &config) override |
Open the device and set up parameters/communication. More... | |
bool | close () override |
Close the device. More... | |
bool | read (yarp::sig::Vector &out) override |
Read a vector from the sensor. More... | |
bool | getChannels (int *nc) override |
Get the number of channels of the sensor. More... | |
bool | calibrate (int ch, double v) override |
Calibrate the sensor, single channel. More... | |
size_t | getNrOfThreeAxisGyroscopes () const override |
Get the number of three axis gyroscopes in the device. More... | |
yarp::dev::MAS_status | getThreeAxisGyroscopeStatus (size_t sens_index) const override |
Get the status of three axis gyroscope. More... | |
bool | getThreeAxisGyroscopeName (size_t sens_index, std::string &name) const override |
Get the name of three axis gyroscope. More... | |
bool | getThreeAxisGyroscopeFrameName (size_t sens_index, std::string &frameName) const override |
Get the name of the frame in which three axis gyroscope measurements are expressed. More... | |
bool | getThreeAxisGyroscopeMeasure (size_t sens_index, yarp::sig::Vector &out, double ×tamp) const override |
Get three axis gyroscope measurements. More... | |
size_t | getNrOfThreeAxisLinearAccelerometers () const override |
Get the number of three axis linear accelerometers in the device. More... | |
yarp::dev::MAS_status | getThreeAxisLinearAccelerometerStatus (size_t sens_index) const override |
Get the status of three axis linear accelerometer. More... | |
bool | getThreeAxisLinearAccelerometerName (size_t sens_index, std::string &name) const override |
Get the name of three axis linear accelerometer. More... | |
bool | getThreeAxisLinearAccelerometerFrameName (size_t sens_index, std::string &frameName) const override |
Get the name of the frame in which three axis linear accelerometer measurements are expressed. More... | |
bool | getThreeAxisLinearAccelerometerMeasure (size_t sens_index, yarp::sig::Vector &out, double ×tamp) const override |
Get three axis linear accelerometer measurements. More... | |
size_t | getNrOfThreeAxisMagnetometers () const override |
Get the number of three axis magnetometers in the device. More... | |
yarp::dev::MAS_status | getThreeAxisMagnetometerStatus (size_t sens_index) const override |
Get the status of three axis magnetometer. More... | |
bool | getThreeAxisMagnetometerName (size_t sens_index, std::string &name) const override |
Get the name of three axis magnetometer. More... | |
bool | getThreeAxisMagnetometerFrameName (size_t sens_index, std::string &frameName) const override |
Get the name of the frame in which three axis magnetometer measurements are expressed. More... | |
bool | getThreeAxisMagnetometerMeasure (size_t sens_index, yarp::sig::Vector &out, double ×tamp) const override |
Get three axis magnetometer measurements. More... | |
size_t | getNrOfOrientationSensors () const override |
Get the number of orientation sensors in the device. More... | |
yarp::dev::MAS_status | getOrientationSensorStatus (size_t sens_index) const override |
Get the status of orientation sensor. More... | |
bool | getOrientationSensorName (size_t sens_index, std::string &name) const override |
Get the name of orientation sensor. More... | |
bool | getOrientationSensorFrameName (size_t sens_index, std::string &frameName) const override |
Get the name of the frame in which orientation sensor measurements are expressed. More... | |
bool | getOrientationSensorMeasureAsRollPitchYaw (size_t sens_index, yarp::sig::Vector &rpy, double ×tamp) const override |
Get orientation sensor measurements. More... | |
bool | threadInit () override |
Initialize process with desired device configurations. More... | |
void | threadRelease () override |
Terminate communication with the device and release the thread. More... | |
void | run () override |
Update loop where measurements are read from the device. 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 DeviceDriver * | getImplementation () |
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::os::PeriodicThread | |
PeriodicThread (double period, ShouldUseSystemClock useSystemClock=ShouldUseSystemClock::No) | |
Constructor. More... | |
virtual | ~PeriodicThread () |
bool | start () |
Call this to start the thread. More... | |
void | step () |
Call this to "step" the thread rather than starting it. More... | |
void | stop () |
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() called). More... | |
void | askToStop () |
Stop the thread. More... | |
bool | isRunning () const |
Returns true when the thread is started, false otherwise. More... | |
bool | isSuspended () const |
Returns true when the thread is suspended, false otherwise. More... | |
bool | setPeriod (double period) |
Set the (new) period of the thread. More... | |
double | getPeriod () const |
Return the current period of the thread. More... | |
void | suspend () |
Suspend the thread, the thread keeps running by doLoop is never executed. More... | |
void | resume () |
Resume the thread if previously suspended. More... | |
void | resetStat () |
Reset thread statistics. More... | |
double | getEstimatedPeriod () const |
Return estimated period since last reset. More... | |
void | getEstimatedPeriod (double &av, double &std) const |
Return estimated period since last reset. More... | |
unsigned int | getIterations () const |
Return the number of iterations performed since last reset. More... | |
double | getEstimatedUsed () const |
Return the estimated duration of the run() function since last reset. More... | |
void | getEstimatedUsed (double &av, double &std) const |
Return estimated duration of the run() function since last reset. More... | |
int | setPriority (int priority, int policy=-1) |
Set the priority and scheduling policy of the thread, if the OS supports that. More... | |
int | getPriority () const |
Query the current priority of the thread, if the OS supports that. More... | |
int | getPolicy () const |
Query the current scheduling policy of the thread, if the OS supports that. More... | |
Public Member Functions inherited from yarp::dev::IGenericSensor | |
virtual | ~IGenericSensor () |
Public Member Functions inherited from yarp::dev::IThreeAxisGyroscopes | |
virtual | ~IThreeAxisGyroscopes () |
Public Member Functions inherited from yarp::dev::IThreeAxisLinearAccelerometers | |
virtual | ~IThreeAxisLinearAccelerometers () |
Public Member Functions inherited from yarp::dev::IThreeAxisMagnetometers | |
virtual | ~IThreeAxisMagnetometers () |
Public Member Functions inherited from yarp::dev::IOrientationSensors | |
virtual | ~IOrientationSensors () |
Protected Types | |
using | ReadFuncPtr = bool(BoschIMU::*)(unsigned char, int, unsigned char *, std::string) |
Functor to choose between i2c or serial comm. More... | |
Protected Member Functions | |
bool | checkWriteResponse (unsigned char *response) |
bool | checkReadResponse (unsigned char *response) |
void | printBuffer (unsigned char *buffer, int length) |
int | readBytes (unsigned char *buffer, int bytes) |
void | dropGarbage () |
void | readSysError () |
bool | sendReadCommandSer (unsigned char register_add, int len, unsigned char *buf, std::string comment="") |
bool | sendWriteCommandSer (unsigned char register_add, int len, unsigned char *cmd, std::string comment="") |
bool | sendAndVerifyCommandSer (unsigned char register_add, int len, unsigned char *cmd, std::string comment) |
bool | sendReadCommandI2c (unsigned char register_add, int len, unsigned char *buf, std::string comment="") |
Protected Member Functions inherited from yarp::os::PeriodicThread | |
virtual void | beforeStart () |
Called just before a new thread starts. More... | |
virtual void | afterStart (bool success) |
Called just after a new thread starts (or fails to start), this is executed by the same thread that calls start(). More... | |
Protected Attributes | |
bool | verbose |
Flag to get verbose output. More... | |
short | status |
device status - UNUSED More... | |
int | nChannels |
number of channels in the output port. Default 12. If 16, also includes quaternion data More... | |
yarp::sig::Vector | data |
sensor data buffer More... | |
yarp::sig::Vector | data_tmp |
sensor data temporary buffer More... | |
yarp::math::Quaternion | quaternion |
orientation in quaternion representation More... | |
yarp::math::Quaternion | quaternion_tmp |
orientation in quaternion representation More... | |
yarp::sig::Vector | RPY_angle |
orientation in Euler angle representation More... | |
double | m_timeStamp |
device timestamp More... | |
double | timeLastReport |
timestamp of last reported data More... | |
std::mutex | mutex |
mutex to avoid resource clash More... | |
bool | i2c_flag |
flag to check if device connected through i2c commununication More... | |
bool | checkError |
flag to check read error of sensor data More... | |
int | fd |
file descriptor to open device at system level More... | |
size_t | responseOffset |
yarp::os::ResourceFinder | rf |
resource finder object to load config parameters More... | |
ReadFuncPtr | readFunc |
Functor object. More... | |
unsigned char | command [MAX_MSG_LENGTH] |
packet to be written to the device More... | |
unsigned char | response [MAX_MSG_LENGTH] |
packet to be read from the device More... | |
long int | totMessagesRead |
yarp::sig::Vector | errorCounter |
yarp::sig::Vector | errorReading |
int | errs |
std::atomic< bool > | dataIsValid |
imuBosch_BNO055
: This device will connect to the proper analogServer 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 |
---|---|---|---|---|---|---|
comport | string | Yes if i2c not specified | full name of device file | ex '/dev/ttyUSB0', it is mutually exclusive with 'i2c' parameter | ||
baudrate | int | Hz | Yes if i2c not specified | baudrate setting of COM port | ex 115200, used only with serial configuration | |
i2c | string | Yes if comport not specified | full name of device file | ex '/dev/i2c-5', it is mutually exclusive with 'comport' parameter, necessary for i2c configuration | ||
period | int | ms | 10 | No | period of the thread | |
sensor_name | string | sensor_imu_bosch_bno055 | No | full name of the device | ||
frame_name | string | set same as sensor_name | No | full name of the sensor frame in which the measurements are expressed |
Definition at line 149 of file imuBosch_BNO055.h.
|
protected |
Functor to choose between i2c or serial comm.
Definition at line 178 of file imuBosch_BNO055.h.
BoschIMU::BoschIMU | ( | ) |
Definition at line 61 of file imuBosch_BNO055.cpp.
|
default |
|
overridevirtual |
Calibrate the sensor, single channel.
[in] | ch | channel number |
[in] | v | reset value |
Implements yarp::dev::IGenericSensor.
Definition at line 739 of file imuBosch_BNO055.cpp.
|
protected |
Definition at line 223 of file imuBosch_BNO055.cpp.
|
protected |
Definition at line 252 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Close the device.
Reimplemented from yarp::dev::DeviceDriver.
Definition at line 215 of file imuBosch_BNO055.cpp.
|
protected |
Definition at line 395 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the number of channels of the sensor.
[out] | nc | pointer to storage, return value |
Implements yarp::dev::IGenericSensor.
Definition at line 733 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the number of orientation sensors in the device.
Implements yarp::dev::IOrientationSensors.
Definition at line 864 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the number of three axis gyroscopes in the device.
Implements yarp::dev::IThreeAxisGyroscopes.
Definition at line 825 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the number of three axis linear accelerometers in the device.
Implements yarp::dev::IThreeAxisLinearAccelerometers.
Definition at line 785 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the number of three axis magnetometers in the device.
Implements yarp::dev::IThreeAxisMagnetometers.
Definition at line 902 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the name of the frame in which orientation sensor measurements are expressed.
[in] | sens_index | sensor index (must be 0 in the case BoschIMU) |
[out] | frameName | name of the sensor frame |
Implements yarp::dev::IOrientationSensors.
Definition at line 879 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get orientation sensor measurements.
[in] | sens_index | sensor index (must be 0 in the case BoschIMU) |
[out] | out | RPY Euler angles in deg |
[out] | timestamp | timestamp of measurement |
Implements yarp::dev::IOrientationSensors.
Definition at line 884 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the name of orientation sensor.
[in] | sens_index | sensor index (must be 0 in the case BoschIMU) |
[out] | name | name of the sensor |
Implements yarp::dev::IOrientationSensors.
Definition at line 874 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the status of orientation sensor.
[in] | sens_index | sensor index (must be 0 in the case BoschIMU) |
Implements yarp::dev::IOrientationSensors.
Definition at line 869 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the name of the frame in which three axis gyroscope measurements are expressed.
[in] | sens_index | sensor index (must be 0 in the case BoschIMU) |
[out] | frameName | name of the sensor frame |
Implements yarp::dev::IThreeAxisGyroscopes.
Definition at line 841 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get three axis gyroscope measurements.
[in] | sens_index | sensor index (must be 0 in the case BoschIMU) |
[out] | out | 3D angular velocity measurement in deg/s |
[out] | timestamp | timestamp of measurement |
Implements yarp::dev::IThreeAxisGyroscopes.
Definition at line 846 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the name of three axis gyroscope.
[in] | sens_index | sensor index (must be 0 in the case BoschIMU) |
[out] | name | name of the sensor |
Implements yarp::dev::IThreeAxisGyroscopes.
Definition at line 836 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the status of three axis gyroscope.
[in] | sens_index | sensor index (must be 0 in the case BoschIMU) |
Implements yarp::dev::IThreeAxisGyroscopes.
Definition at line 831 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the name of the frame in which three axis linear accelerometer measurements are expressed.
[in] | sens_index | sensor index (must be 0 in the case BoschIMU) |
[out] | frameName | name of the sensor frame |
Implements yarp::dev::IThreeAxisLinearAccelerometers.
Definition at line 801 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get three axis linear accelerometer measurements.
[in] | sens_index | sensor index (must be 0 in the case BoschIMU) |
[out] | out | 3D linear acceleration measurement in m/s^2 |
[out] | timestamp | timestamp of measurement |
Implements yarp::dev::IThreeAxisLinearAccelerometers.
Definition at line 806 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the name of three axis linear accelerometer.
[in] | sens_index | sensor index (must be 0 in the case BoschIMU) |
[out] | name | name of the sensor |
Implements yarp::dev::IThreeAxisLinearAccelerometers.
Definition at line 796 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the status of three axis linear accelerometer.
[in] | sens_index | sensor index (must be 0 in the case BoschIMU) |
Implements yarp::dev::IThreeAxisLinearAccelerometers.
Definition at line 791 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the name of the frame in which three axis magnetometer measurements are expressed.
[in] | sens_index | sensor index (must be 0 in the case BoschIMU) |
[out] | frameName | name of the sensor frame |
Implements yarp::dev::IThreeAxisMagnetometers.
Definition at line 917 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get three axis magnetometer measurements.
[in] | sens_index | sensor index (must be 0 in the case BoschIMU) |
[out] | out | 3D magnetometer measurement |
[out] | timestamp | timestamp of measurement |
Implements yarp::dev::IThreeAxisMagnetometers.
Definition at line 922 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the name of three axis magnetometer.
[in] | sens_index | sensor index (must be 0 in the case BoschIMU) |
[out] | name | name of the sensor |
Implements yarp::dev::IThreeAxisMagnetometers.
Definition at line 912 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the status of three axis magnetometer.
[in] | sens_index | sensor index (must be 0 in the case BoschIMU) |
Implements yarp::dev::IThreeAxisMagnetometers.
Definition at line 907 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Open the device and set up parameters/communication.
[in] | config | searchable object with desired configuration parameters |
Reimplemented from yarp::dev::DeviceDriver.
Definition at line 87 of file imuBosch_BNO055.cpp.
|
protected |
Definition at line 405 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Read a vector from the sensor.
[out] | out | a vector containing the sensor's last readings. |
Implements yarp::dev::IGenericSensor.
Definition at line 715 of file imuBosch_BNO055.cpp.
|
protected |
Definition at line 380 of file imuBosch_BNO055.cpp.
|
protected |
Definition at line 412 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Update loop where measurements are read from the device.
Implements yarp::os::PeriodicThread.
Definition at line 620 of file imuBosch_BNO055.cpp.
|
protected |
Definition at line 433 of file imuBosch_BNO055.cpp.
|
protected |
Definition at line 446 of file imuBosch_BNO055.cpp.
|
protected |
Definition at line 280 of file imuBosch_BNO055.cpp.
|
protected |
Definition at line 340 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Initialize process with desired device configurations.
TODO: meas units, offset and so on ...
Reimplemented from yarp::os::PeriodicThread.
Definition at line 456 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Terminate communication with the device and release the thread.
Reimplemented from yarp::os::PeriodicThread.
Definition at line 942 of file imuBosch_BNO055.cpp.
|
protected |
flag to check read error of sensor data
Definition at line 172 of file imuBosch_BNO055.h.
|
protected |
packet to be written to the device
Definition at line 181 of file imuBosch_BNO055.h.
|
protected |
sensor data buffer
Definition at line 162 of file imuBosch_BNO055.h.
|
protected |
sensor data temporary buffer
Definition at line 163 of file imuBosch_BNO055.h.
|
protected |
Definition at line 206 of file imuBosch_BNO055.h.
|
protected |
Definition at line 193 of file imuBosch_BNO055.h.
|
protected |
Definition at line 194 of file imuBosch_BNO055.h.
|
protected |
Definition at line 205 of file imuBosch_BNO055.h.
|
protected |
file descriptor to open device at system level
Definition at line 174 of file imuBosch_BNO055.h.
|
protected |
flag to check if device connected through i2c commununication
Definition at line 170 of file imuBosch_BNO055.h.
|
protected |
device timestamp
Definition at line 167 of file imuBosch_BNO055.h.
|
mutableprotected |
mutex to avoid resource clash
Definition at line 169 of file imuBosch_BNO055.h.
|
protected |
number of channels in the output port. Default 12. If 16, also includes quaternion data
Definition at line 161 of file imuBosch_BNO055.h.
|
protected |
orientation in quaternion representation
Definition at line 164 of file imuBosch_BNO055.h.
|
protected |
orientation in quaternion representation
Definition at line 165 of file imuBosch_BNO055.h.
|
protected |
Functor object.
Definition at line 179 of file imuBosch_BNO055.h.
|
protected |
packet to be read from the device
Definition at line 182 of file imuBosch_BNO055.h.
|
protected |
Definition at line 175 of file imuBosch_BNO055.h.
|
protected |
resource finder object to load config parameters
Definition at line 176 of file imuBosch_BNO055.h.
|
protected |
orientation in Euler angle representation
Definition at line 166 of file imuBosch_BNO055.h.
|
protected |
device status - UNUSED
Definition at line 160 of file imuBosch_BNO055.h.
|
protected |
timestamp of last reported data
Definition at line 168 of file imuBosch_BNO055.h.
|
protected |
Definition at line 192 of file imuBosch_BNO055.h.
|
protected |
Flag to get verbose output.
Definition at line 159 of file imuBosch_BNO055.h.