I don't have an iPhone 4 with me right now and I am trying to find a documentation that shows the ranges of yaw, pitch and roll and the correspondent positions of the device.
I know that the accelerometer varies from -1 to +1 but on my tests yesterday on my iPhone, showed me that the roll varies from -M_PI to +M_PI, but yaw and pitch ranges are half of that. Is this correct?
Where do I find documentation about these ranges? I don't see it on Apple vague docs.
Thanks.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With