开发者

What motion does iPhone SDK give exactly?

开发者 https://www.devze.com 2023-04-09 05:13 出处:网络
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.

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 feature开发者_开发问答s?


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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号