• ## On integration drift

While imple­ment­ing a sen­sor fusion algo­rithm I stum­bled across the prob­lem that my well-cal­i­brat­ed gyro­scope would yield slow­ly drift­ing read­ings for the inte­grat­ed angles.
There are at least two rea­sons for this behav­iour: It is pos­si­ble that the gyro bias was not removed exact­ly — not so much because it’s a sto­chas­tic quan­ti­ty, but more because it’s a machine pre­ci­sion prob­lem after all — and drift induced dur­ing numer­ic inte­gra­tion due to round­ing errors.

Fouri­er states that every (infi­nite and peri­od­ic) sig­nal can be assem­bled by using only cosine and sine func­tions. Gauss­ian noise has a mean ampli­tude in all fre­quen­cies, but still a gauss­ian ampli­tude dis­tri­b­u­tion. In oth­er words: Gauss­ian noise con­tains dif­fer­ent­ly strong sine and cosine sig­nals for every fre­quen­cy.

Now the inte­gral of the sine and cosine func­tions is defined as fol­lows:

\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 fre­quen­cy sine-like sig­nal (i.e. $f \geq 1 \mathrm{Hz}$ ) , the ampli­tude of that sig­nal will be low­ered by fac­tor $2 \pi f$ . For every low fre­quen­cy sig­nal (i.e. $f \lt 1 \mathrm{Hz}$ ) the fre­quen­cy will be ampli­fied by $2 \pi f$ .

Now it’s just a ques­tion if your sig­nal con­tains gauss­ian noise or if your sys­tem oscil­lates. In any way, if there is a low fre­quen­cy com­po­nent, inte­gra­tion will turn it into a strong, slow sine wave shape — drift.