Quote:
Originally Posted by Luke Pike
I have a quick question.
Last week my calculus class started teaching antiderivatives. If there is a function A(t) which gives acceleration as a function of time, then it's antiderivative is a function V(t) which gives velocity as a function of time (the antiderivative of that would be position), plus a constant C of course.
Now suppose we have an accelerometer sensor on a robot. If I can take the numerical antiderivative (if I can even do that), would that give me the velocity of the robot at that time (assuming the robot started off not moving)?
|
Great question... here's the 1 minute answer, but note that this is meant to get you started - there is MUCH MUCH more detail regarding these (numerical) methods that I won't get to touch on.
If you are given an accelerometer, and let's say it gives you values in m/s^2, you certainly can easily calculate the definite anti-derivative (integral) of acceleration to give you velocity.
How?
Read the accelerometer periodically, and keep adding your readings to a "counter." For example, start your counter at 0 (this is actually your C value), and start reading your accelerometer every 1s.
Let's say the first reading you get is 10m/s^2. Add the value 10 to your counter, and it turns out this counter will represent your velocity.
1 second later, let's say your next reading is again 10m/s^2. Add the value 10 to your counter which should now be 20. That makes sense, because if you've been accelerating at 10m/s^2 for 2 seconds, you'll be moving at 20m/s.
1 second later, let's say your next reading is -5m/s^2. Add the value to your counter, which should now be 15. You're moving at about 15m/s.
It turns out, velocity is simply the sum of all your acceleration readings. You also have to adjust the values a bit depending on how often you are reading your accelerometer, but I'll leave that for you to figure out - it's not too difficult. This method is adding up values into a counter is called "accumulation" and it shows up all over the place, and is one of the most basic forms of numerical integration.
Now if you were wondering, if you created ANOTHER counter, and used that counter to add up the values from you first counter described above, you would be performing a DOUBLE integral, and would actually get your robot's POSITION.
Before other posters jump on me, it turns out the method I mentioned above is very inaccurate. You will get a lot of "drift" and over time your velocity will no longer match up. There are a number of ways to improve on it, but chances are another poster will jump in and expand on that.
(waiting for someone to deliver an amazing 3rd year numerical methods lecture below)
