Datasheet

Chapter 4: Navigation Tips ยท Page 203
SUMMARY
This chapter introduced a technique that uses the LOOKUP command for adapting servo
control to use with the
temp and counter variables. It also introduced a subroutine that
makes checking the sensors between each servo pulse automatic.
DO UNTIL...LOOP
code blocks were used to respond to a sensor with an action until another sensor event
occurred or a counter exceeded a certain number of repetitions. This makes it possible
for the SumoBot to react to sensor detections on either the front or side that causes it to
face its opponent. Similar routines for detecting and avoiding the white tawara line were
also introduced along with search patterns the SumoBot can use to locate its opponent
more quickly and effectively.
The SumoBot navigation routines in this chapter can be conveniently viewed as state
machines. Selected sensor detections cause the SumoBot to transition between different
navigation states. State machine diagrams were introduced along with hybridized state
machine diagrams as a potential visual aid for mapping the SumoBot's various responses
to sensor events.
Two fully functional SumoWrestler programs were presented. Both make use of the
majority of the techniques presented earlier in this book. One contains all the navigation
states and state transitions in the main routine. The other only has state transitions in the
Main Routine, and all the navigation states are handled in subroutines.
Questions
1. Which BASIC Stamp I/O pin does the X7 signal line connect to?
2. What feature of servo motion does a
FOR...NEXT loop's EndValue control?
3. What feature of SumoBot motion does a
PULSOUT command's Pin argument
determine?
4. What do the numbers 700, 710, 720, 730 and 740 do for servo control?
5. Assuming a
FOR...NEXT loop with 20 ms pauses, how many pulses will it take
to make the servos go forward for 3 seconds?
6. What effect do sensors have on the amount of time a loop makes the servos run?
7. What combination of
PULSOUT commands does it take to make the SumoBot
execute a full speed reverse maneuver?
8. What combination of
PULSOUT commands does it take to make the SumoBot
execute a right turn (rotating in place)?