use apex_manifolds::se3::SE3;
use apex_manifolds::so3::SO3;
use nalgebra::Vector3;
pub(crate) const NANOS_PER_SECOND: f64 = 1e9;
pub(crate) const NANOS_PER_SEC: u64 = 1_000_000_000;
#[derive(Debug, Clone, PartialEq)]
pub struct TrajectoryPose {
pub timestamp_ns: u64,
pub position: Vector3<f64>,
pub orientation: SO3,
}
impl TrajectoryPose {
pub fn new(timestamp_ns: u64, position: Vector3<f64>, orientation: SO3) -> Self {
Self {
timestamp_ns,
position,
orientation,
}
}
pub fn from_se3(timestamp_ns: u64, pose: &SE3) -> Self {
Self {
timestamp_ns,
position: pose.translation(),
orientation: pose.rotation_so3(),
}
}
pub fn se3(&self) -> SE3 {
SE3::from_translation_so3(self.position, self.orientation.clone())
}
pub fn timestamp_seconds(&self) -> f64 {
self.timestamp_ns as f64 / NANOS_PER_SECOND
}
}
#[derive(Debug, Clone, PartialEq, Default)]
pub struct InertialState {
pub velocity: Vector3<f64>,
pub gyro_bias: Vector3<f64>,
pub accel_bias: Vector3<f64>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum TrajectoryFormat {
Tum,
Asl,
}