I am struggling to get my head around what I believe should be a simple problem.
I am getting a quaternion wxyz from an IMU (inertial measurement unit), I want to check the angle between the quaternion and a given unit vector.
I am very new to understanding quaternions but from doing research I understand the steps to be as follows
- Let $A$ be the quaternion from the IMU
- Let $B$ be the quaternion created from my target vector but with a scalar (W) of zero.
- Calculate $C = A*conj(B)$
- Calculate $\theta = 2 * atan2(norm(C_{xyz}),C_w)$
This appears to almost work but is sensitive to rotation of the axis not just the direction it is pointed at. I feel this kind of makes sense based on the result C being a transformation to get from A to B, but I don't know how to remove one axis of sensitivity in my result.