Android/ iOS how to determine small changes in distance using sensors?

被刻印的时光 ゝ 提交于 2019-12-23 02:56:18

问题


I have been doing a bit of research, but I cannot seem to find a way to determine small distances (centimeters and meters) using the sensors in Android or iOS devices. Bluetooth appears too inaccurate and require more than one device, GPS only works over larger variations in distance, and small variations in rotation seem to make using the accelerometer nearly impossible.

Is there a method that I am unaware of that would allow me to do such a thing? I am familiar with Calculus, so using Integrals to determine distance based on changes in time and velocity/ acceleration is not a problem for me, I just do not know how to determine those things.

Thank you.


回答1:


There's no sensor in these devices which is able to give you the desired accuracy without exterior help.

If your use case allows for a bit of external setup, here are some ideas:

You could use the camera and computer vision to calculate device movement. You could, for example, use ARToolkit to measure the distance to a visual tag fixed to a wall. In close distances you can get pretty high accuracy (mm) using this technique.

Another idea would be to measure the distance to a solid object, like a wall, by emitting a short audio signal using the speaker and measure the time until the echo arrives at the microphone. This would be more of a research project, though.




回答2:


You CAN use the accelerometer to measure distance travelled
(if ONLY absolute displacement is involved).

Have the user hold the device flat and walk from pointA to pointB.
The user presses a "Start" button in ur app as he starts from A and
presses an "End" button in ur app as he reaches B.

Calculate the double-intergral of AccelX & AccelY seperately over time
between the 2 button presses. These will be distX & distY respectively.

Total displacement will be sqrt( (distXsquared) + (distY squared) ).

GoodLUCK!!

Regards
CVS@2600Hertz




回答3:


Just as a thought experiment, you should be able to do this using a combination of the accelerometer and the compass on each device.

However, whether the accuracy of these sensors is enough for what you want to do...well I think you'd just have to try it.



来源:https://stackoverflow.com/questions/5043059/android-ios-how-to-determine-small-changes-in-distance-using-sensors

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