Page 294 ·
Robotics with the Boe-Bot
SUMMARY
Frequency sweep was introduced as a way of determining distance using the Boe-Bot’s
IR LED and detector.
FREQOUT
was used to send IR signals at frequencies ranging from
37.5 kHz (most sensitive) to 41.5 kHz (least sensitive). The distance was determined by
tracking which frequencies caused the IR detector to report that an object was detected
and which did not. Since not all of the frequencies were separated by the same value, the
LOOKUP
command was introduced as simple way to use the counting sequence supplied
by a
FOR…NEXT
loop to index sequential lists of numbers.
Control systems were introduced along with closed loop control. Proportional control in
a closed-loop system is an algorithm where the error is multiplied by a proportionality
constant to determine the system’s output. The error is the measured system output
subtracted from the set point. For the Boe-Bot, both system output and set point were in
terms of distance. The BASIC stamp was programmed in PBASIC to operate control
loops for the both the left and right servos and distance detectors. By re-sampling
distance and adjusting the servo output before sending pulses to the servos, the control
loop made the Boe-Bot responsive to object motion. The Boe-Bot was able to use
proportional control to lock onto and follow objects, and it also used it to track and
follow a stripe of black electrical tape.
Watch the Boe-Bot in Action at www.parallax.com!
You can see the Boe-Bot solving Chapter 8 Project 2 and other Robotics video clips in the
Robo Video Gallery under the Robotics Menu at www.parallax.com.
Questions
1.
What would the relative sensitivity of the IR detector be if you use
FREQOUT
to
send a 35 kHz harmonic? What is the relative sensitivity with a 36 kHz
harmonic?
2.
Consider the code snippet below. If the
index
variable is 4, which number will
be placed in the
prime
variable in this
LOOKUP
command? What values will
prime
store when
index
is 0, 1, 2, and 7?
LOOKUP index, [2, 3, 5, 7, 11, 13, 17, 19], prime
3.
In what order are PBASIC math expressions evaluated? How can you override
that order?