Datasheet
Chapter 3: EEPROM Tricks and Program Tips · Page 107
√ Save and then run the modified program, starting with both QTIs over a black
portion of the practice ring.
√ Repeat your tests with the tawara line, and verify that the SumoBot is making the
correct navigation decisions.
ACTIVITY #4: READING THE QTI SENSORS MORE QUICKLY
How much time does it take to read QTIs? It depends a lot on the surface and the
lighting conditions in the room. If both QTIs are on the black surfaces in the examples
from Activities #2 and #3, they tend to be in the 1000 to 4000 range. The time
measurement the
RCTIME command stores in a variable are in terms of 2 µs units. So, an
RCTIME measurement of 2000 equates to 4 ms:
ms4
s1000
ms1
s4000
s1000
ms1
s22000
s1000
ms1
s2tmeasuremenRCTIME)ms(time
=
×=
××=
××=
µ
µ
µ
µ
µ
µ
Since there are two QTIs, that's 8 ms between servo pulses. What if the material is more
absorbent of infrared, and the room is dark? Maybe both QTIs will return a measurement
of 3600, which equates to 7.2 ms per QTI, and 14.4 ms for the pair of them. There's
probably 2 ms of processing time to execute all the commands in the
Read_Line_Sensors subroutine, and another 2 ms worth of PAUSE commands to set up
for the
RCTIME measurements. That adds up to 18.4 ms. By the measurements in
Chapter 1, Activity #2, there's probably still enough time to check the IR detectors
without slowing down the servos.
What if you want to add a pair of QTIs to check the back of the SumoBot? That's twice
the time, or 36.4 ms. That will slow the servos down, and there still hasn't been any time
to check the IR detectors. You might be able to fix the problem by checking some of the
sensors between one set of servo pulses, and another set of sensors between the next. It
will reduce the time between servo pulses, but at the same time, it will increase the risk
that your SumoBot won't see something in time, like its opponent or the white tawara
line.