VEX2 Competition

From ROBOTC API Guide
Revision as of 18:45, 6 March 2012 by Bfeher (Talk | contribs)

Jump to: navigation, search

Main >> CORTEX >> Competitions with ROBOTC


In normal ROBOTC programming, every program is based around a “task main” function, as shown below:
task main()
{
 
}

In a competition program, things are a little different. To keep things simple, however, a Competition Template program is built into ROBOTC for use in VEX Competitions. The template provides a common starting point for teams when competing in an event. Rather than a single “main” task, the template has three sections, each matched to a specific section of the competition:

  • void pre_auton() – For running code that the robot needs to get “set up” before the competition begins
  • task autonomous() – For code the robot should run during the autonomous period (20 seconds by default)
  • task usercontrol() – For code the robot should run during the user control period (120 seconds by default)

The template and its accompanying “include” file handle the background work for the competition, such as monitoring the duration of each phase during a match, and communicating with the Vex Field Controller. All you need to do is tell the robot what to do in each phase.



Open a Competition Template

To open a competition template:

Open comp 1.png
Note: The competition template is a read-only file, so be sure to save a copy of the file somewhere else on your computer.