Should you even be converting from Euler angles? Don't you really just need a function to convert from a Quaternion to Euler angles? (Because of gimbal lock problems, which is what you get with pitches close to +/- 90 degrees).
If so, then this should do it:
I haven't tried if it works, but that's what the math book says as far as I can tell. Gimme a yell if it doesn't work as expected.
Edit: Oh by the way, the textbook example above assumes angles are in radians. I'm too tired to figure out if using degrees is going to make a difference, but my hunch is "probably not".
If so, then this should do it:
ex = ATan( (2* (w*x + y*z )) / (1-2*(x^2 + y^2))) ey = ASin( 2* (w*y - z*x)) ez = ATan( (2* (w*z + x*y )) / (1-2*(y^2 + z^2)))Where ex is the eular x axis angle (Roll on a gyro), ey is the euler y axis angle (Pitch on a gyro - this is the gimbal that locks - and thus cannot nessecarilly be converted back), ez is the euler z axis angle (yaw on a gyro). For the Quaternion w is the rotation coefficient (the real part) x is the "x orientation" or first imaginary part, y is the "y orientation" or second imaginary part, and z is the "z orientation" or third imaginary part.
I haven't tried if it works, but that's what the math book says as far as I can tell. Gimme a yell if it doesn't work as expected.
Edit: Oh by the way, the textbook example above assumes angles are in radians. I'm too tired to figure out if using degrees is going to make a difference, but my hunch is "probably not".