← Back to the chapter · Previous detail · Next detail →
Technical detail · Complementary Filters: Tuning and Validity
Rotate calibrated magnetic evidence into yaw
Roll and pitch provide the missing geometry for magnetometer heading. First calibrate hard-iron offset and soft-iron scale, then rotate the body-frame magnetic vector onto the horizontal plane. For one common right-handed roll-, pitch- convention,
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. Tilt compensation removes the geometric projection error; it does not remove magnetic distortion, gyro drift during magnetic rejection, or the need to apply local magnetic declination when the product requires true rather than magnetic north.