English
Language : 

27-400 Datasheet, PDF (61/77 Pages) List of Unclassifed Manufacturers – Assembly Documentation and Programming
Chapter 5: Basic Competition Code · Page 51
The Start_Delay section serves the same purpose as described previously, it's just a bit
fancier in this version of the program. In this case we've added a piezo speaker. At the
start, the LED illuminates and then blinks to tick away each of the five seconds in the
mandated delay. The LED blink coincides with a beep from the piezo speaker.
Since many matches start with the Mini-Sumo robots facing each other, the subroutine
called Lunge is called to get the SumoBot moving quickly. This routine drives the
SumoBot forward as fast as possible. It will also be used later when the opponent is
located. If your club rules specify that the SumoBot will not face the opponent from the
start, you may wish to substitute a rotation command to get the SumoBot oriented toward
the opponent as quickly as possible.
The core of the program is at Main. The code starts by reading the QTI sensors (now
using the calibrated black level for the Sumo ring). If the QTI sensors indicate that the
SumoBot is safely on the playing surface, a BRANCH instruction will send the code
Search_For_Opponent. If the SumoBot is touching the Tawara line (border), the edge
avoidance logic previously developed will be used. When the border is touched, the
lastIr variable is cleared so the SumoBot will move toward the center after turning in
from the border.
The Search_For_Opponent routine employs a bit of logic to minimize random searching.
This code calls the Read_IR_Sensors routine and will BRANCH accordingly, based on the
logic developed in program 4.2. If the opponent is not currently in sight, the SumoBot
will scan in the direction last known. Early on, when the opponent has not been spotted,
the SumoBot will creep forward in order to cut down the range between itself and the
opponent.
If the Read_IR_Sensors subroutine returns a hit, the SumoBot will move quickly in the
direction of the opponent. The hit direction is recorded in case the opponent escapes and
the SumoBot is forced back into scan mode. When the opponent is locked on (irBits =
%11), the SumoBot will go into "Lunge" mode to get to the opponent quickly and move it
out of the ring.
The best outcome is when the SumoBot can "see" the opponent with both "eyes" and both
QTI sensors detect the Tawara border. Under these conditions the assumption is that the
opponent has been successfully pushed from the ring and a Yuko point is to be awarded.
Many matches will be won when the SumoBot removes the competitor from the ring and
an angle; the competitor will be out but the SumoBot will continue to push, or may go