HiI notice that attitude estimation is done using the DCM algorithm.I was wondering if anyone, has tried implementing a Kalman filter for attitude estimation?The DCM update has a nice intutive feel to it, but i would like to throw in a sound math proof for why it converges. Has anyone worked on this so far?RegdsSrinath

That makes a lot of sense. So the part where we decide "how much" of the accelerometer we want and how much of the gyro reading we want is also decided by the PI gain values?

Essentially, the integrated gyro measurements provide the "high frequency" content of the pitch & roll estimates, while an acceleromter-based gravity vector estimate provides the "low frequency" content. The proportional and integral gains in the PI controller dictate the crossover frequency and damping. Hence, the two sensors "complement" each others strengths and are combined in a complimentary filter. (Note that the gravity vector estimate involves a centripetal correction to the raw accelerometer measurements.)

If it helps, I wrote a paper on UAV fundamentals that covers the "DCM" complimentary filter along with general Kalman Filter implementations. See the DIY Drones post:

you are correct, yesterday evening i produced two flips and as a result the offset of the pitch 'moved'.

in the menu "other autopilots" you find the gluon pilot entry. the author compares dcm with ekf and makes it clear.

if you look into the code, then you find the method drift_correction. this is just a 2d correction. and produces drift on the pitch when doing acrobatics of flying through a turbolent zone.

i am preparing a kalman filter as drop in approach for the pirate code base. but it is somewhat harder as i initially thought :-/

Going over the Lyapunov proofs, the "DCM" method seems to be on a solid footing compared to the EKF. I just wish we didn't have to make the assumption, that the velocity derivative terms are negligible.

This assumption, seems pretty restrictive. How would a uav doing acrobatics determine it's attitude.

The velocity derivatives are definitely not negligible in such a case.

The Mahony paper mentioned by Roy Brewer is thorough and technical, to say the least. Appendix A in that paper does provides a very good scalar description of the filter, though.

Basically, the "DCM" method is actually a complementary filter forming an attitude estimate by combining the gyro angular rates (which have a low-frequency bias but are pretty good at high frequencies) with low-frequency attitude references (e.g. magnetic heading and an IMU-based gravity vector estimate). So, the high frequency components of the integrated gyro measurements are passed, along with the low-frequency attitudes derived from the references; the low frequency gyro biases are rejected.

Using a PI controller, the integral gain, Ki, determines the filter crossover frequency (sqrt(Ki) rad/s), and the proportional gain, Kp, trades the damping and high-frequency noise suppression. (I believe Euston and Mahony incorrectly stated that Kp determines the crossover frequency. It does for a pure proportional controller, but not for a PI controller.)

I know it has been stated in other threads, but it is worth mentioning here: the "DCM" IMU algorithm is named such to distinguish it from the quaternion derivation described in the Mahony and Euston papers. You can effectively formulate the same complementary filter using DCMs (Direction Cosine Matrices), quaternions, or even euler angles. (An euler angle implementation would suffer as pitch approaches 90º, however.)

I have some simulations where an EKF works great in sensor fusion of GPS,accel,gyro.
But i haven't tested it on a full thing.
I like the DCM method for its simplicity, but would like to see a more concrete proof.

We will be using simple Kalman filtering for sensor fusion (GPS, accelerometer, gyro) and GPS noise rejection. Kalman filtering works great in noise rejection from single sensor sources in simulations, but we have yet to find out how well it works for sensor fusion given the processing power that we have (72MHz Cortex-M3 microcontroller, no hardware FPU!).

## Comments

Your paper looks very interesting. I will give it a thorough read and see if I can wrap my head around some of the underlying concepts. Thanks!

Thanks for the reply Jeff!

That makes a lot of sense. So the part where we decide "how much" of the accelerometer we want and how much of the gyro reading we want is also decided by the PI gain values?

@Ajit

Essentially, the integrated gyro measurements provide the "high frequency" content of the pitch & roll estimates, while an acceleromter-based gravity vector estimate provides the "low frequency" content. The proportional and integral gains in the PI controller dictate the crossover frequency and damping. Hence, the two sensors "complement" each others strengths and are combined in a complimentary filter. (Note that the gravity vector estimate involves a centripetal correction to the raw accelerometer measurements.)

If it helps, I wrote a paper on UAV fundamentals that covers the "DCM" complimentary filter along with general Kalman Filter implementations. See the DIY Drones post:

http://diydrones.com/profiles/blogs/fundamentals-of-small-unmanned-...

How does DCM do a basic complementary filter? I am not able to understand which block of the DCM does this. Could someone throw light on this?

@srinath

you are correct, yesterday evening i produced two flips and as a result the offset of the pitch 'moved'.

in the menu "other autopilots" you find the gluon pilot entry. the author compares dcm with ekf and makes it clear.

if you look into the code, then you find the method drift_correction. this is just a 2d correction. and produces drift on the pitch when doing acrobatics of flying through a turbolent zone.

i am preparing a kalman filter as drop in approach for the pirate code base. but it is somewhat harder as i initially thought :-/

Thanks for the papers Jeff.

Going over the Lyapunov proofs, the "DCM" method seems to be on a solid footing compared to the EKF. I just wish we didn't have to make the assumption, that the velocity derivative terms are negligible.

This assumption, seems pretty restrictive. How would a uav doing acrobatics determine it's attitude.

The velocity derivatives are definitely not negligible in such a case.

The Mahony paper mentioned by Roy Brewer is thorough and technical, to say the least. Appendix A in that paper does provides a very good scalar description of the filter, though.

In addition to the Premerlani DCM IMU write up (http://gentlenav.googlecode.com/files/DCMDraft2.pdf), a pretty readable paper on the subject is "A Complementary Filter for Attitude Estimation of a Fixed-Wing UAV" by Euston, Coote, Mahony, et. al. (The paper can be found in a zipped compilation, courtesy of GentleNav: http://gentlenav.googlecode.com/files/MahonyPapers.zip.)

Basically, the "DCM" method is actually a complementary filter forming an attitude estimate by combining the gyro angular rates (which have a low-frequency bias but are pretty good at high frequencies) with low-frequency attitude references (e.g. magnetic heading and an IMU-based gravity vector estimate). So, the high frequency components of the integrated gyro measurements are passed, along with the low-frequency attitudes derived from the references; the low frequency gyro biases are rejected.

Using a PI controller, the integral gain, Ki, determines the filter crossover frequency (sqrt(Ki) rad/s), and the proportional gain, Kp, trades the damping and high-frequency noise suppression. (I believe Euston and Mahony incorrectly stated that Kp determines the crossover frequency. It does for a pure proportional controller, but not for a PI controller.)

I know it has been stated in other threads, but it is worth mentioning here: the "DCM" IMU algorithm is named such to distinguish it from the quaternion derivation described in the Mahony and Euston papers. You can effectively formulate the same complementary filter using DCMs (Direction Cosine Matrices), quaternions, or even euler angles. (An euler angle implementation would suffer as pitch approaches 90º, however.)

Here you go:

http://hal.archives-ouvertes.fr/docs/00/48/83/76/PDF/2007_Mahony.et...

BTW, EKFs are known not to necessarily converge.

- Roy

I have some simulations where an EKF works great in sensor fusion of GPS,accel,gyro.

But i haven't tested it on a full thing.

I like the DCM method for its simplicity, but would like to see a more concrete proof.

We will be using simple Kalman filtering for sensor fusion (GPS, accelerometer, gyro) and GPS noise rejection. Kalman filtering works great in noise rejection from single sensor sources in simulations, but we have yet to find out how well it works for sensor fusion given the processing power that we have (72MHz Cortex-M3 microcontroller, no hardware FPU!).

I can't tell you how it compares with DCM.