please forgive my lack of background in math's, but i need to clear up a doubt i have about quaternion and the rotation they express.

my goal is to extract the angle (specifically pitch and roll) the sensor is giving me from a quaternion. I need the angles around its own axis rather than a fixed frame.

given a unit quaterion q = a + bi + cj + dk. Using :

$$ pitch = 2sin^{-1}(b) \\ roll = 2sin^{-1}(c) \\ yaw = 2sin^{-1}(d) $$

i can extract the angles but only when the sensor is not rotated around yaw from the starting angle. when i start rotating yaw, everything get wonky.

i am sure i am missing something important, but i need some easy-to-understand tips to get moving.

I have also noticed that if i multiply the rotation quaternion to its conjugate i have a "zeroing" effect on the output.


  • $\begingroup$ The answer will very much depend on the rotation order that was used (en.wikipedia.org/wiki/Euler_angles). Do you know which one was used? $\endgroup$ – Matti P. Jul 15 '20 at 12:35
  • $\begingroup$ Here's also (a bit long, I admit) discussion on a similar question. Please read my answer, it should clarify the computations quite much: math.stackexchange.com/questions/3273597/… $\endgroup$ – Matti P. Jul 15 '20 at 12:39
  • $\begingroup$ I have searched quite extensively inside the sensor datasheet (BNO080 from Ceva-DSP) but nowhere is clearly said what rotation order was used. I have made some tests with euler conversion, and found that ZYX scheme fit correctly. $\endgroup$ – gionag Jul 15 '20 at 12:49
  • $\begingroup$ Just to be extra-clear. Given a certain Quaterion, needing rotations around its own axis, i can just go with the atan/asin/atan conversion to extract angles, or in this case i need to manipulate an intermediate quaternion to work with ? $\endgroup$ – gionag Jul 15 '20 at 12:56
  • $\begingroup$ What do you mean by "angles around its own axis"? What is "it" in this case? $\endgroup$ – Matti P. Jul 15 '20 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.