Android/ iOS how to determine small changes in distance using sensors?
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 variat开发者_JS百科ions 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.
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.
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
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.
精彩评论