Page 278 ·
Robotics with the Boe-Bot
System
Error = -2
Kp X error
35 X -2
Center pulse width
750
Output
adjust
-70
Right servo
output
680
Measured right
distance = 4
-
+
+
+
Figure 8-4
Proportional
Control Block
Diagram for
Right Servo
and IR LED
and Detector
Pair
Let’s take a closer look at the numbers in Figure 8-4 to learn how proportional control
works. This particular example is for the right IR LED/detector and right servo. The set
point is 2, which means we want the Boe-Bot to maintain a distance of 2 between itself
and any object it detects. The measured distance is 4, which is too far away. The error is
the set point minus the measured distance which is 2 – 4 = –2. This is indicated by the
symbols inside the circle on the left. This circle is called a summing junction. Next, the
error feeds into an operator block. This block shows that error will be multiplied by a
value called a proportional constant (Kp). The value of Kp is 35. The block’s output
shows the result of –2
×
35 = –70, which is called the output adjust. This output adjust
goes into another summing junction, and this time it is added to the servo’s center pulse
width of 750. The result is a 680 pulse width that will make the servo turn about ¾ speed
clockwise. That makes the Boe-Bot’s right wheel roll forward, toward the object. This
correction goes into the overall system, which consists of the Boe-Bot, and the object,
that was at a measured distance of 4.
The next time through the loop, the measured distance might change, but that’s OK
because regardless of the measured distance, this control loop will calculate a value that
will cause the servo to move to correct any error. The correction is always proportional
to the error, which is the difference between the set point and measured distances.
A control loop always has a set of equations that govern the system. The block diagram
in Figure 8-4 is a way of visually describing this set of equations. Here are the equations
that can be taken from this block diagram, along with solutions.
Error
=
Right distance set point – Measured right distance