27404 Parallax Inc, 27404 Datasheet - Page 107

COMPETITION RING FOR SUMOBOT

27404

Manufacturer Part Number
27404
Description
COMPETITION RING FOR SUMOBOT
Manufacturer
Parallax Inc
Datasheet

Specifications of 27404

Accessory Type
Hobby and Education
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
SumoBot®
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
should measure the QTI readings for the black surface and use them as a basis for setting
a threshold value to decide whether the QTIs are "seeing" black or white. As you may
have noticed from Activity #2, white QTI measurements are very small in comparison.
Your program can safely set the threshold at 1/4 of the average of the two QTI sensors'
measurements of black. It takes three steps: (1) call the
to update the values of
readings. (3) divide this average by 4. Here is an example:
To discern whether the QTI is looking at black or white, use
The next example program uses these code blocks to tell you whether each QTI is
looking at black or white. Figure 3-13 shows an example of how this program can be
used to test the calibration routine and make sure it's working right.
GOSUB Read_Line_Sensors
qtiThreshold = (qtiLeft + qtiRight) / 2
qtiThreshold = qtiThreshold / 4
You can set higher or lower thresholds. For example, if you divide qtiThreshold by 3
instead of 4, the threshold will be higher. If you divide qtiThreshold by 5 or 6, the
threshold will be lower. A lower threshold value makes the SumoBot less likely to mistake a
crease in the SumoBot Robot Competition Ring for a white tawara line. It also helps
somewhat in brightly lit rooms. In contrast, a higher threshold value may be better for rings
where there is less difference in IR reflectivity between black and white.
You can also save a line of code. These two lines of code:
are equivalent to this one line of code:
IF qtiLeft < qtiThreshold THEN
ELSE
ENDIF
DEBUG "White"
DEBUG "Black"
qtiThreshold = (qtiLeft + qtiRight) / 2
qtiThreshold = qtiThreshold / 4
qtiThreshold = (qtiLeft + qtiRight) / 8
qtiLeft
and
qtiRight
. (2) take the average of the two
Read_Line_Sensors
IF...THEN
statements:
subroutine

Related parts for 27404