Hi Guys

I am trying to get my head around theory in terms of design a complementary filter for a UAV. This is only very basic stuff to begin with. Could someone tell me whether my below statements are correct and if not offer any help?

My setup is a 3axis gyro and accelerometer. I believe I need to convert these values from the local domain to the global domain, i.e. with respect to the ground? and not just the aircraft itself?

This is done by putting the gyro output through a euler matrix? (same as a rotation matrix?) and then integrating the gyro output to give a euler angle for roll, pitch and yaw.

the accelerometer outputs need to be applied to a direction cosine matrix in order to get the euler angles? however yaw cannot be computed from an accelerometer and therefore we can neglect here?

we then "fuse" the data from both to give a more accurate reading? this sensor fusion process is something im yet to look into

hope someone can help me with my confusion


Views: 3452

Reply to This

Replies to This Discussion

That's heading in the right direction. We all use the DCM here for sensor fusion, and you can read this for a primer. Also, there is a lot more here.

Out of curiosity, why are you writing this from scratch? ArduIMU and the UAVDevboard already have this implemented.
Hi Chris

Thanks for your quick response, so I am definitely right in saying that a euler matrix (as my friend referred to it) is the same as a rotation matrix? I ask this, because i cant find any reference on google to a euler matrix, only a rotation matrix.

and is my definition of local and global angles is correct? is the example i give below correct in this context?

A plane pitches upwards by 90°, it then yaws to the left by 90° followed finally by a roll to the right 90°. The plane ends up in a position that indicates it has only yawed left 90° with respect to the initial position rather than the three manoeuvres it actually perform. The local angles are each individual movement, but what we actually want is a global vector that tells us all three movements as a single 3x1 vector?

I am not going to write any code from scratch, I just really want to understand the theory behind it before I use other peoples code.

Hi Tom,

You should disassociate rotation and Euler angles. Euler angles are state parameters more commonly known as pitch roll and yaw whereas rotation is the state transition that describes how the state (euler angles) change ( how the plane rotates).This is measured by the gyros in the plane referential.
Now, the DCM is one way of representing the attitude of the plane just like Euler angles. It actually contains the exact same information as the Euler angles it just as more parameters 9 instead of 3, the reason for that would be to long to explain but once you get familiar with the basic concept you will understand.
More generally, there are two easy ways of working round the problem of attitude determinations complementary filter and kalman filter.
Compementary filtering is actually the easiest out of the two. First, time is split in small timesteps (ex 20ms) during which rotation speed is supposed to be constant. You can look at it as small rotations. Then, by applying these small rotations every time to the Euler angles, DCM quaternions (or whatever attitude parameterization you are using) you will obtain A new attitude.
In a perfect world (no gyro noise, timestep infinetly small) you would not need accelerometers. But because there are errors especially noise in the gyros, if you are not using the accelerometer your estimation of attitude will drift to the point where it is not working. You then need accelerometers to correct for that drift. The accelerometers sort of see the vertical which is almost equivalent to seeing the atttitude. Eventually to "fuse" the gyro and the accelerometers you just compare the attitude that is extrapolated from the attitude at the previous time step and the small rotation (gyros) and you correct it proportionally with the attitude that the accelerometers see.
This is a very basic concept explanation, for the rest, I suggest you look at Chris' links...

Good luck !

Euler rotations are done around the three axes: pitch, roll, and yaw. A rotation about one axis can be written in matrix form using a three-by-three matrix. The rotation matrixes can be multiplied together to form a single rotation matrix. The typical convension is to perform the yaw (z-axis) rotation, followed by the pitch (y-axis), then the roll (x-axis). The resulting matrix is usually called the direction cosine matrix (DCM). It performs the transformation of a three-dimentional vector from the locally-level reference frame to the body frame. (Fun fact: you can take the transpose of the matrix to get the body-to-locally-level transformation matrix.)
There is an AHRS sensor-fusing algorithm created by Premerlani and Bizard also called DCM, and that is what most people on this site refer to as "DCM".


So if I understand correctly, the "DCM" as per Premerlani & Bizard does not stand for "Direction Cosine Matrix" .  ??


Reply to Discussion


© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service