Page 79 - Designing Autonomous Mobile Robots : Inside the Mindo f an Intellegent Machine
P. 79
Chapter 5
shoots the rabbit, it almost perfectly approaches the desired quiescent state. Over-
shooting the rabbit causes the proportional term to go negative, decelerating the
approach to set point. The integral term “winds up” during the ascent of the rabbit,
but is cancelled out by the negative excursion of the proportional term as the tem-
perature overshoots the rabbit. There is no integral hold-off in this example.
So why would we want anything more than this? The answer is that the performance
is only optimal for the precise rabbit excursion to which the gains were tuned. Had
we elected to send the rabbit to 350 degrees with these same gains, there would have
been a significant overshoot because the integral would have wound up excessively.
Since robot servos must operate over a wide range of excursions and rates, a more
robust control is very desirable.
The error derivative term
With the tendency of the P-term and I-term to cause oscillations, it is natural to
look for a counterbalance. The purpose of the D-term is just that. The D-term is a
signal that is proportional to the derivative or rate-of-change of the error. This term
is subtracted from the other terms, in order to suppress changes in the error. Thus,
the whole PID equation that must be coded is merely:
P = (K · E) + (K · ∫E) – (K · dE/dt)
t p i d
Where P is the total power command, E is the current error, and K K and K are
t
d
i,
p,
the proportional, integral, and derivative gains. The algorithm is implemented by
repeatedly calling a subroutine on a timed basis. The frequency of execution depends
on the time frame of the response. The higher the frequency, the faster the servo can
respond, but the more computer resources that are absorbed. Generally the PID rate
for a mobile robot operating at less than 3 mph will be from 10 Hz to 100 Hz. A
single execution of the PID is often called a tick (as in the tick of a clock).
The proportional term is a simple, instantaneous calculation. The integral term,
however, is produced by multiplying the current error by the integral gain and
adding the result to an accumulator. If the error is negative, the affect is to subtract
from the accumulator.
The derivative can be calculated by simply subtracting the error that was present
during the previous execution of the algorithm from the current error. In some cases,
this may be a bit noisy and it may be preferable to average the current calculation
with the past few calculations on a weighted basis.
62

