竞赛#

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

Getters

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)

范围

描述

driver_control

当驱动程序控制周期开始时,作为线程调用的先前定义的函数。

autonomous

当自主控制期开始时,作为线程调用的先前定义的函数。

# 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.

  • True if the competition is enabled.

  • False if the competition is disabled.

Usage:

competition.is_enabled()

Parameters

描述

This method has no parameters.

is_driver_control#

is_driver_control checks if the state of the competition is driver control.

  • True if the competition is in driver control mode.

  • False if the competition is not in driver control mode.

Usage:

competition.is_driver_control()

Parameters

描述

This method has no parameters.

is_autonomous#

is_autonomous checks if the state of the competition is autonomous.

  • True if the competition is in autonomous mode.

  • False if the competition is not in autonomous mode.

Usage:

competition.is_autonomous()

Parameters

描述

This method has no parameters.

is_competition_switch#

is_competition_switch checks if the competition switch is connected.

  • True if the competition switch is connected.

  • False if it is not connected.

Usage:

competition.is_competition_switch()

Parameters

描述

This method has no parameters.

is_field_control#

is_field_control checks if the field control system is connected.

  • True if the field control system is connected.

  • False if it is not connected.

Usage:

competition.is_field_control()

Parameters

描述

This method has no parameters.