38 lines
1.2 KiB
Rust
38 lines
1.2 KiB
Rust
//! Inertial measurement unit observations.
|
|
|
|
use kaptan_time::Timestamp;
|
|
|
|
/// Coherent IMU observation in the board body frame.
|
|
///
|
|
/// Acceleration is milligravity, angular rate is milliradians per second, and
|
|
/// temperature is centidegrees Celsius. The board-frame transform is complete
|
|
/// before this value is published.
|
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
|
pub struct ImuSnapshot {
|
|
/// Monotonic timestamp captured at acquisition interrupt entry.
|
|
pub timestamp: Timestamp,
|
|
/// Body-frame acceleration in milligravity.
|
|
pub acceleration_milligravity: [i16; 3],
|
|
/// Body-frame angular rate in milliradians per second.
|
|
pub angular_rate_milliradians_per_second: [i16; 3],
|
|
/// Sensor temperature in centidegrees Celsius.
|
|
pub temperature_centidegrees_celsius: i16,
|
|
}
|
|
|
|
impl ImuSnapshot {
|
|
/// Creates one accepted IMU observation.
|
|
pub const fn new(
|
|
timestamp: Timestamp,
|
|
acceleration_milligravity: [i16; 3],
|
|
angular_rate_milliradians_per_second: [i16; 3],
|
|
temperature_centidegrees_celsius: i16,
|
|
) -> Self {
|
|
Self {
|
|
timestamp,
|
|
acceleration_milligravity,
|
|
angular_rate_milliradians_per_second,
|
|
temperature_centidegrees_celsius,
|
|
}
|
|
}
|
|
}
|