Analytics & ML · Study deck
Complementary Filters: Tuning and Validity
One alpha value cannot fit every update rate and motion state.
Data Dora is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- Explain: The signs and axis order change with ENU/NED coordinates and sensor mounting, so prove the implementation with known north/east headings and positive roll/pitch rotations rather than copying the equations without a frame definition.
- Explain: The same evidence rule still applies: magnetometers can be corrupted by nearby metal or electronics, and a 9-DOF heading should be labeled degraded when magnetic calibration or field consistency fails.
- Explain: The angle-bias off-diagonal entries in $\mathbf{P}$ matter: a measurement that corrects angle can also improve the inferred bias through that covariance.
Major section
Kalman state-space bridge
The complementary filter uses a fixed blend.
- A Kalman filter makes the same predict-and-correct story explicit as a state model with uncertainty.
- $\mathbf{A}$ advances the old state through the physical model, $\mathbf{B}$ maps a measured or commanded input into that state, and $\mathbf{H}$ selects the combination the sensor can observe.
Major section
Kalman state-space bridge (continued)
If accelerometer variance $R$ rises during vibration, the residual variance grows and the gain normally gives that angle less influence.
- If process covariance $Q$ is too small, the filter becomes overconfident in an imperfect motion/bias model and responds sluggishly to real change.
- The angle-bias off-diagonal entries in $\mathbf{P}$ matter: a measurement that corrects angle can also improve the inferred bias through that covariance.
- The signs and axis order change with ENU/NED coordinates and sensor mounting, so prove the implementation with known north/east headings and positive roll/pitch rotations rather than copying the equations without a frame definition.
Major section
Validity Gates Beat Formula
The formula is simple, but production IMU fusion is mostly about knowing when the assumptions are valid.
- The accelerometer should correct roll and pitch only when gravity dominates the measurement.
- Gyroscope integration should be trusted only when bias, saturation, timestamp, and axis calibration are under control.
- Quaternions avoid Euler singularities and support full 3D attitude composition.
Major section
Validity Gates Beat Formula (continued)
Attitude gradually walks away during stationary tests.
- The output should expose those checks instead of publishing a single attitude value with no evidence.
- Madgwick-style filters use a correction gain, often called beta, to pull the quaternion estimate toward accelerometer and magnetometer references.
- Heading changes while roll and pitch remain stable.
Major section
Validity Gates Beat Formula (continued)
The same evidence rule still applies: magnetometers can be corrupted by nearby metal or electronics, and a 9-DOF heading should be labeled degraded when magnetic calibration or field consistency fails.
- Gravity Gate Check whether acceleration magnitude and stability are compatible with gravity before applying strong correction.
- Axis Convention Record coordinate frame, sign convention, sensor mounting, and unit conversion so roll, pitch, and yaw are reviewable.
- 6-DOF IMU has no absolute yaw reference.
Deck summary
Key takeaways
The complementary filter uses a fixed blend.
- If accelerometer variance $R$ rises during vibration, the residual variance grows and the gain normally gives that angle less influence.
- The formula is simple, but production IMU fusion is mostly about knowing when the assumptions are valid.
- Attitude gradually walks away during stationary tests.
- The same evidence rule still applies: magnetometers can be corrupted by nearby metal or electronics, and a 9-DOF heading should be labeled degraded when magnetic calibration or field consistency fails.
Retrieval practice
Recall check

Data Dora says: answer from memory, then check your reasoning.
Q1Why should a 6-DOF accelerometer-plus-gyroscope filter label yaw as unobservable or drifting?
Show answer
Answer: D 6-DOF IMUs can use gravity for roll and pitch but need another reference for absolute yaw.
Print reference
Answers
Answer key.
- D · 6-DOF IMUs can use gravity for roll and pitch but need another reference for absolute yaw.