What motion does iPhone SDK give exactly?

耗尽温柔 提交于 2019-12-12 04:46:16

问题


I am a little confused about iPhone's accelerometer and gyro data. I had worked with SDK at iOS 3.x times and as far as I remember it only gives rotation around axes. But with iPhone 4 I saw that it has a gyroscope; which is used for rotation again. If gyro is a new feature, what info does accelerometer give? I want to catch displacement of iPhone/iPod (without rotation) is there a way to catch this with any of the features?


回答1:


The 3D accelerometer in the iPhone 3G produces results that contain a mix of acceleration and orientation with respect to gravity. It doesn't really give a great answer for either acceleration or orientation as long as the phone is in changing motion. The Apple provided filtering algorithms only partially separate out the data, so each component can be slightly or greatly wrong. Rotation is then estimated from any changes in the estimated direction of gravity (the down vector with respect to the device). And estimates can be wrong.

The Core Motion API in iOS 4.x, combined with the 3 axis gyros in an iPhone 4, uses actual rotation measurements to try to subtract out rotation from the potentially mixed-up 3D accelerometer data, usually producing a much better estimates of orientation, rotation, and acceleration.

Displacement is much harder to measure, as the double integral of acceleration sums so much noise into the result, that the result will quickly diverge to be complete out of the park.




回答2:


Accelerometers measure lateral acceleration whereas gyroscopes measure relative rotation.

If move your phone vertically up without rotating it, you will see a non-zero value for acceleration on one axis (assuming the device is perpendicular to the Earth) but the gyro will read 0. It sounds like you want to use only the accelerometer data.




回答3:


I think you will need a gyro anyway to have a precise estimate of user acceleration and cancel gravity correctly. As usually your movement will not be just along one axis but will include slight rotation combined with slight displacement along other axises.



来源:https://stackoverflow.com/questions/7604534/what-motion-does-iphone-sdk-give-exactly

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