Quote:
|
Originally Posted by Cyris12
It sounds a little complicated, but the code is actually pretty simple. The object does tend to overshoot some, and then oscillate a little. This can be minimized by adjusting the constants.
|
In physics terms, you are creating a harmonic oscillator
about the set point. The oscillation is a natural consequence of the linear force, much in the same manner that a mass bounces back and forth when suspended by a spring. You can reduce the finickyness by adding a damping term that operates much as a shock does on a car. This is done by adding a force that is proportional to, in this case the rotational, velocity and in opposition to the travel. This is easily done in he code by remembering the arm position from the prior poll with the computer, or interrupt as the case may be, and subtracting the current value. If you do this, you will find that you can increase the constant of proportionality for power to the drive motor, tightening up control, while preventing oscillation. There is a value for the damping, referred to as critically damped in physics terms if I remember correctly, that is somewhat magic in behavior.
We used this form of damping on 1280s arm at the
SanJose regional, and it was quite effective...