Skyward boardcore
|
A software IMU sensor that allows applying transformations to the data after sampling via a callback. Defaults to identity transformations. More...
#include <RotatedIMU.h>
Public Types | |
using | SampleIMUFunction = std::function<IMUData()> |
![]() | |
using | DataType |
Public Member Functions | |
RotatedIMU (SampleIMUFunction sampleFunction) | |
Construct a new Rotated IMU object. | |
bool | init () override |
Initialize the sensor. | |
bool | selfTest () override |
Check if the sensor is working. | |
void | addAccTransformation (const Eigen::Matrix3f &t) |
Multiplies the current accelerometer transformation. | |
void | addGyroTransformation (const Eigen::Matrix3f &t) |
Multiplies the current gyroscope transformation. | |
void | addMagTransformation (const Eigen::Matrix3f &t) |
Multiplies the current magnetometer transformation. | |
void | resetTransformations () |
Resets all the transformations to the original (Identity) ones. | |
![]() | |
Sensor () | |
Sensor (Sensor &&other) | |
virtual | ~Sensor () |
void | sample () override |
Sample the sensor. | |
virtual IMUData | getLastSample () |
![]() | |
virtual | ~AbstractSensor () |
SensorErrors | getLastError () |
Get last error for debugging purposes. Avoid silent fails. | |
Static Public Member Functions | |
static Eigen::Matrix3f | rotateAroundX (float angle) |
Creates a rotation matrix around the X axis. | |
static Eigen::Matrix3f | rotateAroundY (float angle) |
Creates a rotation matrix around the Y axis. | |
static Eigen::Matrix3f | rotateAroundZ (float angle) |
Creates a rotation matrix around the Z axis. | |
Protected Member Functions | |
IMUData | sampleImpl () override |
Read a data sample from the sensor. In case of errors, the method should return the last available correct sample. | |
Additional Inherited Members | |
![]() | |
DataType | lastSample |
miosix::FastMutex | mutex |
![]() | |
SensorErrors | lastError = SensorErrors::NO_ERRORS |
A software IMU sensor that allows applying transformations to the data after sampling via a callback. Defaults to identity transformations.
Definition at line 39 of file RotatedIMU.h.
using Boardcore::RotatedIMU::SampleIMUFunction = std::function<IMUData()> |
Definition at line 42 of file RotatedIMU.h.
|
explicit |
Construct a new Rotated IMU object.
sampleFunction | Callback to retrieve accelerometer, magnetometer and gyroscope data |
Definition at line 30 of file RotatedIMU.cpp.
void Boardcore::RotatedIMU::addAccTransformation | ( | const Eigen::Matrix3f & | t | ) |
Multiplies the current accelerometer transformation.
transformation | Transformation matrix to be multiplied to the current one |
Definition at line 35 of file RotatedIMU.cpp.
void Boardcore::RotatedIMU::addGyroTransformation | ( | const Eigen::Matrix3f & | t | ) |
Multiplies the current gyroscope transformation.
transformation | Transformation matrix to be multiplied to the current one |
Definition at line 36 of file RotatedIMU.cpp.
void Boardcore::RotatedIMU::addMagTransformation | ( | const Eigen::Matrix3f & | t | ) |
Multiplies the current magnetometer transformation.
transformation | Transformation matrix to be multiplied to the current one |
Definition at line 37 of file RotatedIMU.cpp.
|
inlineoverridevirtual |
Initialize the sensor.
Implements Boardcore::AbstractSensor.
Definition at line 52 of file RotatedIMU.h.
void Boardcore::RotatedIMU::resetTransformations | ( | ) |
Resets all the transformations to the original (Identity) ones.
Definition at line 39 of file RotatedIMU.cpp.
|
static |
Creates a rotation matrix around the X axis.
angle | Angle in degrees |
Definition at line 46 of file RotatedIMU.cpp.
|
static |
Creates a rotation matrix around the Y axis.
angle | Angle in degrees |
Definition at line 60 of file RotatedIMU.cpp.
|
static |
Creates a rotation matrix around the Z axis.
angle | Angle in degrees |
Definition at line 74 of file RotatedIMU.cpp.
|
overrideprotectedvirtual |
Read a data sample from the sensor. In case of errors, the method should return the last available correct sample.
Implements Boardcore::Sensor< IMUData >.
Definition at line 88 of file RotatedIMU.cpp.
|
inlineoverridevirtual |
Check if the sensor is working.
Implements Boardcore::AbstractSensor.
Definition at line 53 of file RotatedIMU.h.