Competition#
The Competition class is used with the Field Control System during competitions. For more information about the Python Competition, read Using the Python Competition Template in VEXcode V5.
Initializing the Competition Class#
Competition Control is created by using the following constructor:
Competition(driver, autonomous)
This constructor uses two parameters:
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".
def driver()
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, autonomous)
This competition
object will be used in all subsequent examples throughout this API documentation when referring to Competition class methods.
Class Methods#
is_enabled()#
The is_enabled()
method checks if the state of the robot is enabled or disabled.
Returns: True
if the competition mode is enabled. False
if it is disabled.
is_driver_control()#
The is_driver_control()
method checks if the state of the robot is driver control.
Returns: True
if the robot is in driver control mode. False
if it is not in driver control mode.
is_autonomous()#
The is_autonomous()
method checks if the state of the robot is autonomous.
Returns: True
if the robot is in autonomous mode. False
if it is not in autonomous.
is_competition_switch()#
The is_competition_switch()
method checks if the competition switch is connected.
Returns: True
if the competition switch is connected. False
if it is not connected.
is_field_control()#
The is_field_control()
method checks if the field control is connected.
Returns: True
if the field control is connected. False
if it is not connected.