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.

datafusioncomplementary
Data Dora, the module guide, in a scene from this chapter.
iotclass.org

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.
iotclass.org

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.
A calibrated gyro and accelerometer feed explicit Kalman prediction and correction blocks, while a magnetometer is rotated to the horizontal plane for yaw.
A calibrated gyro and accelerometer feed explicit Kalman prediction and correction blocks, while a magnetometer is rotated to the horizontal plane for yaw.
iotclass.org

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.
iotclass.org

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.
Twelve seconds on a delivery robot: vibration and braking both push the accelerometer outside its gate, and the derived angle turns confidently wrong.
Twelve seconds on a delivery robot: vibration and braking both push the accelerometer outside its gate, and the derived angle turns confidently wrong.
iotclass.org

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.
iotclass.org

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.
iotclass.org

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.
iotclass.org

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?

AThe accelerometer directly measures magnetic north and can reset yaw after each update.
BThe gyro automatically removes heading bias whenever its angular rate is integrated.
CYaw is always better constrained than roll and pitch in a six-degree inertial unit.
DGravity can correct roll and pitch, but it does not provide an absolute yaw heading reference.
Show answer

Answer: D 6-DOF IMUs can use gravity for roll and pitch but need another reference for absolute yaw.

iotclass.org

Print reference

Answers

Answer key.

  1. D · 6-DOF IMUs can use gravity for roll and pitch but need another reference for absolute yaw.
iotclass.org