Quote:
Originally Posted by Kennersoft
If you only want your robot's forward velocity, mount your accelerometer with the sensitive axis pointing forward, then you can do an average of a number of them to give you average acceleration over a time, then integrate based on that. For 15 seconds of autonomous, it should be stable enough.
We're using the kit 3-axis accel over I2C and set that up to measure at 200Hz (200 samples/sec), which we then accumulate 10 samples to integrate. The output is velocity at 20Hz. I added a little "distance traveled" item for our autonomous that integrates this 20Hz velocity to distance, with a reset flag that sets it back to 0. This allows for "drive forward 3 feet, turn 90*, drive forward 10 feet" style autonomous as you can reset the distance traveled after the turn.
|
Thanks, this helps. Are you using a timed loop or just delays in the code to get the timing you want.
So sounds like you are capturing acceleration 200 times per second. Then you are averaging every ten of them and multiplying by .05 to get velocity at 20Hz. I am guessing you are multiplying again to get distance traveled in the .05 of a second. Then you are accumulating that distance to get total traveled.
Do you have any sample code I could let the team look at?