27404 Parallax Inc, 27404 Datasheet - Page 147

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 4: Navigation Tips · Page 143
Chapter #4: Navigation Tips
Effectively using four object detectors and two QTI line sensors for SumoBot navigation
can seem a little daunting at first, especially when you consider that there are 64 different
possible combinations of detected and not detected that you can get from this array. It
turns out that you can reduce all these possibilities to a very simple
statement. In fact, just an
, six
s, and one
IF...ELSEIF...ELSE...ENDIF
IF
ELSIF
can control the whole show and give you a highly functional wrestling program.
ELSE
The
, all the
s and the
conditions in the final program call subroutines that
IF
ELSEIF
ELSE
do specific maneuvers until either a sensor condition is detected indicating the subroutine
succeeded, or the allowed amount of time for the subroutine to execute the maneuver has
expired. It makes the SumoBot's behavior both predictable and automated. This chapter
demonstrates the various building blocks that go into a program that simplifies the
SumoBot's decision process and automates maneuver's responses to sensor events.
SENSOR FLAGS AND NAVIGATION STATES
There are several ingredients to building a program that makes a lot of different sensors
and maneuvers easy to manage. First, build a subroutine that makes selecting servo pulse
durations fully automated. All your program should have to do is set a variable equal to a
maneuver name, and then call the servo control subroutine. Second, build a subroutine
that calls both the servo control subroutine and updates all the sensors. That way, after
your program has picked its maneuver, the
variable can be completely updated
sensors
between each servo pulse.
Third, construct independent navigation states.
Each
navigation state should be a subroutine that does a job with no further intervention until it
has either succeeded or its time for the maneuver has expired. Finally, construct an
statement that checks and responds to the most important sensor flags first,
IF...THEN
and then goes down a list of possible conditions that the SumoBot should react to. This
statement simply responds to each sensor condition by calling the navigation
IF...THEN
subroutine that is designed to respond to that condition.
It takes a few steps to get to the final form of the program, starting as always with small
programs. These small programs are then converted into programs that feature sections
and a common variable use convention. After several of these are built, they can be
merged into a larger test program. After the test program is tested, it can be rearranged
into a simplified Main Routine that makes executive decisions and then passes control to
navigation subroutines.

Related parts for 27404