• ## On integration drift

While implementing a sensor fusion algorithm I stumbled across the problem that my well-calibrated gyroscope would yield slowly drifting readings for the integrated angles.
There are at least two reasons for this behaviour: It is possible that the gyro bias was not removed exactly – not so much because it’s a stochastic quantity, but more because it’s a machine precision problem after all – and drift induced during numeric integration due to rounding errors.

Fourier states that every (infinite and periodic) signal can be assembled by using only cosine and sine functions. Gaussian noise has a mean amplitude in all frequencies, but still a gaussian amplitude distribution. In other words: Gaussian noise contains differently strong sine and cosine signals for every frequency.

Now the integral of the sine and cosine functions is defined as follows:

\begin{align} \int cos(2 \pi f t) &= \quad \frac{1}{2 \pi f} sin(2 \pi f t) \\ \int sin(2 \pi f t) &= -\frac{1}{2 \pi f} cos(2 \pi f t) \end{align}

What that means is that for every high frequency sine-like signal (i.e. $f \geq 1 \mathrm{Hz}$) , the amplitude of that signal will be lowered by factor $2 \pi f$. For every low frequency signal (i.e. $f \lt 1 \mathrm{Hz}$) the frequency will be amplified by $2 \pi f$.

Now it’s just a question if your signal contains gaussian noise or if your system oscillates. In any way, if there is a low frequency component, integration will turn it into a strong, slow sine wave shape – drift.