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 of a Python tutorial from V5 Category Description, illustrating key concepts and code examples for programming with VEX Robotics.


Diagram illustrating the V5 Python programming structure, showcasing key components and their relationships for educational purposes in the V5 Category Description section of Python Tutorials.


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

Diagram illustrating key components of VEX V5 robotics system for Python tutorials, highlighting sensors, motors, and control elements.

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

Flowchart illustrating the process of using Python for VEX V5 robotics programming, highlighting key steps and decision points in the tutorial.

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.

Flowchart illustrating the process of using Python for VEX robotics programming, highlighting key steps and decision points in the tutorial.

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

V5 Category Description image illustrating Python tutorials, featuring key concepts and examples for programming with VEX robotics.

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.

Flowchart illustrating the process of using Python for VEX V5 robotics programming, highlighting key steps and components involved in the tutorials.

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

Diagram illustrating the V5 category description for Python tutorials, featuring key components and connections relevant to programming with VEX Robotics.

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.

Diagram illustrating the V5 Category Description for Python Tutorials, showcasing key components and features of the VEX V5 robotics system, including programming elements and hardware integration.

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: