← Back to the chapter · Previous detail · Next detail →
Technical detail · Complementary Filters: Tuning and Validity
Follow the Kalman recursion and covariance checks
The complete recursion is:
Read it step by step: predict the state, predict its uncertainty, form the measurement residual, predict the residual variance, calculate the Kalman gain, correct the state, then reduce the covariance in the observed direction. If accelerometer variance rises during vibration, the residual variance grows and the gain normally gives that angle less influence. If process covariance is too small, the filter becomes overconfident in an imperfect motion/bias model and responds sluggishly to real change.
| Matrix or record | IMU meaning | Evidence used to set it |
|---|---|---|
| Sample-period motion and bias model | Timestamped update rate and chosen physical state | |
| Which state combination the accelerometer angle observes | Axis convention and angle derivation | |
| Gyro integration/model and bias random-walk uncertainty | Stationary and temperature-varying gyro data | |
| Accelerometer-angle measurement uncertainty | Static orientation, vibration, and linear-acceleration tests | |
| Initial uncertainty in angle and bias | Startup alignment and calibration procedure |
Calculate the matrix dimensions and units before writing the loop. In the two-state example, is , and are , is , is , and scalar angle measurement noise may be represented by a . The angle-bias off-diagonal entries in matter: a measurement that corrects angle can also improve the inferred bias through that covariance. For numerical robustness, keep symmetric, verify that and are positive semidefinite, and use the Joseph covariance update when finite-precision rounding is visible: