Skyward boardcore
Loading...
Searching...
No Matches
Boardcore::RotatedIMU Class Reference

A software IMU sensor that allows applying transformations to the data after sampling via a callback. Defaults to identity transformations. More...

#include <RotatedIMU.h>

Inheritance diagram for Boardcore::RotatedIMU:
Collaboration diagram for Boardcore::RotatedIMU:

Public Types

using SampleIMUFunction = std::function<IMUData()>
 
- Public Types inherited from Boardcore::Sensor< 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.
 
- Public Member Functions inherited from Boardcore::Sensor< IMUData >
 Sensor ()
 
 Sensor (Sensor &&other)
 
virtual ~Sensor ()
 
void sample () override
 Sample the sensor.
 
virtual IMUData getLastSample ()
 
- Public Member Functions inherited from Boardcore::AbstractSensor
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

- Protected Attributes inherited from Boardcore::Sensor< IMUData >
DataType lastSample
 
miosix::FastMutex mutex
 
- Protected Attributes inherited from Boardcore::AbstractSensor
SensorErrors lastError = SensorErrors::NO_ERRORS
 

Detailed Description

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.

Member Typedef Documentation

◆ SampleIMUFunction

Definition at line 42 of file RotatedIMU.h.

Constructor & Destructor Documentation

◆ RotatedIMU()

Boardcore::RotatedIMU::RotatedIMU ( SampleIMUFunction sampleFunction)
explicit

Construct a new Rotated IMU object.

Parameters
sampleFunctionCallback to retrieve accelerometer, magnetometer and gyroscope data

Definition at line 30 of file RotatedIMU.cpp.

Member Function Documentation

◆ addAccTransformation()

void Boardcore::RotatedIMU::addAccTransformation ( const Eigen::Matrix3f & t)

Multiplies the current accelerometer transformation.

Parameters
transformationTransformation matrix to be multiplied to the current one

Definition at line 35 of file RotatedIMU.cpp.

◆ addGyroTransformation()

void Boardcore::RotatedIMU::addGyroTransformation ( const Eigen::Matrix3f & t)

Multiplies the current gyroscope transformation.

Parameters
transformationTransformation matrix to be multiplied to the current one

Definition at line 36 of file RotatedIMU.cpp.

◆ addMagTransformation()

void Boardcore::RotatedIMU::addMagTransformation ( const Eigen::Matrix3f & t)

Multiplies the current magnetometer transformation.

Parameters
transformationTransformation matrix to be multiplied to the current one

Definition at line 37 of file RotatedIMU.cpp.

◆ init()

bool Boardcore::RotatedIMU::init ( )
inlineoverridevirtual

Initialize the sensor.

Returns
boolean value indicating whether the operation succeded or not

Implements Boardcore::AbstractSensor.

Definition at line 52 of file RotatedIMU.h.

◆ resetTransformations()

void Boardcore::RotatedIMU::resetTransformations ( )

Resets all the transformations to the original (Identity) ones.

Definition at line 39 of file RotatedIMU.cpp.

◆ rotateAroundX()

Matrix3f Boardcore::RotatedIMU::rotateAroundX ( float angle)
static

Creates a rotation matrix around the X axis.

Parameters
angleAngle in degrees

Definition at line 46 of file RotatedIMU.cpp.

◆ rotateAroundY()

Matrix3f Boardcore::RotatedIMU::rotateAroundY ( float angle)
static

Creates a rotation matrix around the Y axis.

Parameters
angleAngle in degrees

Definition at line 60 of file RotatedIMU.cpp.

◆ rotateAroundZ()

Matrix3f Boardcore::RotatedIMU::rotateAroundZ ( float angle)
static

Creates a rotation matrix around the Z axis.

Parameters
angleAngle in degrees

Definition at line 74 of file RotatedIMU.cpp.

◆ sampleImpl()

IMUData Boardcore::RotatedIMU::sampleImpl ( )
overrideprotectedvirtual

Read a data sample from the sensor. In case of errors, the method should return the last available correct sample.

Returns
sensor data sample

Implements Boardcore::Sensor< IMUData >.

Definition at line 88 of file RotatedIMU.cpp.

◆ selfTest()

bool Boardcore::RotatedIMU::selfTest ( )
inlineoverridevirtual

Check if the sensor is working.

Returns
boolean indicating whether the sensor is correctly working or not

Implements Boardcore::AbstractSensor.

Definition at line 53 of file RotatedIMU.h.


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