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:
- The caller pushes inter-frame IMU samples via
Self::push_imu_measurement(mutable, accumulates inpending_samples). - The tracker invokes
MotionModel::predict_pose(read-only): the model forward-Eulers(R_bw, v_w, p_bw)fromlast_successful_poseusing the pending samples + the configured gravity / biases + the currentvelocity_worldand returns the predictedworld_to_camerapose. - 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-estimatevelocity_worldfrom 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 behaviourConstantVelocityMotionModelgives.
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: ImuPredictiveMotionModelConfigStatic configuration (gravity, biases). Update biases via
Self::set_biases when a downstream VI-BA refines them.
Implementations§
Source§impl ImuPredictiveMotionModel
impl ImuPredictiveMotionModel
pub fn new(config: ImuPredictiveMotionModelConfig) -> ImuPredictiveMotionModel
Sourcepub 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,
)
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.
Sourcepub const fn set_velocity_world(
&mut self,
velocity_world: Matrix<f64, Const<3>, Const<1>, ArrayStorage<f64, 3, 1>>,
)
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.
Sourcepub 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>>>
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.
Sourcepub fn update_velocity_from_camera_pose_difference(
&mut self,
prev: &Pose,
curr: &Pose,
dt_seconds: f64,
)
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.
Sourcepub 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>>,
)
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.
Sourcepub fn pending_samples_len(&self) -> usize
pub fn pending_samples_len(&self) -> usize
Read-only access to the current pending-sample count, mostly for tests / diagnostics.
Sourcepub fn pending_samples_total_dt(&self) -> f64
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.
Sourcepub const fn velocity_world(
&self,
) -> Matrix<f64, Const<3>, Const<1>, ArrayStorage<f64, 3, 1>>
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
impl Clone for ImuPredictiveMotionModel
Source§fn clone(&self) -> ImuPredictiveMotionModel
fn clone(&self) -> ImuPredictiveMotionModel
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ImuPredictiveMotionModel
impl Debug for ImuPredictiveMotionModel
Source§impl MotionModel for ImuPredictiveMotionModel
impl MotionModel for ImuPredictiveMotionModel
fn predict_pose( &self, _frame: &Frame, _last_result: Option<&TrackingResult>, last_successful_pose: Option<&Pose>, ) -> Option<Pose>
fn observe(&mut self, result: &TrackingResult)
fn reset(&mut self)
Source§fn apply_pose_correction(&mut self, correction: &SE3)
fn apply_pose_correction(&mut self, correction: &SE3)
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 moreSource§fn apply_similarity_correction(&mut self, correction: &Sim3)
fn apply_similarity_correction(&mut self, correction: &Sim3)
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 moreSource§fn allows_pnp_pose_prior_warm_start(&self) -> bool
fn allows_pnp_pose_prior_warm_start(&self) -> bool
false. Read moreSource§impl PartialEq for ImuPredictiveMotionModel
impl PartialEq for ImuPredictiveMotionModel
impl StructuralPartialEq for ImuPredictiveMotionModel
Auto Trait Implementations§
impl Forget for ImuPredictiveMotionModel
impl Freeze for ImuPredictiveMotionModel
impl Move for ImuPredictiveMotionModel
impl RefUnwindSafe for ImuPredictiveMotionModel
impl Send for ImuPredictiveMotionModel
impl Sync for ImuPredictiveMotionModel
impl Unpin for ImuPredictiveMotionModel
impl UnsafeUnpin for ImuPredictiveMotionModel
impl UnwindSafe for ImuPredictiveMotionModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.