27404 Parallax Inc, 27404 Datasheet - Page 221

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
performs. This kind of tool can be really helpful for isolating both program and circuit
bugs.
One important feature of this diagnostic tool, is that it all appears in conditional compiler
directives. Because of this, you will be able to change one value in your program, and
change it from a diagnostic tool back to competition code.
Incorporation Diagnostic Display Code in the SumoWrestler.bs2 Program
Watching the SumoBot's program play itself out in slow motion on the Debug Terminal
makes it a lot easier to isolate problems with sensors, in the program, and so on. It also
makes it easier to understand how the program reacts to various sensor conditions. This,
in turn makes it easier to refine and improve the program, and also to add more sensors.
The example program for this activity started as SumoWrestler.bs2. After renaming the
program, all the code that involves displaying the sensors, state, and maneuver values
were added, nested in conditional compiler directives. This makes it possible to use one
#DEFINE
Symbol
' -----[ Compiler Definitions ]-----------------------------------------------
#DEFINE DEBUG_MODE = 1
The
constants for the state values were added, again in a conditional compiler directive.
' -----[ Constants ]----------------------------------------------------------
#IF DEBUG_MODE = 1 #THEN
#ENDIF
A variable named
' State constants.
ATL
ATR
GF
TFLO
TFRO
TSLO
TSRO
SP
.
.
.
Display_All
the program will use for these conditional compiler directives is
to change the program from a diagnostic tool to a competition program. The
CON
CON
CON
CON
CON
CON
CON
CON
state
subroutine required a few modifications to the program. First, some
is added to store these constants.
0
1
2
3
4
5
6
7
' 1 -> full debug 0 -> wrestle
' Avoid_Tawara_Left
' Avoid_Tawara_Right
' Go-Forward
' Track_Front_Left_Object
' Track_Front_Right_Object
' Track_Side_Left_Object
' Track_Side_Right_Object
' Search_Pattern
DEBUG_MODE
.

Related parts for 27404