# [ODE] Rotation matrix and Euler Angles - Easy

Hampus hampus at sxp.se
Wed Jul 12 01:18:47 MST 2006

```Hi,

I can't find the Quaterion to euler conversion (dQtoEuler?) function
in ODE that you speak of. What is it called?

Just to be sure. It is possible and safe to do something like this:

dRFromEulerAngles(R, x, y, z);
dRtoQ(R, Q);
dQtoEuler(Q); // or whatever that conversion function is called

and get aproximately the same values after the last conversion as the
initial euler angles.

Cheers,

Hampa

5 jul 2006 kl. 15.37 skrev Jon Watte (ODE):

> 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
>>
>>
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>
>

```