libstp
Robotics library for Botball
Loading...
Searching...
No Matches
libstp::hal::imu::IMU Class Reference

#include <IMU.hpp>

Inheritance diagram for libstp::hal::imu::IMU:
[legend]
Collaboration diagram for libstp::hal::imu::IMU:
[legend]

Public Member Functions

 IMU ()
 Construct the platform IMU implementation.
 ~IMU () override
void read (float *accel, float *gyro, float *magneto) override
 Read accel, gyro, and magnetometer data into caller-owned buffers.
void getAngularVelocity (float *gyro) override
 Read angular velocity in radians per second into a caller-owned buffer.
void calibrate () override
 Run whatever calibration behavior the active platform exposes.
float getHeading () override
 Return the current heading in radians using libstp sign conventions.
void getLinearAcceleration (float *linear_accel) override
 Read gravity-compensated acceleration into a caller-owned buffer.
void getQuaternion (float *quat) override
 Read the DMP fused orientation quaternion [w,x,y,z] into a buffer.
void getIntegratedVelocity (float *vel) override
 Read firmware-integrated velocity when the platform provides it.
void resetIntegratedVelocity () override
 Reset the platform's integrated-velocity accumulator if supported.
bool waitForReady (int timeout_ms=1000) override
 Wait for the platform to report that initial orientation data is ready.
Public Member Functions inherited from libstp::hal::imu::IIMU
virtual ~IIMU ()=default
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 ()

Static Public Member Functions

static std::shared_ptr< IMU > instance ()

Detailed Description

Concrete IMU wrapper backed by the selected platform bundle.

Higher-level code should depend on IIMU when injection is useful and instantiate IMU when it wants the configured hardware implementation.

Definition at line 15 of file IMU.hpp.

Constructor & Destructor Documentation

◆ IMU()

libstp::hal::imu::IMU::IMU ( )

Construct the platform IMU implementation.

◆ ~IMU()

libstp::hal::imu::IMU::~IMU ( )
override

Member Function Documentation

◆ calibrate()

void libstp::hal::imu::IMU::calibrate ( )
overridevirtual

Run whatever calibration behavior the active platform exposes.

Implements libstp::hal::imu::IIMU.

◆ getAngularVelocity()

void libstp::hal::imu::IMU::getAngularVelocity ( float * gyro)
overridevirtual

Read angular velocity in radians per second into a caller-owned buffer.

Reimplemented from libstp::hal::imu::IIMU.

◆ getHeading()

float libstp::hal::imu::IMU::getHeading ( )
nodiscardoverridevirtual

Return the current heading in radians using libstp sign conventions.

Implements libstp::hal::imu::IIMU.

◆ getIntegratedVelocity()

void libstp::hal::imu::IMU::getIntegratedVelocity ( float * vel)
overridevirtual

Read firmware-integrated velocity when the platform provides it.

Reimplemented from libstp::hal::imu::IIMU.

◆ getLinearAcceleration()

void libstp::hal::imu::IMU::getLinearAcceleration ( float * linear_accel)
overridevirtual

Read gravity-compensated acceleration into a caller-owned buffer.

Implements libstp::hal::imu::IIMU.

◆ getQuaternion()

void libstp::hal::imu::IMU::getQuaternion ( float * quat)
overridevirtual

Read the DMP fused orientation quaternion [w,x,y,z] into a buffer.

Implements libstp::hal::imu::IIMU.

◆ instance()

std::shared_ptr< IMU > libstp::hal::imu::IMU::instance ( )
static

Shared, process-wide IMU handle.

IMU is stateless: every method delegates to the platform TransportReader/MockPlatform singleton. A single instance is therefore sufficient, and reusing it avoids the redundant construction that trips the imuInstanceCreated safety guard. All call sites (Python binding, odometry) should obtain the IMU through this accessor rather than constructing their own.

◆ read()

void libstp::hal::imu::IMU::read ( float * accel,
float * gyro,
float * magneto )
overridevirtual

Read accel, gyro, and magnetometer data into caller-owned buffers.

Implements libstp::hal::imu::IIMU.

◆ resetIntegratedVelocity()

void libstp::hal::imu::IMU::resetIntegratedVelocity ( )
overridevirtual

Reset the platform's integrated-velocity accumulator if supported.

Reimplemented from libstp::hal::imu::IIMU.

◆ waitForReady()

bool libstp::hal::imu::IMU::waitForReady ( int timeout_ms = 1000)
overridevirtual

Wait for the platform to report that initial orientation data is ready.

Implements libstp::hal::imu::IIMU.


The documentation for this class was generated from the following file:
  • /home/runner/work/raccoon-lib/raccoon-lib/modules/libstp-hal/include/hal/IMU.hpp