I receive orientation data as quaternions, and I'm interested in finding the ground-planed component of the change in angle.
I know that the arccosine of the dot product of two quaternions gives me the angle. For instance, the difference between an object oriented at $(0, 0, 0)$ and $(0, 90, 0)$ (roll, yaw, pitch) does give me $90$ degrees. I am not sure what the $120$ degrees from $(0, 90, 0)$ and $(90, 0, 0)$ represents in the real world, though.
I would like to extract the change in angle only around the world vertical axis. So, $(0, 90, 0)$ and $(90, 0, 0)$ would give me $90$, while $(0, 90, 45)$ and $(90, 0, 60)$ would be $30$ degrees.
Is there any way of finding that difference? Converting to Euler angles gives me a singularity near $(0, -90, 0)$, and I end up getting numbers like $(-150, 0.2, -170)$ etc, so I cannot rely on the output being correct.
@Coolwater was correct. Multiplying the quaternion by the other's inverse, then converting to Euler angles, gives the correct answer. I will be trying out different configurations in the lab tomorrow.
I made a
Quaternionclass which incorporates the definitions in the link @Coolwater gave.Taking yaw (the second item, so
_[1]), would give me the angle I am looking for.