iphone - core motion range of yaw, pitch and roll

穿精又带淫゛_ 提交于 2019-11-29 02:28:41

This is not a full answer, but in the interest of starting the ball rolling:

I'm assuming you are talking about the device attitude rather than the raw gyro data.

Anecdotally (I have an ipod touch 4 gen sitting in front of me displaying these values):

pitch: looks to be a range of -(M_PI/2) -> +(M_PI/2) although mine caps at ~ +1.55 / -1.51

roll: -M_PI -> +M_PI

yaw: -M_PI -> +M_PI

Just a note, at least on my device pitch doesn't differentiate tilt "forward" vs "backward", just gives the angle of the device relative to the direction of gravity. To figure out if the screen is pointed down or up, you can of course check gravity.z.

If you're using CMDeviceMotion there is a property called gravity on it, just grab gravity.z. It will be negative if the device's display is tilting upward (away from gravity) and positive if the display is facing down (toward gravity)

Note that the algorithms used by CMDeviceMotion are pretty good at separating gravity from user acceleration but under certain kinds of motion there may be some lag before the values become correct, I would love to here from someone with a better solution.

I have recently faced the same problem for an iOS app that counts the number of flips that the phone does. Apple has rejected it so I have published it on GitHub, may be useful for you:

Flip Your Phone! - https://github.com/apascual/flip-your-phone

I never thought on the solution using the gravity Z variable, I will try it soon and I come back with some updates.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!