comment on complementary filtering

3689648626?profile=original

Complementary filters enable sensor fusion, are easy to implement and eliminate integrating errors from gyro’s or accelerometers. Normally complementary filters are discussed in the frequency domain.  Using simple Python code a 1st order linear complementary filter for determining the quadcopter ground speed was analyzed in the time domain. The results are depicted in the figure shown above.  voff represents the filter output of the accelerometer offset,  acc(n) the filter output  of the accelerometer, vgps(n) the output  of the GPS velocity, vgps,  and v(n) the sensor fusion output of the filter.

It follows from the figure above that the integrating drift of the accelerometer is converted into a constant steady state error.  Moreover this error can be eliminated by deriving the filter output at the start of the quadcopter with GPS input zero, and subtracting this value from the complementary filter output during flight mode. It also follows that the output v(n)  (steady state error corrected) corresponds nicely with the GPS velocity (noise added at simulation) and equals the algebraic sum of the more slowly varying acc(n) and vgps(n) contribution. Output noise is suppressed due to the low pass filtering of vgps.

Although these results confirm the already known features of complementary filtering, it helped me a lot in a better understanding of the basic mechanisms of complementary filtering, especially how a delayed, filtered signal vgps(n) nevertheless results in a correct complementary filter response.

The simulated results are confirmed by actual recorded data from my quadcopter, see figure below. For more details consult my google site.

3689648647?profile=original

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • I want to see your clip.

  • If k->1 the accelerometer becomes more dominant, the rise time decreases (faster system) but the steady state error due to the accelerometer offset increases. Offset drifts over time and is temperature dependent. As a compromise I limited k to 0.9 or a cutoff of 0.5Hz. My GPS operates at 5Hz.
This reply was deleted.