libs/kaptan-sensor: split observations by sensor domain
This commit is contained in:
1 parent
117e1abe97
commit
8879ddf675
6 files changed
+70
-38
No files matched your search
@@ -5,7 +5,7 @@ mod error;
|
|||||||
mod registers;
|
mod registers;
|
||||||
mod sample;
|
mod sample;
|
||||||
|
|
||||||
use kaptan_sensor::ImuSnapshot;
|
use kaptan_sensor::imu::ImuSnapshot;
|
||||||
use kaptan_spi::{SpiCompletion, SpiDevice};
|
use kaptan_spi::{SpiCompletion, SpiDevice};
|
||||||
use kaptan_time::Timestamp;
|
use kaptan_time::Timestamp;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! MPU6000 burst-sample decoding.
|
//! MPU6000 burst-sample decoding.
|
||||||
|
|
||||||
use kaptan_sensor::ImuSnapshot;
|
use kaptan_sensor::imu::ImuSnapshot;
|
||||||
use kaptan_time::Timestamp;
|
use kaptan_time::Timestamp;
|
||||||
|
|
||||||
use super::{config::Mpu6000Config, registers::SAMPLE_BYTES};
|
use super::{config::Mpu6000Config, registers::SAMPLE_BYTES};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//! Single-owner MPU acquisition service.
|
//! Single-owner MPU acquisition service.
|
||||||
|
|
||||||
use kaptan_drivers::mpu6000::{Error as Mpu6000Error, Mpu6000, Mpu6000Event};
|
use kaptan_drivers::mpu6000::{Error as Mpu6000Error, Mpu6000, Mpu6000Event};
|
||||||
use kaptan_sensor::ImuSnapshot;
|
use kaptan_sensor::imu::ImuSnapshot;
|
||||||
use kaptan_spi::{SpiCompletion, SpiDevice};
|
use kaptan_spi::{SpiCompletion, SpiDevice};
|
||||||
use kaptan_time::MonotonicClock;
|
use kaptan_time::MonotonicClock;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
//! 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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,38 +6,7 @@
|
|||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
use kaptan_time::Timestamp;
|
/// Inertial measurement unit observations.
|
||||||
|
pub mod imu;
|
||||||
/// Coherent IMU observation in the board body frame.
|
/// Distance sensor observations.
|
||||||
///
|
pub mod range;
|
||||||
/// 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,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
//! Distance sensor observations.
|
||||||
|
|
||||||
|
use kaptan_time::Timestamp;
|
||||||
|
|
||||||
|
/// Coherent range observation in the sensor frame.
|
||||||
|
///
|
||||||
|
/// The timestamp is captured when the measurement is requested. Distance is
|
||||||
|
/// expressed in millimetres so rangefinders with centimetre resolution can be
|
||||||
|
/// published without floating-point conversion.
|
||||||
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
|
pub struct RangeSnapshot {
|
||||||
|
/// Monotonic timestamp captured when the acquisition was requested.
|
||||||
|
pub timestamp: Timestamp,
|
||||||
|
/// Measured distance in millimetres.
|
||||||
|
pub distance_millimetres: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl RangeSnapshot {
|
||||||
|
/// Creates one accepted range observation.
|
||||||
|
pub const fn new(timestamp: Timestamp, distance_millimetres: u32) -> Self {
|
||||||
|
Self {
|
||||||
|
timestamp,
|
||||||
|
distance_millimetres,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user