Interacting multiple model (IMM) filter
A vehicle drives straight, turns left, drives straight and turns right, and only its position is measured. No single motion model fits all of that, so the IMM filter runs one Kalman filter per model, straight motion and a turn in each direction, and keeps a probability for each.
Algorithm
Every measurement goes through four steps:
Mixing: each filter starts from a blend of all filters’ estimates, weighted by the probability of switching between models.
Model-matched filtering: each filter predicts with its own model and updates with the measurement.
Model probabilities: the models that predicted the measurement well gain probability, in proportion to the likelihood \(\Lambda_j\) of the measurement under each model.
Combination: the output is the probability-weighted blend of the filters:
Compared with a single constant-velocity Kalman filter whose process noise is tuned for its lowest error, the IMM filter’s error is the same in turns as on straight segments.
Code Link
- Localization.imm_filter.imm_filter.imm_step(means: ndarray, covs: ndarray, probs: ndarray, z: ndarray, transitions: list[ndarray], noises: list[ndarray], switch: ndarray) tuple[ndarray, ndarray, ndarray, ndarray, ndarray]
One IMM cycle. means (M, 4), covs (M, 4, 4) and probs (M,) are the model-conditioned estimates; returns them updated, followed by the combined mean and covariance.
Standalone project and report
This algorithm is also published as a standalone project, robofan45/imm-filter, with an installable package, tests that run on Linux, macOS and Windows, and an IEEE-style technical report (PDF) with measurements and a full bibliography.
Reference
H. A. P. Blom and Y. Bar-Shalom, “The Interacting Multiple Model Algorithm for Systems with Markovian Switching Coefficients”, IEEE Transactions on Automatic Control, 1988
Y. Bar-Shalom, X. R. Li and T. Kirubarajan, “Estimation with Applications to Tracking and Navigation”, Wiley, 2001