IMU Interface#

IMU sensor abstraction layer.

This module provides a common interface for IMU drivers (Hardware and SITL).

IMU Implementations:

namespace drivers#
class IMU#
#include <imu.hpp>

Abstract Interface for IMU sensor class. The point of this class is to give a clean interface so the Payload Controller doesn’t need to know where it gets sensor data from. This header is the only interface the rest of the application needs, hence why there is no imu_sitl.hpp.

Subclassed by drivers::IMU_HW, drivers::IMU_SITL

Public Functions

virtual ~IMU() = default#
virtual void start() = 0#

Starts the IMU. It should immediately start writing imu messages to internal buffer.

void write_latest(const sensor_msgs_msg_Imu &msg)#

Writes a new incoming imu reading to.

sensor_msgs_msg_Imu get_latest()#

returns the latest imu reading

Public Static Functions

static IMU *instance()#

Gets singleton instance of imu implementation (sitl, hardware). implemented in backend .cpp files, not imu.cpp

Protected Functions

IMU() = default#

Private Members

sensor_msgs_msg_Imu reading_#
util::StaticMutex mtx_#

Private Static Functions

static IMU &create()#

Implemented once per backend (imu_sitl.cpp / imu_hw.cpp). Constructs the concrete backend instance.