[ODE] How to compute local yaw, pitch and roll

Alex Green alexg at acfr.usyd.edu.au
Wed Dec 27 21:00:18 MST 2006

G'day, from the rotation matrix:

// 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

P.S. Double check the numbers coming out of this for your implementation. 
One of the variables may need a to be negated depending on which way you 
choose as forward. -alex

ouille wrote:
> Hello,
> This is my first post on this mailing, but i read it since a few years.
> I use ode, with raydium engine involved in several projects of simulator for
> learning courses.
> I have a problem, trying to implement a small "flight simulateur" with ode,
> i need to have local yaw, pitch and roll of an object (the drone).
> Can i extract thoses informations from a quaternion ?
> How can i mix information from body rotation ?
> Did i have to be scared about gimbal lock ?
> Does someone have a small piece of code as example ?
> Have a nice day
> Jacques.

More information about the ODE mailing list