paparazzi/paparazzi — Issue #144: doxygen docs for math lib
Author: flixr
Created: 2012-03-01 20:12:27+00:00
State: open

Just taken from my mailing list:

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.**