使用 iphone 中的加速度计功能在步行时计算步数的逻辑 [英] logic to count steps while walking using accelerometer feature in iphone

查看:33
本文介绍了使用 iphone 中的加速度计功能在步行时计算步数的逻辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 iPhone 中的加速度计功能来计算步行距离?

How can I use the accelerometer feature in the iPhone to calculate distances while walking?

推荐答案

您不能使用加速度计来确定距离.

You can't use the accelerometer to determine distance.

如果我处于休息状态,加速度计只会检测到重力加速度.这显然将步行距离设置为 0.

If I'm at rest, the accelerometer detects only acceleration due to gravity. This obviously set the walking distance to 0.

但如果我以恒定速度行走,并在行走时启动您的应用程序,我的加速度也为零,因此加速度计再次仅检测到重力加速度.情况同上,步行距离为0,不正确.

But if I'm walking at constant velocity, and start your app while walking, my acceleration is also zero, thus the accelerometer detects only acceleration due to gravity again. The situation is same as above, and the walking distance is 0, which is incorrect.

更不用说处理由于设备方向引起的加速度变化的困难了.

Not to mention the difficulty in dealing with changes of acceleration due to the orientation of the device.

需要 Core Location 来计算与距离相关的任何内容.您可以使用加速度计来实现计步器,但它只计算步数,而不计算距离.

You need Core Location to compute anything related to distance. You can use the accelerometer to implement a pedometer but that only counts steps, not distance.

这篇关于使用 iphone 中的加速度计功能在步行时计算步数的逻辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆