How to calculate speed using accelerometer in ios

风格不统一 提交于 2019-12-12 02:07:36

问题


I want to implement a functionality to calculate the speed of moving object, but I don't want to use GPS(CLLocationManager).

Any suggestions on other ways to calculate speed?


回答1:


I want to implement a functionality to calculate speed of moving object, but I don't want to using GPS(CLLocation).

An object traveling at constant velocity doesn't experience any forces for the accelerometer to measure, so the accelerometer alone isn't enough to determine velocity -- you can only measure changes in velocity. If you know the initial velocity, like if the user tells you that the phone is at a standstill, then you can monitor acceleration and use that to determine velocity. That's likely to be quite error-prone, however, and the error will accumulate over time so that your velocity measurement will become less and less accurate.

There might be other ways to measure speed, like taking several photos with the camera and trying to determine speed from the changes in the images. Or you could measure average speed between two known points by observing the time between leaving one known wifi SSID and reaching another. But the right way to determine velocity is really to use the Location Manager.



来源:https://stackoverflow.com/questions/43315436/how-to-calculate-speed-using-accelerometer-in-ios

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