Competition#
Introduction#
The Competition class is used with the Field Control System during VEX Robotics Competitions using the V5 system. For more information about the Competition Template that uses the information on this page and how it applies to competition, read the Using the Python Competition Template in VEXcode V5.
Below is a list of available methods:
Constructor
Competition– Creates the Competition Control.
Getters
is_enabled– Checks if the competition is enabled or disabled.is_driver_control– Checks if the competition is in driver control mode.is_autonomous– Checks if the competition is in autonomous mode.is_competition_switch– Checks if the competition switch is connected.is_field_control– Checks if the Field Control System is connected.
Constructor#
Competition#
Competition creates the Competition Control. In VEXcode V5, the default function name for driver control is driver_control and for autonomous is autonomous.
Usage:
Competition(driver_control, autonomous)
Parameter |
Description |
|---|---|
|
A previously defined function called as a thread when the driver control period starts. |
|
A previously defined function called as a thread when the autonomous control period starts. |
# Define a function "driver_control".
def driver_control()
brain.screen.print("Driver called")
# Define a function "autonomous".
def autonomous()
brain.screen.print("Autonomous called")
# Construct a Competition Control object "competition"
# with the Competition class.
competition = Competition(driver_control, autonomous)
Getters#
is_enabled#
is_enabled checks if the state of the competition is enabled or disabled.
Trueif the competition is enabled.Falseif the competition is disabled.
Usage:
competition.is_enabled()
Parameters |
Description |
|---|---|
This method has no parameters. |
is_driver_control#
is_driver_control checks if the state of the competition is driver control.
Trueif the competition is in driver control mode.Falseif the competition is not in driver control mode.
Usage:
competition.is_driver_control()
Parameters |
Description |
|---|---|
This method has no parameters. |
is_autonomous#
is_autonomous checks if the state of the competition is autonomous.
Trueif the competition is in autonomous mode.Falseif the competition is not in autonomous mode.
Usage:
competition.is_autonomous()
Parameters |
Description |
|---|---|
This method has no parameters. |
is_competition_switch#
is_competition_switch checks if the competition switch is connected.
Trueif the competition switch is connected.Falseif it is not connected.
Usage:
competition.is_competition_switch()
Parameters |
Description |
|---|---|
This method has no parameters. |
is_field_control#
is_field_control checks if the field control system is connected.
Trueif the field control system is connected.Falseif it is not connected.
Usage:
competition.is_field_control()
Parameters |
Description |
|---|---|
This method has no parameters. |