Direect angle extraction from quaternion

51 Views Asked by At

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.

Thanks