Using the Python Competition Template in VEXcode V5

The Competition Template is an example project that has commands already included to communicate with the Field Control System during competitions, ensures commands are in compliance with field regulations, and aids in setting up projects in order to avoid complications and disqualification ("competition" refers to a VRC event using the official field control hardware).  


Open the Competition Template from the Examples Page

Screenshot_2023-03-02_at_4.42.02_PM.png


Screenshot_2023-03-02_at_4.42.42_PM.png


Three sections of the template: Pre-autonomous, Autonomous Mode, and Driver Control

Screenshot_2023-03-02_at_4.43.29_PM.png

Note: In order for your project to work at a competition, you must leave these functions in your project. Add commands where the comments indicate for each section.


Use the pre_autonomous Function for any Setup

Screenshot_2023-03-02_at_4.45.24_PM.png

The pre_autonomous function is used for any set-up your robot may need such as calibrating a Gyro, setting variables, or other device settings. These commands will run immediately when the project is started, before the autonomous portion of the match begins.

Screenshot_2023-03-02_at_4.47.29_PM.png

Ensure that all commands are properly indented to that the guiding line is visible between the pre_autonomous and autonomous functions.

Note: If no setup is needed, this function can remain empty.


Autonomous

Screenshot_2023-03-02_at_4.51.31_PM.png

The autonomous function is used for controlling your robot during the autonomous portion of a VRC match. Commands within this function will run when the match begins the Autonomous period.

Screenshot_2023-03-02_at_4.51.40_PM.png

Ensure that all commands are properly indented to that the guiding line is visible between the pre_autonomous and autonomous functions.

Note: If no setup is needed, this function can remain empty.


User Control

Screenshot_2023-03-02_at_4.55.59_PM.png

The user_control function is used for controlling your robot during the driver control portion of a VRC match.  Commands within this function will run when the match begins the Driver Control period.

Note: The while True loop is shown above so the robot will respond to input from the V5 Controller for the entirety of the match.

Screenshot_2023-03-02_at_4.57.37_PM.png

Ensure that all commands are properly indented within the while True loop while coding the user control portion. Two guiding lines should be visible as shown here. One because the while True is within the user_control function. The other to ensure commands are within the while True loop.

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

Last Updated: