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. | |
bool | close () override |
Close the device. | |
bool | read (yarp::sig::Vector &out) override |
Read a vector from the sensor. | |
bool | getChannels (int *nc) override |
Get the number of channels of the sensor. | |
bool | calibrate (int ch, double v) override |
Calibrate the sensor, single channel. | |
size_t | getNrOfThreeAxisGyroscopes () const override |
Get the number of three axis gyroscopes in the device. | |
yarp::dev::MAS_status | getThreeAxisGyroscopeStatus (size_t sens_index) const override |
Get the status of three axis gyroscope. | |
bool | getThreeAxisGyroscopeName (size_t sens_index, std::string &name) const override |
Get the name of three axis gyroscope. | |
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. | |
bool | getThreeAxisGyroscopeMeasure (size_t sens_index, yarp::sig::Vector &out, double ×tamp) const override |
Get three axis gyroscope measurements. | |
size_t | getNrOfThreeAxisLinearAccelerometers () const override |
Get the number of three axis linear accelerometers in the device. | |
yarp::dev::MAS_status | getThreeAxisLinearAccelerometerStatus (size_t sens_index) const override |
Get the status of three axis linear accelerometer. | |
bool | getThreeAxisLinearAccelerometerName (size_t sens_index, std::string &name) const override |
Get the name of three axis linear accelerometer. | |
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. | |
bool | getThreeAxisLinearAccelerometerMeasure (size_t sens_index, yarp::sig::Vector &out, double ×tamp) const override |
Get three axis linear accelerometer measurements. | |
size_t | getNrOfThreeAxisMagnetometers () const override |
Get the number of three axis magnetometers in the device. | |
yarp::dev::MAS_status | getThreeAxisMagnetometerStatus (size_t sens_index) const override |
Get the status of three axis magnetometer. | |
bool | getThreeAxisMagnetometerName (size_t sens_index, std::string &name) const override |
Get the name of three axis magnetometer. | |
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. | |
bool | getThreeAxisMagnetometerMeasure (size_t sens_index, yarp::sig::Vector &out, double ×tamp) const override |
Get three axis magnetometer measurements. | |
size_t | getNrOfOrientationSensors () const override |
Get the number of orientation sensors in the device. | |
yarp::dev::MAS_status | getOrientationSensorStatus (size_t sens_index) const override |
Get the status of orientation sensor. | |
bool | getOrientationSensorName (size_t sens_index, std::string &name) const override |
Get the name of orientation sensor. | |
bool | getOrientationSensorFrameName (size_t sens_index, std::string &frameName) const override |
Get the name of the frame in which orientation sensor measurements are expressed. | |
bool | getOrientationSensorMeasureAsRollPitchYaw (size_t sens_index, yarp::sig::Vector &rpy, double ×tamp) const override |
Get orientation sensor measurements. | |
bool | threadInit () override |
Initialize process with desired device configurations. | |
void | threadRelease () override |
Terminate communication with the device and release the thread. | |
void | run () override |
Update loop where measurements are read from the device. | |
Public Member Functions inherited from yarp::dev::DeviceDriver | |
DeviceDriver () | |
DeviceDriver (const DeviceDriver &other)=delete | |
DeviceDriver (DeviceDriver &&other) noexcept=delete | |
DeviceDriver & | operator= (const DeviceDriver &other)=delete |
DeviceDriver & | operator= (DeviceDriver &&other) noexcept=delete |
virtual | ~DeviceDriver () |
virtual std::string | id () const |
Return the id assigned to the PolyDriver. | |
virtual void | setId (const std::string &id) |
Set the id for this device. | |
template<class T > | |
bool | view (T *&x) |
Get an interface to the device driver. | |
virtual DeviceDriver * | getImplementation () |
Some drivers are bureaucrats, pointing at others. | |
Public Member Functions inherited from yarp::os::PeriodicThread | |
PeriodicThread (double period, ShouldUseSystemClock useSystemClock=ShouldUseSystemClock::No, PeriodicThreadClock clockAccuracy=PeriodicThreadClock::Relative) | |
Constructor. | |
PeriodicThread (double period, PeriodicThreadClock clockAccuracy) | |
Constructor. | |
virtual | ~PeriodicThread () |
bool | start () |
Call this to start the thread. | |
void | step () |
Call this to "step" the thread rather than starting it. | |
void | stop () |
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() called). | |
void | askToStop () |
Stop the thread. | |
bool | isRunning () const |
Returns true when the thread is started, false otherwise. | |
bool | isSuspended () const |
Returns true when the thread is suspended, false otherwise. | |
bool | setPeriod (double period) |
Set the (new) period of the thread. | |
double | getPeriod () const |
Return the current period of the thread. | |
void | suspend () |
Suspend the thread, the thread keeps running by doLoop is never executed. | |
void | resume () |
Resume the thread if previously suspended. | |
void | resetStat () |
Reset thread statistics. | |
double | getEstimatedPeriod () const |
Return estimated period since last reset. | |
void | getEstimatedPeriod (double &av, double &std) const |
Return estimated period since last reset. | |
unsigned int | getIterations () const |
Return the number of iterations performed since last reset. | |
double | getEstimatedUsed () const |
Return the estimated duration of the run() function since last reset. | |
void | getEstimatedUsed (double &av, double &std) const |
Return estimated duration of the run() function since last reset. | |
int | setPriority (int priority, int policy=-1) |
Set the priority and scheduling policy of the thread, if the OS supports that. | |
int | getPriority () const |
Query the current priority of the thread, if the OS supports that. | |
int | getPolicy () const |
Query the current scheduling policy of the thread, if the OS supports that. | |
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 () |
Public Member Functions inherited from BoschIMU_ParamsParser | |
BoschIMU_ParamsParser () | |
~BoschIMU_ParamsParser () override=default | |
bool | parseParams (const yarp::os::Searchable &config) override |
Parse the DeviceDriver parameters. | |
std::string | getDeviceClassName () const override |
Get the name of the DeviceDriver class. | |
std::string | getDeviceName () const override |
Get the name of the device (i.e. | |
std::string | getDocumentationOfDeviceParams () const override |
Get the documentation of the DeviceDriver's parameters. | |
std::vector< std::string > | getListOfParams () const override |
Return a list of all params used by the device. | |
Public Member Functions inherited from yarp::dev::IDeviceDriverParams | |
virtual | ~IDeviceDriverParams () |
Protected Types | |
using | ReadFuncPtr = bool(BoschIMU::*)(unsigned char, int, unsigned char *, std::string) |
Functor to choose between i2c or serial comm. | |
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. | |
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(). | |
Protected Attributes | |
bool | verbose |
Flag to get verbose output. | |
short | status |
device status - UNUSED | |
yarp::sig::Vector | data |
sensor data buffer | |
yarp::sig::Vector | data_tmp |
sensor data temporary buffer | |
yarp::math::Quaternion | quaternion |
orientation in quaternion representation | |
yarp::math::Quaternion | quaternion_tmp |
orientation in quaternion representation | |
yarp::sig::Vector | RPY_angle |
orientation in Euler angle representation | |
double | m_timeStamp |
device timestamp | |
double | timeLastReport |
timestamp of last reported data | |
std::mutex | mutex |
mutex to avoid resource clash | |
bool | m_i2c_flag =false |
flag to check if device connected through i2c commununication | |
bool | checkError |
flag to check read error of sensor data | |
int | fd |
file descriptor to open device at system level | |
size_t | responseOffset |
yarp::os::ResourceFinder | rf |
resource finder object to load config parameters | |
ReadFuncPtr | readFunc |
Functor object. | |
unsigned char | command [MAX_MSG_LENGTH] |
packet to be written to the device | |
unsigned char | response [MAX_MSG_LENGTH] |
packet to be read from the device | |
long int | totMessagesRead |
yarp::sig::Vector | errorCounter |
yarp::sig::Vector | errorReading |
int | errs |
std::atomic< bool > | dataIsValid |
Additional Inherited Members | |
Public Attributes inherited from BoschIMU_ParamsParser | |
const std::string | m_device_classname = {"BoschIMU"} |
const std::string | m_device_name = {"imuBosch_BNO055"} |
bool | m_parser_is_strict = false |
const parser_version_type | m_parser_version = {} |
const std::string | m_comport_defaultValue = {""} |
const std::string | m_baudrate_defaultValue = {"115200"} |
const std::string | m_i2c_defaultValue = {""} |
const std::string | m_period_defaultValue = {"10"} |
const std::string | m_sensor_name_defaultValue = {"sensor_imu_bosch_bno055"} |
const std::string | m_frame_name_defaultValue = {"sensor_imu_bosch_bno055"} |
const std::string | m_channels_defaultValue = {"12"} |
std::string | m_comport = {} |
int | m_baudrate = {115200} |
std::string | m_i2c = {} |
int | m_period = {10} |
std::string | m_sensor_name = {"sensor_imu_bosch_bno055"} |
std::string | m_frame_name = {"sensor_imu_bosch_bno055"} |
int | m_channels = {12} |
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 required by this device are shown in class: BoschIMU_ParamsParser
Definition at line 127 of file imuBosch_BNO055.h.
|
protected |
Functor to choose between i2c or serial comm.
Definition at line 156 of file imuBosch_BNO055.h.
BoschIMU::BoschIMU | ( | ) |
Definition at line 47 of file imuBosch_BNO055.cpp.
|
default |
Calibrate the sensor, single channel.
[in] | ch | channel number |
[in] | v | reset value |
Implements yarp::dev::IGenericSensor.
Definition at line 702 of file imuBosch_BNO055.cpp.
Definition at line 181 of file imuBosch_BNO055.cpp.
Definition at line 210 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Close the device.
Reimplemented from yarp::dev::DeviceDriver.
Definition at line 173 of file imuBosch_BNO055.cpp.
|
protected |
Definition at line 355 of file imuBosch_BNO055.cpp.
Get the number of channels of the sensor.
[out] | nc | pointer to storage, return value |
Implements yarp::dev::IGenericSensor.
Definition at line 696 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the number of orientation sensors in the device.
Implements yarp::dev::IOrientationSensors.
Definition at line 827 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the number of three axis gyroscopes in the device.
Implements yarp::dev::IThreeAxisGyroscopes.
Definition at line 788 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the number of three axis linear accelerometers in the device.
Implements yarp::dev::IThreeAxisLinearAccelerometers.
Definition at line 748 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Get the number of three axis magnetometers in the device.
Implements yarp::dev::IThreeAxisMagnetometers.
Definition at line 865 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 842 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 847 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 837 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 832 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 804 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 809 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 799 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 794 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 764 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 769 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 759 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 754 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 880 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 885 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 875 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 870 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 71 of file imuBosch_BNO055.cpp.
Definition at line 365 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 678 of file imuBosch_BNO055.cpp.
Definition at line 339 of file imuBosch_BNO055.cpp.
|
protected |
Definition at line 373 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Update loop where measurements are read from the device.
Implements yarp::os::PeriodicThread.
Definition at line 583 of file imuBosch_BNO055.cpp.
|
protected |
Definition at line 395 of file imuBosch_BNO055.cpp.
|
protected |
Definition at line 408 of file imuBosch_BNO055.cpp.
|
protected |
Definition at line 238 of file imuBosch_BNO055.cpp.
|
protected |
Definition at line 298 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 418 of file imuBosch_BNO055.cpp.
|
overridevirtual |
Terminate communication with the device and release the thread.
Reimplemented from yarp::os::PeriodicThread.
Definition at line 905 of file imuBosch_BNO055.cpp.
|
protected |
flag to check read error of sensor data
Definition at line 150 of file imuBosch_BNO055.h.
|
protected |
packet to be written to the device
Definition at line 159 of file imuBosch_BNO055.h.
|
protected |
sensor data buffer
Definition at line 140 of file imuBosch_BNO055.h.
|
protected |
sensor data temporary buffer
Definition at line 141 of file imuBosch_BNO055.h.
|
protected |
Definition at line 184 of file imuBosch_BNO055.h.
|
protected |
Definition at line 171 of file imuBosch_BNO055.h.
|
protected |
Definition at line 172 of file imuBosch_BNO055.h.
|
protected |
Definition at line 183 of file imuBosch_BNO055.h.
|
protected |
file descriptor to open device at system level
Definition at line 152 of file imuBosch_BNO055.h.
|
protected |
flag to check if device connected through i2c commununication
Definition at line 148 of file imuBosch_BNO055.h.
|
protected |
device timestamp
Definition at line 145 of file imuBosch_BNO055.h.
|
mutableprotected |
mutex to avoid resource clash
Definition at line 147 of file imuBosch_BNO055.h.
|
protected |
orientation in quaternion representation
Definition at line 142 of file imuBosch_BNO055.h.
|
protected |
orientation in quaternion representation
Definition at line 143 of file imuBosch_BNO055.h.
|
protected |
Functor object.
Definition at line 157 of file imuBosch_BNO055.h.
|
protected |
packet to be read from the device
Definition at line 160 of file imuBosch_BNO055.h.
|
protected |
Definition at line 153 of file imuBosch_BNO055.h.
|
protected |
resource finder object to load config parameters
Definition at line 154 of file imuBosch_BNO055.h.
|
protected |
orientation in Euler angle representation
Definition at line 144 of file imuBosch_BNO055.h.
|
protected |
device status - UNUSED
Definition at line 139 of file imuBosch_BNO055.h.
|
protected |
timestamp of last reported data
Definition at line 146 of file imuBosch_BNO055.h.
|
protected |
Definition at line 170 of file imuBosch_BNO055.h.
|
protected |
Flag to get verbose output.
Definition at line 138 of file imuBosch_BNO055.h.