How to Create a Program Using the Competition Template (VEX C++)

Step 1: Open the competition template in VEX Coding Studio

  • Follow the steps shown in the animation to get to the competition templates folder.
  • In the folder browser that pops up, choose the VEX C++ folder, then choose Competition Template.vex

NOTE: The Competition Template is a sample program 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).  

Step 2: Understand the three sections of the template

  • The competition template has three sections that correspond to the three phases of a competition match: robot setup, autonomous, and driver control.
  • In order for your code to work at a competition, you must leave this code in place and add your code inside the sections.

Step 3: Use a pre-autonomous routine 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 pre_auton function.

NOTE:  This code will run immediately when the program is started, before the autonomous portion of the match begins.

NOTE: You may not have any setup steps. If so, leave this section empty.

Step 4: Add your autonomous routine

  • Put the code for your autonomous routine into the autonomous function.

NOTE:  You can copy and paste this code from another program file.

Step 5: Add your driver control code

  • Put your driver control code into the usercontrol function, inside the while(1) loop and before the vex::task::sleep command.

Still need help? Contact Us Contact Us