Iphone accelerometer speed and distance

I want to find the distance traveled and speed from the events of the accelerometer . How iphone gMeter app does.

Any suggestion on which value or formula I should use for this?

Thanks in advance.

+3
source share
1 answer

You can use acceleration values ​​from the accelerometer to measure speed and distance. There is really good paper ( Implementing positioning algorithms using accelerometers ) that explains the errors you get from the accelerometer, and methods for getting speed and position from the acceleration value.

Some pseudo codes:

velocity[i] = (acceleration[i] + acceleration[i-1])/2 * interval + velocity[i-1] distance[i] = (velocity[i] + velocity[i-1])/2 * interval + distance[i-1]

interval is the time between acceleration/velocity[i] and acceleration/velocity[i-1] , which is related to the refresh rate of the accelerometer.

To increase accuracy, you should filter out acceleration values ​​in forehand. I implemented such an algorithm on the iPhone 3GS and it worked very well. The accelerometer allows you to measure distances of 30 cm with an error of about 1 cm. I have not tested long distances.

+9
source

Source: https://habr.com/ru/post/1480549/


All Articles