用于计算人行进距离的 UI 加速计参考

发布于 2024-09-03 08:01:09 字数 54 浏览 4 评论 0原文

如何使用 UIAccelerometer 类来计算一个人行驶的距离?

How can I use the UIAccelerometer class to compute the distance traveled by a person?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

债姬 2024-09-10 08:01:09

由于加速度计的限制,这是不切实际的。

  1. 他们测量加速度,而不是距离。你可以积分得到速度,积分速度得到距离,但是双重积分会很快失去精度,即使不考虑精度,你也需要建立一个初始速度,而加速度计无法计算出该初始速度。 。
  2. 您还需要高频方向数据来区分加速度和重力。如果没有这个,你就无法判断速度在哪个方向增加。你甚至无法判断它是否是线性的;有人可能会在绳子末端旋转该设备。

通过 CLLocationManager 类改用 GPS。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文