Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently working on a project that involves using the Yaw, Pitch and Roll from a given Quaternion to calculate an objects orientation and acceleration.

I've searched a lot about how to obtain the YPR from a Quaternion, but they all seem to involve using tangent - and this seems to be causing problems whenever the sensor is rotated anything near 90 degrees.

So my question is: is it possible to obtain the YPR from a Quaternion without using tangent?

share|cite|improve this question

Your problem isn't that the tangent function is giving you bad results, it's that you have a singularity (See: gimbal lock) at a pitch of $\pm 90^o$.

At those orientations, you can have roll or yaw, but not both.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.