Here you will find more detail on our standard Race Code and how you can use it to win races :)
The standard Race Code is split into several parts:
Race Code Instructions (
Think of this script as the instructions you are giving your "virtual driver" for how to win the race.
Every team will want to change this script to control how their YetiBorg tries to race around the track.
Uses the Race Code Functions provided by
Formula.pyto control the behaviour of the YetiBorg
Race Code Functions (
These functions allow you to know what is going on around you and change how the YetiBorg is driving.
The functions are made available to
Race.pyso it can make decisions and alter strategy during a race.
Race Code Settings (
In this script are the settings used by the processing inside
Changes here can be used to fine-tune how the camera processing and track following work.
Race Code Processing (
This script takes the camera images and provides the ability to control the YetiBorg around the track.
It provides the data and inputs for the Race Code Functions used by
Main script (
This script is responsible for keeping everything running.
It manages the threads used by the other scripts, sets the output for the motors, and sets up the camera.
Control Script (
This is the script which talks to the ZeroBorg to control motor speeds.
The script is called from
Formula.pyfor each camera frame to update the motors to new settings.
Global values (
This is the script simply holds the values, images, functions, et cetera which are shared by the scripts above.
These values change while the scripts are running and they control a fair amount of the processing logic.
All of these scripts can be altered or replaced for a race, but you can win by simply improving
Race.py to drive a better line around the track.
Control can be as simple as changing lanes at points along the track, or advanced enough to look at camera images and make intelligent decisions based on the robots in front.
Finally there are some
Simulation*.py scripts as well.
These take the place of
Formula.py to allow a race to be simulated without the need of a track or YetiBorg.
Each simulation is slightly different, but they should help with testing your own code or improving on ours.
For more detail on how everything works click on the pages below to find out how each of the bits work.