开发者

UI Accelerometer reference to compute the distance traveled by a person

How can I use the UIAccelerometer class to compute th开发者_JAVA百科e distance traveled by a person?


This is impractical, due to limitations with accelerometers.

  1. They measure acceleration, not distance. You can integrate it to get the velocity and integrate the velocity to get a distance, but the double integration will lose accuracy very fast, and even without the accuracy concerns, you need to establish an initial velocity, which the accelerometer can't work out.
  2. You also need high-frequency orientation data to distinguish between acceleration and gravity. Without this, you can't tell in which direction the velocity is increasing. You can't even tell if it is linear; someone could be spinning the device on the end of a string.

Use GPS instead, via the CLLocationManager class.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜