Every content here is my original work.Creative Commons Licence
Universitas Scripta is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Your cookies may be used by Google and mathjax. See Google's privacy policy.

Monday, 22 March 2021

CMAttitude singularity

 By experiment, you can figure out q = (cos(yaw/2) + k sin(yaw/2)) * (cos(pitch/2) + i sin(pitch/2)) * (cos(roll/2) + j sin(roll/2)) where yaw and roll are in \([-\pi, \pi]\) and pitch is in \([-\pi/2, \pi/2]\). 

Since quaternion <-> rotation matrix is not one-to-one, we have to play with original expression, matrix. As apple's rotation matrix is active rotation, (current rotation matrix) = (relative matrix) * (reference frame rotation matrix). This gives proper singular points, 90deg and -90deg pitch from the reference attitude. If you just use quaternion i.e. CMAttitude system API, singularities are at the fixed point, absolute 90, -90deg pitch point. 90deg pitch point is right at the attitude when you are holding phone right up, which is pretty annoying.

No comments:

Post a Comment