27404 Parallax Inc, 27404 Datasheet - Page 211

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
Chapter #5: Debugging and Datalogging
If the SumoBot exhibits a problem behavior in the ring, figuring out the problem's actual
cause can be rather confounding. Things happen pretty fast in the sumo ring, and it's
often hard to discern what the SumoBot might have "seen" when you're watching a
round. Especially if you extensively modify SumoWrestler.bs2 or add new sensors and
navigation states, you might find yourself relying heavily on the techniques introduced in
this chapter.
SEEING WHAT IT SEES AND UNDERSTANDING WHAT IT DOES
Problem behaviors aren't always confounding. In face, sometimes, it's pretty easy to
guess the cause. In that case, simply using an LED to signal when the suspect part of the
program starts to run will confirm your guess. Other times, you might expect the LED to
come on, but it just doesn't.
At that point you might have to add pieces of code throughout your program that test
other guesses. You may not want these pieces of test code to execute all the time, only
when you tell them to. There's no need to waste variable space or set up a pushbutton
controlled mode though, because the BASIC Stamp Editor supports compiler directives.
These compiler directives are added to the program to make the BASIC Stamp Editor
either include or leave out lines of code. It works both for multiple small statements
scattered throughout the program as well as for really large blocks of diagnostic code.
One really nice thing about compiler directives is you can add the diagnostic code
directly to the actual competition code. By simply changing one value at the beginning
of your program, you can incorporate debugging routines that show every sensor
detection, navigation state and maneuver your SumoBot chooses in slow motion. This
makes it possible to see what it sees, and understand the decisions it makes. Most
importantly, it's not in a separate test program, it's all part of the actual SumoWrestler.bs2
code.
Author's Note
I relied heavily on the techniques in this chapter, especially Activity #3 an #4. They helped
me figure out a number of problems, including program bugs, circuit continuity, and IR
reflected off the floor outside the SumoBot competition ring.

Related parts for 27404