# How to get Velocity and Displacement from IMU sensor?

I have an imu mounted bot.I want to get the speed of the bot using imu i dont want to use the encoders. Imu gives acceleration how should i integrate that to get velocity and how much error would be there??

The error in this method would be massive.

Velocity is the integration of acceleration over time. However, you don't have acceleration over time - you only have acceleration at discrete points in time - the times that you actually sample the acceleration.

You would want the total acceleration between two points in time, which you just don't have.

Take the following timeline of acceleration points:

``````+3 +2 +5 +2 -3 -4 +3 -5 +3 +2 +6 -4 -2 +3 -4 -5 +6 -3 -1 -2 +7 -2
^           ^           ^           ^           ^           ^
``````

The carets are the points where you are actually sampling the acceleration.

Assuming you start from 0m/s, and those are all changes in m/s, your calculated speed from your samples would be 3-3+3-2+6+7 = 14m/s. However, the real velocity would be 7m/s.

In reality, there aren't discrete points of acceleration - just a single smooth waveform.

The faster you can sample the closer to reality you get, but there's always a chance that you would miss some critical brief change in velocity.

On top of that, you have noise. Quantisation noise, vibration, electrical noise, etc - all of which add a certain amount of uncertainty of their own.