#### Drift correction

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:

 (9.10)

in which is a gain parameter that must satisfy . Above, denotes the corrected estimate at stage . Since the gyroscope is usually accurate over short times but gradually drifts, is chosen to be close to zero (for example, ). This causes the instantaneous estimate to have a gradual impact. At the other extreme, if were close to , then the estimated orientation could wildly fluctuate due to errors in in each stage. An additional consideration is that if the sensor output arrives at a much lower rate than the gyroscope sampling rate, then the most recently recorded output is used. For example, a camera image might produce an orientation estimate at Hz, whereas the gyroscope produces outputs at Hz. In this case, would retain the same value for 16 or 17 stages, until a new camera image becomes available.

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,140,158]; 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 [119].

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

 (9.11)

in which

 (9.12)

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 2016-12-31