Components::ImuManager
The IMU Manager (Inertial Measurement Unit) component provides sensor data related to motion and orientation of the craft. It interfaces with the LIS2MDL and LSM6DSO sensors via Zephyr drivers to provide acceleration, angular velocity, and magnetic field measurements. It also supports configuration of sampling frequencies and axis orientation.
Usage Examples
The IMU Manager component is designed to be scheduled periodically to trigger collection of sensor data and telemetering. It operates as a passive component that responds to scheduler calls.
Typical Usage
- The component is instantiated and initialized during system startup.
- The component is configured with pointers to the Zephyr devices for LIS2MDL and LSM6DSO.
- The scheduler calls the
run port at regular intervals.
- On each run call, the component:
- Fetches sensor data from the sensors.
- Applies axis orientation corrections.
- Outputs telemetry for acceleration, angular velocity, and magnetic field.
Class Diagram
classDiagram
namespace Components {
class ImuManagerComponentBase {
<<Auto-generated>>
}
class ImuManager {
+ ImuManager(const char* compName)
+ ~ImuManager()
+ configure(const struct device* lis2mdl, const struct device* lsm6dso)
- run_handler(FwIndexType portNum, U32 context): void
- accelerationGet_handler(FwIndexType portNum, Fw::Success& condition): Drv::Acceleration
- angularVelocityGet_handler(FwIndexType portNum, Fw::Success& condition): Drv::AngularVelocity
- magneticFieldGet_handler(FwIndexType portNum, Fw::Success& condition): Drv::MagneticField
- magneticFieldSamplingPeriodGet_handler(FwIndexType portNum, Fw::Success& condition): Fw::TimeIntervalValue
- configureSensors(magn: sensor_value&, accel: sensor_value&, gyro: sensor_value&): void
- applyAxisOrientation(x: sensor_value&, y: sensor_value&, z: sensor_value&): void
- getAccelerometerSamplingFrequency(): sensor_value
- getGyroscopeSamplingFrequency(): sensor_value
- getLsm6dsoSamplingFrequency(freqParam: Lsm6dsoSamplingFrequency): sensor_value
- getMagnetometerSamplingFrequency(): sensor_value
- sensorValuesEqual(sv1: sensor_value*, sv2: sensor_value*): bool
- m_lis2mdl: const device*
- m_lsm6dso: const device*
- m_curr_magn_odr: sensor_value
- m_curr_gyro_odr: sensor_value
- m_curr_accel_odr: sensor_value
}
}
ImuManagerComponentBase <|-- ImuManager : inherits
Port Descriptions
| Name |
Type |
Description |
| run |
sync input |
Scheduler port that triggers sensor data collection |
| accelerationGet |
sync input |
Port to read the current acceleration |
| angularVelocityGet |
sync input |
Port to read the current angular velocity |
| magneticFieldGet |
sync input |
Port to read the current magnetic field |
| magneticFieldSamplingPeriodGet |
sync input |
Port to get the time between magnetic field reads |
| acceleration |
output |
Port for sending accelerationGet calls to the LSM6DSO Driver |
| angularVelocity |
output |
Port for sending angularVelocityGet calls to the LSM6DSO Driver |
| magneticField |
output |
Port for sending magneticFieldGet calls to the LIS2MDL Manager |
| timeCaller |
time get |
Port for requesting current system time |
| cmdRegOut |
command reg |
Port for sending command registrations |
| cmdIn |
command recv |
Port for receiving commands |
| cmdResponseOut |
command resp |
Port for sending command responses |
| logTextOut |
text event |
Port for sending textual representation of events |
| logOut |
event |
Port for sending events to downlink |
| tlmOut |
telemetry |
Port for sending telemetry channels to downlink |
| prmGetOut |
param get |
Port to return the value of a parameter |
| prmSetOut |
param set |
Port to set the value of a parameter |
Parameters
| Name |
Type |
Description |
| ACCELEROMETER_SAMPLING_FREQUENCY |
Lsm6dsoSamplingFrequency |
Sampling frequency for the accelerometer |
| GYROSCOPE_SAMPLING_FREQUENCY |
Lsm6dsoSamplingFrequency |
Sampling frequency for the gyroscope |
| MAGNETOMETER_SAMPLING_FREQUENCY |
Lis2mdlSamplingFrequency |
Sampling frequency for the magnetometer |
| AXIS_ORIENTATION |
AxisOrientation |
Orientation of the sensor axes (Standard, Rotated 90 CW, Rotated 90 CCW, Rotated 180) |
Telemetry
| Name |
Type |
Description |
| AxisOrientation |
AxisOrientation |
Current axis orientation setting |
| Acceleration |
Drv.Acceleration |
Current acceleration in m/s^2 |
| AngularVelocity |
Drv.AngularVelocity |
Current angular velocity in rad/s |
| MagneticField |
Drv.MagneticField |
Current magnetic field in gauss |
| AccelerometerSamplingFrequency |
Lsm6dsoSamplingFrequency |
Current accelerometer sampling frequency |
| GyroscopeSamplingFrequency |
Lsm6dsoSamplingFrequency |
Current gyroscope sampling frequency |
| MagnetometerSamplingFrequency |
Lis2mdlSamplingFrequency |
Current magnetometer sampling frequency |
Events
| Name |
Severity |
Description |
| Lis2mdlDeviceNotReady |
WARNING_HIGH |
LIS2MDL device not ready |
| Lsm6dsoDeviceNotReady |
WARNING_HIGH |
LSM6DSO device not ready |
| AccelerometerSamplingFrequencyNotConfigured |
WARNING_HIGH |
LSM6DSO accelerometer sampling frequency not configured |
| GyroscopeSamplingFrequencyNotConfigured |
WARNING_HIGH |
LSM6DSO gyroscope sampling frequency not configured |
| MagnetometerSamplingFrequencyNotConfigured |
WARNING_HIGH |
LIS2MDL magnetometer sampling frequency not configured |
| MagnetometerSamplingFrequencyGetFailed |
WARNING_LOW |
Failed to retrieve LIS2MDL magnetometer sampling frequency |
| MagnetometerSamplingFrequencyZeroHz |
WARNING_LOW |
LIS2MDL magnetometer sampling frequency is set to 0 Hz |
Requirements
| Name |
Description |
Validation |
| Sensor Data Collection |
The component shall trigger data collection from both LSM6DSO and LIS2MDL sensors when run is called |
Verify telemetry output updates on run call |
| Periodic Operation |
The component shall operate as a scheduled component responding to scheduler calls |
Verify component responds correctly to scheduler input |
| Configuration |
The component shall allow configuration of sampling frequencies and axis orientation via parameters |
Verify parameters affect sensor configuration and data |
Change Log
| Date |
Description |
| 2025-9-9 |
Initial IMU Manager component |
| 2025-9-18 |
Extracted Zephyr calls to discrete LIS2MDL Manager and LSM6DSO Driver |
| 2025-12-12 |
Added configuration parameters for sampling rates and axis orientation; moved responsibilities from LIS2MDL Manager and LIS2MDL Manager components into the IMU Manager |