Files
kaptan/firmware/libs/kaptan-sensor/src/range.rs
T

27 lines
819 B
Rust

//! 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,
}
}
}