31 : sampleImu(
std::move(sampleImuFunction))
41 accT = Matrix3f::Identity();
42 gyroT = Matrix3f::Identity();
43 magT = Matrix3f::Identity();
49 angle = angle * EIGEN_PI / 180.f;
52 rotation = Matrix3f{{1, 0, 0},
53 {0, cosf(angle), -sinf(angle)},
54 {0, sinf(angle), cosf(angle)}};
63 angle = angle * EIGEN_PI / 180.f;
66 rotation = Matrix3f{{cosf(angle), 0, sinf(angle)},
68 {-sinf(angle), 0, cosf(angle)}};
77 angle = angle * EIGEN_PI / 180.f;
80 rotation = Matrix3f{{cosf(angle), -sinf(angle), 0},
81 {sinf(angle), cosf(angle), 0},
90 auto imuData = sampleImu();
96 Vector3f rotatedAcc = accT *
static_cast<Vector3f
>(accData);
97 Vector3f rotatedGyro = gyroT *
static_cast<Vector3f
>(gyroData);
98 Vector3f rotatedMag = magT *
static_cast<Vector3f
>(magData);
109 return {acc, gyro, mag};
RotatedIMU(SampleIMUFunction sampleFunction)
Construct a new Rotated IMU object.
static Eigen::Matrix3f rotateAroundZ(float angle)
Creates a rotation matrix around the Z axis.
void addGyroTransformation(const Eigen::Matrix3f &t)
Multiplies the current gyroscope transformation.
static Eigen::Matrix3f rotateAroundX(float angle)
Creates a rotation matrix around the X axis.
void resetTransformations()
Resets all the transformations to the original (Identity) ones.
IMUData sampleImpl() override
Read a data sample from the sensor. In case of errors, the method should return the last available co...
void addAccTransformation(const Eigen::Matrix3f &t)
Multiplies the current accelerometer transformation.
std::function< IMUData()> SampleIMUFunction
static Eigen::Matrix3f rotateAroundY(float angle)
Creates a rotation matrix around the Y axis.
void addMagTransformation(const Eigen::Matrix3f &t)
Multiplies the current magnetometer transformation.
This file includes all the types the logdecoder script will decode.
Structure to handle accelerometer data.
uint64_t accelerationTimestamp
Structure to handle gyroscope data.
uint64_t angularSpeedTimestamp
Structure to handle magnetometer data.
uint64_t magneticFieldTimestamp