How do I measure the distance traveled by an iPhone using the accelerometer?

后端 未结 5 1300
渐次进展
渐次进展 2020-12-13 11:33

While GPS works for long distance changes, I would like to measure a shorter distance by using the iPhone\'s accelerometer.

Say I want to measure a height of a box u

5条回答
  •  一整个雨季
    2020-12-13 11:53

    It is possible to do this, as I have implemented a more complex system on a sparkfun IMU.

    There are a few components to do what you require accurately.

    1) You need to filter the accellerometers signal using a low pass filter. This removes any noise that is not caused by your slow moving arm.

    2) Integrate the 3 seperate acceleration values twice to go from acceleration to velocity, and then from velocity to distance.

    3) The above method must be performed by keeing the phone in the same plane when you move it from the bottom of the box to the top. Any pitch/roll/yaw will disrupt the measurement(hint)

    4) From above, to compensate for the pitch/roll/yaw, you can then include the built in gyro =]. Use this to map the vector obtained from the accellerometer to the starting point. Using this methodology you can measure the distance "through and object" by walking around it. (remember this gyro needs filtering too).

    The final result depends on many factors such as, the effectiveness of your filter, the accuracy and sampling rates of your accellerometer and gyro, and the awsomeness of your mathematics and linnear algebra skills.

提交回复
热议问题