# doing double integration to getdistance traveled

Has anybody been able to do double integration with readings from the accelerometer in the kop? How do you do double integration in easy c?

At http://www.olimex.com/dev/mod-mma7260q.html there is a way to convert acceleration and time to speed, and distance.

V = A * t, then the distance S = V * t

The key to the integration is precise, interrupt-driven timing.

When you take the acceleometer output, you can use the formula v[sub]f[/sub] = v[sub]f[/sub] + (a * t) every time through the program loop. If you use precise timing, you know the set time interval, you know the acceleration, and you know the initial velocity (this was v[sub]f[/sub] the previous time through the loop), so you can solve for the new final velocity.

From here, we plug this into the distance formula of d[sub]f[/sub] = d[sub]f[/sub] + (v[sub]f[/sub] * t). This formula finds out how far the robot would have traveled at velocity v[sub]f[/sub] for time t, and then adds that onto the previous distance.

With a dual-axis accelerometer, you will need two separate sets of these equations, one for both the x and y dimensions.

don’t forget that most accelerometers will not register the spin of your robot, that’s a gyroscope…

you can use an accelerometer if you place it not at the center of rotation, with the measuring axis pointed at the tangent of the direction of rotation…

-Leav

Yes, I resurrected an old thread… but I’d rather do that than start a new one on essentially the same subject.

I know doing double integration blows any error in a sampling of the acceleration up very fast over time (squaring and accumulating the error each time) but, has anyone done the double integration and can share some findings?

How fast does error show up? In what way? How accurate is it?

One application I’m looking at would require the double-integrated accelerometer to remain accurate for about 100ms.

Thanks for any data you can offer,

q