Is there a way to calculate the height between ground and your phone ? I thought i could use accelerometer
to measure height but this post suggest that you should not use it considering the inaccuracy rate. If so what approach should i take to measure the height where my phone is held ?
问题:
回答1:
GPS is accurate enough for you to get the elevation to within a few meters, but that's probably not what you're going for.
I suppose you could try some sort of sonar, after you determine that the phone's mic/speaker is pointing straight towards the ground with the accelerometer. You could assume STP, which would probably introduce about 20% error.
You could also tell the user to drop the thing, and use the accelerometer to see how long it falls before hitting the ground. Probably the most precise and accurate. This might use up a lot of phones though.
回答2:
An accelerometer (and timer) could measure relative height. If you start from the ground you could get an approximation.
If you don't mind it only working once:
Drop it, use the same technique, stop timing after the first impact.