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: Felix Ruess
Subject: Re: [Paparazzi-devel] Paparazzi Convention for Euler Angles
Date: Thu, 16 Feb 2012 14:54:28 +0100

Hi,

I'm certainly no mathematician, but:

When talking about Euler Angles in Aerospace, one usually means Tait-Bryan Angles with rotations about 3 different axes (as opposed to "proper" Euler Angles, where you repeat one axis).
This "usual aerospace convention" (often also called Yaw-Pitch-Roll) is the  ZY'X'' convention (intrinsic rotations) and is also standardized in DIN 9300 (ISO 1151-2).

So to rotate from "earth" (actually local NorthEastDown) frame to body frame: R_Earth2Body = R(phi)*R(theta)*R(psi) 
* first rotate around the Z-axis by yaw angle psi [-180deg < psi < 180deg]
* rotate around the new Y' axis by pitch angle theta [-90deg < theta < 90deg]
* finally rotate around the new X'' axis by roll angle phi [-180deg < phi < 180deg]

This is exactly the same as reversing the order of the rotation and using fixed axes (extrinsic rotations): XYZ (fixed axes) = ZY'X'' (moving body axes)
* first rotate around fixed X axis (pointing north) by roll angle phi
* rotate around fixed Y axis (pointing east) by pitch angle theta
* rotate around fixed Z axis (pointing down) by yaw angle psi

Regarding the reverse, going from body to ned axes: R_body2ned = inverse(R_ned2body) = transpose(R_ned2body)
* R_n2b = R(phi)*R(theta)*R(psi)
* R_b2n = transpose(R_n2b) = transpose(R(phi)*R(theta)*R(psi)) = R_t(psi)*R_t(theta)*R_t(phi)
* with R_t(psi) = inverse(R(psi)) = R(-psi)
* R_b2n = R(-psi)*R(-theta)*R(-phi)

It seems this is wrong in doc/pprz_algebra/headfile.pdf (generated from introduction.tex).
So if someone wants to correct this in the latex source files and clean it up a little, it would be nice :-)

I also think we should probably document most of these macros/functions directly in the code (sw/airborne/math/pprz_foo.h), using doxygen comments with latex formulas embedded. Then it will be nicely rendered in the online documentation.

Any help here is very welcome! It's not hard, just has to be done and would help a lot!!
I currently don't have the time to do this myself... spending too much time on Paparazzi already ;-)

Cheers, Felix

On Thu, Feb 16, 2012 at 9:58 AM, Christophe De Wagter <address@hidden> wrote:
Note, that several notational conventions for the angles are in common use. Goldstein (1980, pp. 145-148) and Landau and Lifschitz (1976) use (phi,theta,psi), Tuma (1974) says (psi,theta,phi) is used in aeronautical engineering in the analysis of space vehicles (but claims that (phi,theta,psi) is used in the analysis of gyroscopic motion), while Bate et al. (1971) use (Omega,i,omega). Goldstein remarks that continental authors usually use (psi,theta,phi), and warns that left-handed coordinate systems are also in occasional use (Osgood 1937, Margenau and Murphy 1956-64). Varshalovich (1988, pp. 21-23) uses the notation (alpha,beta,gamma) or (alpha^',beta^',gamma^') to denote the Euler angles, and gives three different angle conventions, none of which corresponds to the x-convention.

At the TUDelft we always use R_EarthToBody = R(phi)*R(theta)*R(psi)    [which should mean first rotate around psi, then theta, then phi, so the opposite of the order you read them.]

And the inverse (or simply transpose in the case of orthogonal unity matrices), to go back from BodyToEarth. It would take me some deep dive into Linear Algebra again to find out if

transpose(R(phi)*R(theta)*R(psi)) = R(-psi)*R(-theta)*R(-phi)
or
transpose(R(phi)*R(theta)*R(psi)) = R(psi)*R(theta)*R(phi)

I would guess the first, and guess that the docs did consider the reversed order but forgot the signs. Any mathematician around?

-Christophe 



On Wed, Feb 15, 2012 at 9:42 PM, Avinash Rao <address@hidden> wrote:
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
>
>

_______________________________________________
Paparazzi-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel



_______________________________________________
Paparazzi-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/paparazzi-devel



reply via email to

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