Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

ConstantVelocityFactor

Open In Colab

Overview

The ConstantVelocityFactor (contributed by Asa Hammond in 2021) is a simple motion model factor that connects two NavState variables at different times, tit_i and tjt_j. It enforces the assumption that the velocity remained constant between the two time steps.

Given NavState XiX_i (containing pose TiT_i and velocity viv_i) and NavState XjX_j (containing pose TjT_j and velocity vjv_j), and the time difference Δt=tj−ti\Delta t = t_j - t_i, this factor penalizes deviations from the constant velocity prediction.

Mathematical Formulation

The factor uses the NavState::update method (or equivalent logic internally) to predict the state at time tjt_j based on the state at tit_i and the assumption of constant velocity (and zero acceleration/angular velocity). Let this prediction be Xj,predX_{j, pred}:

Xj,pred=Xi.update(accel=0,omega=0,Δt)X_{j, pred} = X_i . \text{update}(\text{accel}=0, \text{omega}=0, \Delta t)

Essentially, this integrates the velocity viv_i over Δt\Delta t to predict the change in position, while keeping orientation and velocity constant:

Rj,pred=RiR_{j, pred} = R_i

vj,pred=viv_{j, pred} = v_i

pj,pred=pi+Ri(vibody)Δt(using body velocity update)p_{j, pred} = p_i + R_i (v_i^{body}) \Delta t \quad \text{(using body velocity update)}

The factor’s 9-dimensional error ee is the difference between the predicted state Xj,predX_{j, pred} and the actual state XjX_j, expressed in the tangent space at Xj,predX_{j,pred}:

e=localCoordinatesXj,pred(Xj)e = \text{localCoordinates}_{X_{j, pred}}(X_j)

The noise model associated with the factor determines how strongly deviations from this constant velocity prediction are penalized.

Key Functionality / API

  • Constructor: ConstantVelocityFactor(key1, key2, dt, model): Creates the factor connecting the NavState at key1 (time ii) and key2 (time jj), given the time difference dt and a 9D noise model.

  • evaluateError(state1, state2): Calculates the 9D error vector based on the constant velocity prediction from state1 to state2 over the stored dt.

Usage Example

This factor is often used as a simple process model between consecutive states when higher-fidelity IMU integration is not available or needed.

Created ConstantVelocityFactor:
  keys = { x0 x1 }
  noise model: diagonal sigmas [0.01; 0.01; 0.01; 0.1; 0.1; 0.1; 0.05; 0.05; 0.05];

Error for perfect prediction (should be zero): [0. 0. 0. 0. 0. 0. 0. 0. 0.]
Error for velocity change: [0.  0.  0.  0.  0.  0.  0.  0.1 0. ]
Error for position change: [0.   0.   0.   0.   0.05 0.   0.   0.   0.  ]