To make a useful tracking system, the drift error (9.3) cannot be allowed to accumulate. Even if the gyroscope were perfectly calibrated, drift error would nevertheless grow due to other factors such as quantized output values, sampling rate limitations, and unmodeled noise. The first problem is to estimate the drift error, which is usually accomplished with an additional sensor. Practical examples of this will be given in Section 9.2. For the simple merry-go-round example, imagine that an overhead camera takes a picture once in a while to measure the orientation. Let denote the estimated orientation from this single sensor measurement, arriving at stage .

Because of drift error, there are now two conflicting sources of information: 1) The orientation
estimated by integrating the gyroscope, and 2) the orientation
instantaneously estimated by the camera (or some other, independent sensor). A classic approach to blending these two sources is a *complementary filter*, which mathematically interpolates between the two estimates:

in which is a

It is important to select the gain to be high enough so that the drift is corrected, but low enough so that the user does not perceive the corrections. The gain could be selected ``optimally'' by employing a Kalman filter [45,142,160]; however, the optimality only holds if we have a linear stochastic system, which is not the case in human body tracking. The relationship between Kalman and complementary filters, for the exact models used in this chapter, appears in [120].

Using simple algebra, the complementary filter formulation in (9.10) can be reworked to yield the following equivalent expression:

in which

Above, is just an estimate of the drift error at stage . Thus, the complementary filter can alternatively be imagined as applying the negated, signed error, by a small, proportional amount , to try to incrementally force it to zero.

Steven M LaValle 2020-01-06