Opening the Competition Template in VEXcode Pro V5
Click on “File” on the top left of the VEXcode Pro V5 app, then select “Open Examples…” from the dropdown menu.
Selecting the Competition Template
From the “Examples” window, you will see two different competition “Templates.”
- “Clawbot Competition Template”. This template comes with V5 Clawbot devices pre-configured.
- “Competition Template”. This template doesn’t come with any device configurations.
We will be using the “Competition Template” for our example since the steps are the same for either template.
NOTE: The Competition Template is a sample project that sets up all of the necessary callbacks in order to communicate with the Field Control System during competitions, ensures code is in compliance with field regulations, and aids in setting up programs in order to avoid complications and disqualification ("competition" refers to a VRC event using the official field control hardware).
Naming Your Project
Enter a project name of your choice. Then click “Create.”
NOTE: Project names must NOT contain any spaces and must be less than 20 characters long.
Understanding the Three Sections of the Competition Template.
NOTE: The competition template has three sections that correspond to the three phases of a competition match: Pre Autonomous (robot setup), Autonomous period, and Driver Controlled Period.
In order for your code to work at a competition, you must:
- Leave the code below inside the main function in place.
- Add your code inside one of the three functions (
Using a Pre-auton Function for Any Setup Steps
Add any setup steps such as gyro calibration, or other sensor resets that should run when the program is started, to the
NOTE: The code inside the
pre_auton function below will run immediately when the program is started, before the autonomous portion of the match begins.
NOTE: If you choose not to use this section, leave it empty.
Using the Autonomous Function for Any Autonomous Routine
Put the code for your autonomous routine into the
autonomous function. Your
autonomous function must only contain commands that won’t need any interaction from a user. (E.g.,
BumperA.pressing())You should avoid any commands that require a user’s interaction. E.g
NOTE: You can copy and paste this code from another project file.
Using the usercontrol Function for Any User Controlled Routines that Take Place During the Driver Controlled Period
usercontrol function must only contain commands controlled by the user. (E.g.
Controller1.Axis1.position();)Put your driver control code into the
usercontrol function, inside the
while(1) loop and before the
wait(20, msec) command.