In order to compete at a VEX Robotics Competition, a team's robot must be programmed with a set of competition code that is inserted into a competition template. The resulting program allows the robot to be controlled by the field controller when it is plugged in during a match, so the robot performs as the team expects.
VEX Robotics provides competition templates in their common programming environments, and these templates (for example, VEX Pro or VEX Code Blocks) come preconfigured with the necessary libraries and basic code structure to help you get started quickly. However, the competition template can be programmed in any programming language used for VRC robots.
Take some time to understand the structure of the competition template and how to write your own competition code. All of the code for a match is placed into one program within the competition template, and you can have several different versions that you choose between based on your match strategy. Each program should include sections for robot setup, autonomous mode, and user control (teleop) mode.
- Pre-Auton / Set Up Mode: In the pre autonomous or set up mode program, the team should code actions such as calibrating a gyro, setting variables, or other device settings. These blocks will run immediately when the program is started, before the autonomous portion of the match begins.
- Autonomous Mode: In the autonomous mode section of the template, write the code that makes your robot perform during the initial 15 seconds autonomous period. This code should be tailored to score high and preferably be able to fulfill the Win Point requirements. Reference the VRC game manual for rules about autonomous scoring.
- User Control Mode: In the user control section of the template, write the code that allows the driver to control the robot during the competition. Choose the best set up for your driver.
After writing your code, you can test it by using the controller to ensure it works as expected. You can also test it with a competition switch or by plugging it into a match field system. Debug any issues and make improvements to optimize performance. Now your team is ready to compete! Have fun!
Flow of steps at the competition field
- Plug the ethernet cord from the field control system into the V5 controller (make sure the controller and brain are turned off when plugging in).
- Place the robot in its starting position on the field.
- Turn on the V5 controller by pressing the power button.
- Turn on the V5 brain by pressing the power button.
- Select your program (one made with the Competition Template, configured as described in this article) on the robot brain.
- Check your radio connection to the field.
- A Referee or Emcee starts the match, and the autonomous period is activated in the Tournament Manager software. This tells the field controller to run the “auton” portion of the competition template, during which the brain will give issue control instructions while ignoring joystick inputs.
- The autonomous period runs for 15 seconds, then the field controller put robots into a “disabled” state.
- Referees score the autonomous period and record results, then start the driver controlled period.
- The driver controlled period is activated in the Tournament Manager software. This tells the field controller to run the “user control” portion of the competition template, during which joysticks can provide input to the robot.
- The driver controlled period runs for 1:45, then the field controller puts the robots back into a “disabled” state while referees score the match.
After we connect to the field controller, how do we choose and start a program?
You can select a program from the robot controller or on the robot brain.
Should we program the robot to stop at the end of the 15-second autonomous period?
You do not need to program the robot to stop. The field controller will stop the robot at the end of the autonomous period.
How do we let the robot know when to start the user control program?
If your code is properly set up within a competition template, the field controller will automatically run your user control program when the driver controlled period begins.