Skip to main content

ImuPredictiveMotionModel

Struct ImuPredictiveMotionModel 

Source
pub struct ImuPredictiveMotionModel {
    pub config: ImuPredictiveMotionModelConfig,
    /* private fields */
}
Expand description

Inertial pose predictor: a “loosely coupled” replacement for ConstantPoseMotionModel / ConstantVelocityMotionModel that integrates body-frame IMU samples forward from the previous successful pose to produce the next pose prior. Mirrors the inputs of crate::Tracker’s motion-model slot so it can be dropped in via Tracker::new_with_motion_model.

Lifecycle:

  1. The caller pushes inter-frame IMU samples via Self::push_imu_measurement (mutable, accumulates in pending_samples).
  2. The tracker invokes MotionModel::predict_pose (read-only): the model forward-Eulers (R_bw, v_w, p_bw) from last_successful_pose using the pending samples + the configured gravity / biases + the current velocity_world and returns the predicted world_to_camera pose.
  3. The tracker invokes MotionModel::observe: on success the pending samples are drained (the next inter-frame window starts fresh). The model itself does NOT re-estimate velocity_world from the tracker’s output — that update is the caller’s responsibility (e.g., from a downstream local VI-BA’s refined velocity, or from a finite-difference of camera centres over the integrated window). Without an explicit update, the predictor re-uses the last set velocity, which is the same constant-velocity behaviour ConstantVelocityMotionModel gives.

Coordinate conventions match the IMU pre-integrator: gyro and accel are body-frame; gravity is in the world frame (KITTI y-down default: (0, 9.81, 0)); accel includes gravity such that a stationary IMU reads R_wb^T · (−gravity_world).

Fields§

§config: ImuPredictiveMotionModelConfig

Static configuration (gravity, biases). Update biases via Self::set_biases when a downstream VI-BA refines them.

Implementations§

Source§

impl ImuPredictiveMotionModel

Source

pub fn new(config: ImuPredictiveMotionModelConfig) -> ImuPredictiveMotionModel

Source

pub fn push_imu_measurement( &mut self, gyro: Matrix<f64, Const<3>, Const<1>, ArrayStorage<f64, 3, 1>>, accel: Matrix<f64, Const<3>, Const<1>, ArrayStorage<f64, 3, 1>>, dt: f64, )

Append one body-frame (gyro, accel) sample with the elapsed time dt (seconds) since the previous sample. Non-positive dt is silently dropped to keep raw IMU replays robust.

Source

pub const fn set_velocity_world( &mut self, velocity_world: Matrix<f64, Const<3>, Const<1>, ArrayStorage<f64, 3, 1>>, )

Overwrite the world-frame velocity carried into the next predict_pose. Call this after a downstream solver (e.g., the OnlineSlamPipeline local VI-BA) refines the velocity at the most recent keyframe.

Source

pub fn body_velocity_from_camera_pose_difference( &self, prev: &Pose, curr: &Pose, dt_seconds: f64, ) -> Option<Matrix<f64, Const<3>, Const<1>, ArrayStorage<f64, 3, 1>>>

Non-mutating finite-difference body-frame world-velocity from two successive camera poses and the elapsed time between them. Returns None when dt_seconds is not strictly positive/finite. Callers that want to write the result into velocity_world should use Self::update_velocity_from_camera_pose_difference; callers that need to combine multiple finite-differences (e.g. the Phase-25 ThreePoseSmoother refresh policy averages two) use this directly to avoid intermediate state writes.

Source

pub fn update_velocity_from_camera_pose_difference( &mut self, prev: &Pose, curr: &Pose, dt_seconds: f64, )

Update velocity_world to a finite-difference estimate from two successive camera poses and the elapsed time between them. Internally converts each camera pose to a body pose via body_to_sensor so the velocity is the body’s world-frame velocity (the integrator’s expected initial-velocity semantics), not the camera’s. Non-positive dt_seconds is silently dropped. This is the recommended hook for callers that do not run a downstream VI-BA (which would normally refine velocity) — without it, velocity_world stays at the constructor default (zero) and the position integration only picks up the quadratic accel term, systematically under-predicting motion on a moving body.

Source

pub const fn set_biases( &mut self, bias_gyro: Matrix<f64, Const<3>, Const<1>, ArrayStorage<f64, 3, 1>>, bias_acc: Matrix<f64, Const<3>, Const<1>, ArrayStorage<f64, 3, 1>>, )

Overwrite the gyro / accel bias linearisation points.

Source

pub fn pending_samples_len(&self) -> usize

Read-only access to the current pending-sample count, mostly for tests / diagnostics.

Source

pub fn pending_samples_total_dt(&self) -> f64

Sum of dt over all currently-pending IMU samples. Useful for callers (e.g. AdaptiveImuPoseMotionModel) that need to know the elapsed wall-clock time between the previous successful observe() (which drained the buffer) and the moment this is queried — typically immediately before the next observe() drain. Returns 0.0 when no samples are pending.

Source

pub const fn velocity_world( &self, ) -> Matrix<f64, Const<3>, Const<1>, ArrayStorage<f64, 3, 1>>

Read-only access to the current world-frame velocity.

Trait Implementations§

Source§

impl Clone for ImuPredictiveMotionModel

Source§

fn clone(&self) -> ImuPredictiveMotionModel

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ImuPredictiveMotionModel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl MotionModel for ImuPredictiveMotionModel

Source§

fn predict_pose( &self, _frame: &Frame, _last_result: Option<&TrackingResult>, last_successful_pose: Option<&Pose>, ) -> Option<Pose>

Source§

fn observe(&mut self, result: &TrackingResult)

Source§

fn reset(&mut self)

Source§

fn apply_pose_correction(&mut self, correction: &SE3)

Apply a rigid world-frame correction to any cached world-frame state the model carries (velocities, cached poses). correction maps OLD world-frame points/poses to NEW world-frame points/poses: p_new = correction.transform_point(&p_old). Called by crate::Tracker::apply_pose_correction after an external pose-graph optimisation (e.g. visloc-slam’s online loop-closure refinement) rewrites keyframe poses, so the model’s own state stays consistent with the corrected map instead of predicting the next prior from stale, pre-correction poses/velocities. Read more
Source§

fn apply_similarity_correction(&mut self, correction: &Sim3)

Apply a rigid-plus-scale (Sim(3)) world-frame correction — apply_pose_correction’s counterpart for a Sim(3) pose-graph solve (see visloc-slam’s online loop-closure refinement Sim3 solver, which corrects monocular-style scale drift a rigid SE(3) graph cannot represent). correction follows the same OLD-world -> NEW-world convention as apply_pose_correction, generalised with a scale factor: p_new = correction.transform_point(&p_old). Read more
Source§

fn allows_pnp_pose_prior_warm_start(&self) -> bool

Whether this model’s prediction is informative enough to seed the PnP optimizer itself. Candidate selection and pose-quality gating may still use every returned prior when this is false. Read more
Source§

impl PartialEq for ImuPredictiveMotionModel

Source§

fn eq(&self, other: &ImuPredictiveMotionModel) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ImuPredictiveMotionModel

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V