Quote:
Originally Posted by eccmaster
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?
|
The key to the integration is precise, interrupt-driven timing.
When you take the acceleometer output, you can use the formula
vf = vf + (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
f 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
df = df + (vf * t). This formula finds out how far the robot would have traveled at velocity
vf 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.