Using the Competition Template in VEXcode Pro V5

Opening the Competition Template in VEXcode Pro V5

file-yImdBeJ9fM.png

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

file-caVgk2FXtB.png

From the “Examples” window, you will see two different competition “Templates.”

  1.  “Clawbot Competition Template”. This template comes with V5 Clawbot devices pre-configured.
  2.  “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

file-lLP5wLmwYe.png

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.

file-7mHDVI8Sx4.png

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:

  1. Leave the code below inside the main function in place.
  2. Add your code inside one of the three functions (pre_auton, autonomous, usercontrol).

Using a Pre-auton Function for Any Setup Steps

file-ARGT3hAOCl.png

Add any setup steps such as gyro calibration, or other sensor resets that should run when the program is started, to the pre_auton function.

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

file-BQNqos8cCP.png

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 Controller1.ButtonA.pressing();

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

file-pb1pyLUMH9.png

The 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.

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: