openrr_base/
utils.rs
1use arci::BaseVelocity;
2use thiserror::Error;
3
4#[derive(Debug, Clone, Copy)]
5pub struct BaseVelocityTimestamped {
6 pub base_velocity: BaseVelocity,
7 pub timestamp: std::time::Instant,
8}
9
10impl BaseVelocityTimestamped {
11 pub fn new_with_now(base_velocity: BaseVelocity) -> Self {
12 Self {
13 base_velocity,
14 timestamp: std::time::Instant::now(),
15 }
16 }
17}
18
19impl Default for BaseVelocityTimestamped {
20 fn default() -> Self {
21 Self {
22 base_velocity: BaseVelocity::default(),
23 timestamp: std::time::Instant::now(),
24 }
25 }
26}
27
28pub type BaseAcceleration = BaseVelocity;
29
30#[derive(Debug, Error)]
31#[non_exhaustive]
32pub enum Error {
33 #[error("openrr-base: Current position is unknown")]
34 CurrentPositionUnknown,
35}