|
libstp
Robotics library for Botball
|
Interface for IMU abstraction. More...
#include <IIMU.hpp>
Public Member Functions | |
| virtual | ~IIMU ()=default |
| virtual void | read (float *accel, float *gyro, float *magneto)=0 |
| Read accel, gyro, and magnetometer vectors into caller-owned buffers. | |
| virtual void | calibrate ()=0 |
| Run platform-specific IMU calibration if implemented. | |
| virtual float | getHeading ()=0 |
| virtual void | getAngularVelocity (float *gyro) |
| void | setYawRateAxisMode (const TurnAxisMode mode) |
| Configure which axis getYawRate() reports, using the enum form. | |
| void | setYawRateAxisMode (const std::string &mode) |
| Configure which axis getYawRate() reports, using a string alias. | |
| TurnAxisMode | getYawRateAxisMode () const |
| std::string | getYawRateAxisModeName () const |
| float | getYawRate () |
| virtual void | getLinearAcceleration (float *linear_accel)=0 |
| virtual void | getQuaternion (float *quat)=0 |
| virtual void | getIntegratedVelocity (float *vel) |
| virtual void | resetIntegratedVelocity () |
| virtual bool | waitForReady (int timeout_ms=1000)=0 |
| Wait until the implementation has enough data to provide orientation. | |
Interface for IMU abstraction.
This interface allows for mocking the IMU in unit tests and enables dependency injection in odometry classes.
|
virtualdefault |
|
pure virtual |
Run platform-specific IMU calibration if implemented.
Implemented in libstp::hal::imu::IMU.
|
inlinevirtual |
Get angular velocity (gyroscope) in body frame
| gyro | Output array [x, y, z] for angular velocity in rad/s |
Reimplemented in libstp::hal::imu::IMU.
|
nodiscardpure virtual |
Get firmware-computed heading in radians
Implemented in libstp::hal::imu::IMU.
|
inlinevirtual |
Get firmware-integrated velocity from accelerometer in body frame (m/s)
| vel | Output array [x, y, z] for velocity |
Reimplemented in libstp::hal::imu::IMU.
|
pure virtual |
Get gravity-compensated linear acceleration in body frame
| linear_accel | Output array [x, y, z] for linear acceleration in m/s² |
Implemented in libstp::hal::imu::IMU.
|
pure virtual |
Get the DMP 6-axis fused orientation quaternion (gyro+accel).
Its roll/pitch is gravity-referenced and drift/vibration-immune, making it a far better tilt source than the raw accelerometer while the robot is driving. When no quaternion has been received (e.g. a firmware build that does not publish it), the output is all-zero so callers can detect "no data" via |q| < 0.5.
| quat | Output array [w, x, y, z] (unit quaternion). |
Implemented in libstp::hal::imu::IMU.
|
inline |
Get the angular rate around the configured turn axis. Default is world z-axis ("world_z"), which matches the original yaw-rate behavior. Body-axis modes ("body_x", "body_y", "body_z") return the raw body-frame gyro component and are useful when the robot rotates while tilted/upright.
|
inlinenodiscard |
|
inlinenodiscard |
|
pure virtual |
Read accel, gyro, and magnetometer vectors into caller-owned buffers.
Implemented in libstp::hal::imu::IMU.
|
inlinevirtual |
Reset the firmware-integrated velocity offset (next read returns zero)
Reimplemented in libstp::hal::imu::IMU.
|
inline |
Configure which axis getYawRate() reports, using a string alias.
|
inline |
Configure which axis getYawRate() reports, using the enum form.
|
pure virtual |
Wait until the implementation has enough data to provide orientation.
Implemented in libstp::hal::imu::IMU.