Skip to main content

MotionBasedViInitializer

Struct MotionBasedViInitializer 

Source
pub struct MotionBasedViInitializer { /* private fields */ }
Expand description

State machine that fires a single VIBA1 inertial-only solve once the keyframe count + cumulative-translation thresholds are met. See the module docstring and the design note docs/motion_based_vi_alignment.md for the full contract.

Implementations§

Source§

impl MotionBasedViInitializer

Source

pub const fn new( config: MotionBasedViInitializerConfig, ) -> MotionBasedViInitializer

Construct with the given config; carries no keyframes yet.

Source

pub const fn config(&self) -> &MotionBasedViInitializerConfig

Borrow the active configuration.

Source

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

Overwrite the running config’s gravity_world. Used by crate::OnlineSlamPipeline::promote_motion_vi_init_result to mirror a freshly-estimate_gravity-recovered gravity vector back into this initializer so a LATER window (a subsequent BiasReleaseSchedule Stage B, or a fresh sequence after reset_sequence_state) starts from the corrected assumption instead of the original (possibly wrong) config value. Does not touch any cached result or registered keyframe/translation state.

Source

pub fn reset(&mut self)

Drop every accumulated keyframe and the cached VIBA1 result. The configuration is preserved. Mirrors crate::VisualInertialInitializer::reset.

Source

pub fn keyframes_observed(&self) -> usize

Number of keyframes registered since construction / last reset.

Source

pub const fn cumulative_translation_meters(&self) -> f64

Cumulative camera-centre translation (m) along the registered keyframe chain.

Source

pub fn register_keyframe( &mut self, keyframe_id: u64, camera_center_world: OPoint<f64, Const<3>>, )

Note a freshly-registered keyframe’s camera centre in world frame. The first call after construction / reset only seeds the chain; subsequent calls add the inter-keyframe distance to the running cumulative-translation total.

Idempotent against re-registering the same keyframe_id: a second call with the same id silently overwrites the prior centre without double-counting. (This matters when a pipeline fires a “new keyframe” event and immediately corrects the pose via local-BA on the same frame.)

Source

pub fn is_ready(&self) -> bool

true once both trigger gates (keyframe count + translation) are satisfied. try_initialize will still return Err if no IMU factor connects any pair, but is_ready is the cheap pre-check the pipeline can poll on every frame.

Source

pub const fn result(&self) -> Option<&MotionBasedViInitializationResult>

Returns the cached result if VIBA1 has already fired.

Source

pub const fn velocity_stage_result( &self, ) -> Option<&MotionBasedViInitializationResult>

Returns the cached BiasReleaseSchedule Stage A (“velocity stage”) result, if one has fired. Always None when config().bias_release is None, or once the initializer has reached the terminal Initialised state (Stage A’s cache is not cleared on Stage B success, but callers should prefer Self::result at that point).

Source

pub const fn last_gravity_alignment(&self) -> Option<&GravityVelocityAlignment>

Returns the most recent estimate_gravity_and_velocities outcome, if config().estimate_gravity has ever produced one — regardless of whether that attempt went on to be accepted or rejected by a later gate. None when estimate_gravity is off, when no in-window attempt has run yet, or after Self::reset. See the field-level doc comment on last_gravity_alignment for why this exists separately from the terminal Self::result.

Source

pub const fn last_gyro_bias_alignment(&self) -> Option<&GyroBiasAlignment>

Returns the most recent estimate_gyro_bias outcome, if config().estimate_gyro_bias has ever produced one — regardless of whether that attempt went on to be accepted or rejected by a later gate. None when estimate_gyro_bias is off, when no in-window attempt has run yet, or after Self::reset. See the field-level doc comment on last_gyro_bias_alignment for why this exists separately from the terminal Self::result.

Source

pub fn status(&self) -> MotionBasedViInitializationStatus

Render a read-only snapshot of the current state.

Source

pub fn try_initialize( &mut self, map: &mut VisualMap, preintegration_factors: &[ImuPreintegrationFactor], static_seed: &VisualInertialInitializationResult, ) -> Result<&MotionBasedViInitializationResult, MotionBasedViRejectionReason>

Attempt to fire VIBA1 over the registered keyframes.

On success, the inertial-only solve refines map.keyframes[*]’s poses in place and the cached MotionBasedViInitializationResult is returned. The initialiser is single-shot: a successful firing parks the initialiser in the Initialised state and subsequent calls short-circuit to the cached result. Call Self::reset to re-arm for a new sequence.

static_seed is consumed only as a sanity seed for downstream keyframe_states (the inertial-only solver pulls per-keyframe initial values from map.keyframes[*]’s poses + the static seed’s biases / velocity).

Source

pub fn try_initialize_with_bias_seed( &mut self, map: &mut VisualMap, preintegration_factors: &[ImuPreintegrationFactor], bias_gyro_seed: Matrix<f64, Const<3>, Const<1>, ArrayStorage<f64, 3, 1>>, bias_acc_seed: Matrix<f64, Const<3>, Const<1>, ArrayStorage<f64, 3, 1>>, ) -> Result<&MotionBasedViInitializationResult, MotionBasedViRejectionReason>

Motion-based initialization from explicit bias linearisation values. This is the safe fallback entry point for sequences that begin in motion: the caller may retain its calibrated/configured biases after a stationary initializer gives up, without fabricating a false static gravity/bias result. The solver still requires its normal keyframe and translation excitation gates.

When config().bias_release is Some(schedule), this call may instead run BiasReleaseSchedule Stage A (the bias-fixed “velocity stage”): see the type-level docs on BiasReleaseSchedule for the full two-stage contract. Check result.bias_released — false means this is a non-terminal Stage A result; true means the legacy path or Stage B fired and the initializer is now Initialised.

Trait Implementations§

Source§

impl Clone for MotionBasedViInitializer

Source§

fn clone(&self) -> MotionBasedViInitializer

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 MotionBasedViInitializer

Source§

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

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

impl PartialEq for MotionBasedViInitializer

Source§

fn eq(&self, other: &MotionBasedViInitializer) -> 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 MotionBasedViInitializer

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