Using the detected drift error, filtering works in the same way as described in Section 9.1. The complementary filter (9.10) is upgraded to work with quaternions. It becomes slightly more complicated to represent the interpolation in terms of . Let denote the axis-angle representation of the orientation , which is the estimated drift error (a quaternion value). Let represent the quaternion given by axis and angle . For a small value of , this can be considered as a small step ``toward'' .

The complementary filter in terms of quaternions becomes

which is similar in form to (9.12). The simple subtraction from the 2D case has been replaced above by multiplying an inverse quaternion from the left. The estimated drift error is obtained by multiplying the estimated tilt and yaw errors. Alternatively, they could contribute separately to the complementary filter, with different gains for each, and even combined with drift error estimates from more sources [199].

Steven M LaValle 2020-01-06