28125 Parallax Inc, 28125 Datasheet - Page 294

TEXT ROBOTICS

28125

Manufacturer Part Number
28125
Description
TEXT ROBOTICS
Manufacturer
Parallax Inc
Datasheet

Specifications of 28125

Title
Robotics with the Boe-Bot
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
Programming the Boe-Bot Shadow Vehicle
Remember that the equation for the right servo’s output was:
Here is an example of solving this same equation in PBASIC. The right distance set
point is 2, the measured distance is a variable named
IR distance measurement, Kp is 35, and the center pulse width is 750:
Measured left
Right servo output
distance = 4
Remember that in PBASIC math expressions are executed from left to right. First,
distanceRight
Kpr
You can use parentheses to force a calculation that is further to the right in a line of
PBASIC code to be completed first. Recall this example: you can rewrite this line of
PBASIC code:
In this expression, 35 is multiplied by the result of (2 – distanceRight), then the product is
added to 750.
like this:
pulseRight = 2 - distanceRight * 35 + 750
pulseRight = 35 * (2 – distanceRight) + 750
pulseRight = 2 - distanceRight * 35 + 750
, and after that, the product is added to the center pulse width.
+
-
Error = -2
=
is subtracted from
(Right distance set point – Measured right distance)
+ Center pulse width
Kp X error
System
-35 X -2
2
. The result of this subtraction is then multiplied by
Output
adjust
+70
Center pulse width
distanceRight
+
750
+
Left servo
output
820
Figure 8-5
Proportional
Control Block
Diagram for
Left Servo and
IR LED and
Detector Pair
that will store the
×
Kp

Related parts for 28125