# [ODE] Rotation matrix and Euler Angles - Easy

Jon Watte (ODE) hplus-ode at mindcontrol.org
Wed Jul 5 01:37:52 MST 2006

```I believe ODE uses XYZ Euler.

RollPitchYaw has two meanings: either ZYX Euler order, or Tait-Bryan
order (where the latter rotates within the new coordinate frame for each
component). I believe the code posted attempts to do ZYX Euler.

There exists ODE code to convert between Euler and Quaternion and back,
so I suggest just using those (which means going through Quaternion,
rather than matrix, for this case).

Cheers,

/ h+

Holger Urbanek wrote:
> Well I did a quick check, and without looking at the math I found two
> critics:
> 1) The sign is wrong. It alway gets the negated result.
> 2) If you are only trning around one axis, ODE-conversion to and back
> agin with yours gets it right (well, except the sign; see 1). But if
> you turn around multiple axis, results differ significantly.
>
> And another question from me the the ODE-Experts here:
> RPY (roll pitch yaw) and Euler are somehow different. And there exist
> many (12 to be exact) Euler representations. What is ODE using when
> stating 'euler'?
>
> On 7/5/06, *Alex Green* <alexg at acfr.usyd.edu.au
> <mailto:alexg at acfr.usyd.edu.au>> wrote:
>
>     G'day, I used the following code, hope it helps!
>     -alex
>
>     //! Find Roll Pitch and Yaw
>     // rotation Matrix then convert to Euler Angles
>     dReal *R = (dReal *) dBodyGetRotation(body->bodyID);
>     roll  = atan2(R[9], R[10]);     //phi
>     pitch = asin(-R[8]);            //theta
>     yaw   = atan2(R[4], R[0]);      //greek Y
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>

```