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)?
|
Yes, you can easily calculate the velocity from the acceleration. You do the exact same thing when you use a "gyro" on the robot to calculate your heading (the "gyro" actually is an angular velocity sensor, and you calculate the angle via the antiderivative (more accurately called an "integral").
To calculate an integral (i.e. anti-derivative) in software you do the following:
velocity = velocity + acceleration*sample_time;
You perform the above calculation over and over at a fast rate. "sample_time" is the time since the last time you took an acceleration reading.