openrr_base/
utils.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use arci::BaseVelocity;
use thiserror::Error;

#[derive(Debug, Clone, Copy)]
pub struct BaseVelocityTimestamped {
    pub base_velocity: BaseVelocity,
    pub timestamp: std::time::Instant,
}

impl BaseVelocityTimestamped {
    pub fn new_with_now(base_velocity: BaseVelocity) -> Self {
        Self {
            base_velocity,
            timestamp: std::time::Instant::now(),
        }
    }
}

impl Default for BaseVelocityTimestamped {
    fn default() -> Self {
        Self {
            base_velocity: BaseVelocity::default(),
            timestamp: std::time::Instant::now(),
        }
    }
}

pub type BaseAcceleration = BaseVelocity;

#[derive(Debug, Error)]
#[non_exhaustive]
pub enum Error {
    #[error("openrr-base: Current position is unknown")]
    CurrentPositionUnknown,
}