Acceleration compensation: flight testing


I have recently performed flight tests on a major change in the way acceleration is accounted for in performing roll-pitch drift compensation from accelerometer measurements. The theory behind the idea was recently published in a discussion on this website. Since then, I have made a couple of refinements to the idea, the latest version is documented here.

Implementation in MatrixPilot is shown here. There is one slight "tweak" in the implementation that is not covered in the theory paper: although in principle the new method can provide yaw drift information, in the implementation I have used it for roll and pitch only.

I put off posting a blog entry until I had flight test data, which I now have. The above picture is from one of several recent test flights with a UAVDevBoard running MatrixPilot on an EasyStar, that shows that the idea works. What is shown is a comparison of the GPS track and the "dead-reckoning" computation. The yellow arrows indicate the wind direction and the plane icons indicate the attitude of the plane. The fact that the two tracks match rather closely is an indication that the estimated attitude matches the actual attitude, otherwise there would be a large discrepancy.

A major advantage of the new method is that it does not require a model for computing aerodynamic forces, nor does it make any of the approximations that previous methods do. It is based on kinematics only, and does not make any approximations. Therefore, it will provide accurate acceleration compensation for any platform, including quads, cars, motorcycles, baseballs, anything you want to attach an IMU to. (For anything but fixed wing, it does require a magnetometer.)

Now, some more pictures.

The next picture is taken from a portion of the flight in which the EasyStar flew in a tight circle for several minutes. Both GPS and dead-reckoning tracks are plotted. Two out of many revolutions are shown. It is during circling flight that it is particularly critical that acceleration be correctly accounted for. As can be seen, GPS and dead-reckoning match, indicating that attitude estimate is correct.

The final picture is the track of the entire 20 minutes of one of the test flights, in which I did my best to "break" the algorithm.

Best regards,


Views: 6046

Comment by Adam Rivera on May 1, 2012 at 10:12am

Nice work Bill! Pure genius.

Comment by Nick Arsov on May 1, 2012 at 10:42am

Great work Bill, really great !

Comment by Gary Mortimer on May 1, 2012 at 10:58am


Comment by Pete Hollands on May 1, 2012 at 2:01pm

I flew Bill's test branch this evening, and it seemed to fly well and smoothly. It looked fine in the post flight analysis.

I'm sure it will take a lot more testing before we are completely sure about the new algorithm.

Thanks Bil for publishing the concept and the code.

Comment by Rob_Lefebvre on May 1, 2012 at 2:17pm

Looks good.

I guess it's basically impossible to determine if the new algorithm is essentially "perfect", since the GPS itself has a lot of error.

I suppose one test would be to take off, fly around, land, and then return the aircraft to the exact spot it started. Then see how far off the algorithm is.

Comment by William Premerlani on May 1, 2012 at 2:34pm


Just to be clear, the new algorithm is for accounting for acceleration in roll-pitch gyro drift compensation, in a way that does not require any assumptions or approximations. So, it is perfectly suited for quads. Andrew Tridgell has done simulations that show it will improve loitering performance for quads. It remains for someone to implement and test the new algorithm in quad estimation and control.

The new algorithm cannot compensate location estimation for GPS drift, that is not its purpose. It simply prevents acceleration from inducing roll-pitch attitude errors. Because the algorithm uses changes in GPS reported velocity, it is not itself sensitive to GPS drift.

One measure that I use to estimate the accuracy of roll-pitch attitude estimation is whether or not the GPS track matches the "dead-reckoning", IMU track. Any roll-pitch attitude estimation error will make the two tracks diverge, because it will generate an error in the dead-reckoning computations.

Best regards,


Comment by Andrew Tridgell on May 1, 2012 at 3:06pm

Great work Bill!

I'll have another go at this algorithm in APM soon. It would be a major step forward for multi-copters if this works as well as it should!

Cheers, Tridge

Comment by William Premerlani on May 1, 2012 at 3:13pm

Hi Tridge,

Thanks. I am optimistic that you will get this algorithm working in APM.

Best regards,


Comment by Ryan Beall on May 2, 2012 at 3:36pm

Just a quick verification:  This is a fixed gain filter that feeds the GPS velocity/position estimation error into the accelerometers.  There fore the end result is more accurate attitude.  Or is the error pushed into the attitude directly?  

Comment by William Premerlani on May 2, 2012 at 4:11pm

Hi Ryan,

Its really great to hear from you!! What have you been up to?..

Now, in response to your question...

The end result is more accurate attitude during accelerated motion.

This is an exact method for compensating for acceleration in using an accelerometer to provide a roll-pitch reference vector. It is not a filter. Unlike previous methods for compensating for acceleration, it makes no assumptions about the dynamic model of the object being tracked, so it will work for anything that you might want to attach an IMU onto, including rockets, helis, quads, baseballs, boats, motorcycles, etc. It is based on kinematics only. It should work especially well for quads and helis.

Previous methods for providing a roll-pitch reference vector used gravity as the reference vector. They started with the accelerometer vector, which is equal to gravity minus acceleration, and added an estimated acceleration vector. The estimation of the acceleration vector was usually done based on a centrifugal calculation, which really only works for fixed wing, and then was only an approximation.

This new method uses gravity minus acceleration as the roll-pitch reference vector, so it does not require any adjustment to the accelerometer signal at all. All that it needs is a computation of the exact gravity minus acceleration vector in the earth frame of reference, which can be done very simply from the GPS velocity. As a bonus, the method naturally works with integrals and changes in GPS velocity, so the accuracy improves.

I am not sure why I did not think of this method before, it really blows the doors off the previous methods for dealing with acceleration. I think the reason is that the initial discussions on this forum focused on doing computations in the body frame. I do not think that anyone, including myself, thought that the computations could be done in the earth frame instead. And basing the computations on centrifugal effects was intuitively appealing...and flawed.

Best regards,



You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2015   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service