paparazzi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Paparazzi-devel] Paparazzi Convention for Euler Angles


From: Avinash Rao
Subject: Re: [Paparazzi-devel] Paparazzi Convention for Euler Angles
Date: Thu, 16 Feb 2012 09:42:19 +1300

Hi Christophe,

Thanks for taking the time to go through all that - much appreciated. Since you've confirmed the convention for the order of rotations as being ZYX / psi-theta-phi , it would seem that the documentation in the doc/pprz_algebra/headfile.pdf may be incorrect (or I may still be!). Given the order you mentioned, I would have thought that the rotation matrix would be obtained as follows:

R_EarthToBody = R(phi)*R(theta)*R(psi)    i.e. the the constituent rotation matrices are in reverse order to the actual order of rotations so that the vector to be rotated is rotated in the correct order.

This would mean that to go from body to earth, the rotation matrix would be obtained:

R_BodyToEarth = R(-psi)*R(-theta)*R(-phi)

This would seem to agree with the formulae in the code for calculating Euler angles from accelerometers and magnetometer.

However, in the document headfile.pdf, it states that the order is:

R_EarthToBody = R(psi)*R(theta)*R(phi) 

which would correspond to the order  convention XYZ/phi-theta-psi, or  the reverse of the stated convention.

Does this make sense or have I missed something? 

Thanks again for your help.

Regards,

Avinash.

On Wed, Feb 15, 2012 at 9:53 PM, Christophe De Wagter <address@hidden> wrote:
Euler angles are slightly more complex than they appear to many people. The rotation from Earth to Body is done by:

First rotate the Earth North-East-Down coordinates with PSI (positive = right hand along the z-axis pointing down = positive to the east). e.g. PSI=90deg -> new set of axes become East-South-Down
Then, starting from your newly PSI-rotated coordinate system, rotate an angle THETA along the new y-Axis. e.g.: theta=45deg = nose up. You now already have the final body-X axis.
From this PSI-THETA-rotated new set of axes finally apply the PHI or Roll by turning (with right-hand rule) around the already found body-x-axis (which in our sample is then pointing east and 45 degrees up)

To go back from Body to Earth, it's the complete opposite: sign as well as order.

First un-roll around the body X using  -PHI  (minus PHI).
From this un-rolled set of axes un=pitch with MINUS THETA arround the unroll-ed Y-axis. 
And finally un-PSI your un-rolled and un-pitched set of axes around the z and you should be North-East-Down in Inertial, Local-Tangent-Plane or Earth coordinates (3 names that are not exactly the same but are often simplified as being the same)

Because of this funny definition, euler angles are only intuitive at small pitch angles, but once the pitch angle becomes large very non-intuitive things happen. For instance: phi,theta,psi = 0,90,0 is the same attitude as 90,90,90 and there are only 2 degrees of difference between A) 0,89,0 and b) -180,89,180 and c) -90,89,-90 and d) 90,89,90 even if both phi and psi have differences of 180 degrees. This is the case with the nose pointing almost 90 degree vertical with the wings aligned east-west but the nose respectively rotated 1 degree a) north b) south c) west d) east. No need to explain how difficult it is to integrate gyro's in this case: e.g. from a) to b) the Y-gyro will feel 2 degrees and X and Z gyro zero degrees, while the euler angles change 180 in the axes where the gyro feels zero and does not change in theta, the only axis where the gyro was feeling something...

Hope this helps in getting some feeling for euler angles. (and switch to quaternions or rotation matrix a.s.a.p. ;-)   )

-Christophe 




On Wed, Feb 15, 2012 at 3:26 AM, Avinash Rao <address@hidden> wrote:
Hi Poine,

Thanks for your reply. I had been reading through that document already but I wasn't sure exactly what was meant by the change of reference co-ordinates.

For examle,does phi in the code denote the angle from body to earth, or is phi in the code from earth to body (so we need to take the negative of it to go from body back to earth)?

Avinash.


On Wed, Feb 15, 2012 at 1:53 PM, antoine drouin <address@hidden> wrote:
look in doc/pprz_algebra/headfile.pdf

On Wed, Feb 15, 2012 at 1:48 AM, Avinash Rao <address@hidden> wrote:
> Hi all,
>
> I'm trying to understand the convention used for calculating Euler angles in
> paparazzi and how they relate to the drift correction in the AHRS.
>
> From looking through the code for determining Euler angles from gravity and
> magnetometer, it would seem that the conventions is such that:
>
> x_earth = R(psi)*R(theta)*R(phi)*x_body
>
> i.e. the rotation R(psi)*R(theta)*R(phi) will transform a vector x measured
> in the body frame (e.g the gravity vector) back into the earth frame.
>
> Is this correct or have I made a mistake somewhere?
>
> Thanks very much for your help in advance.
>
> Avinash.
>
> --
> Avinash Rao
>
>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]