竞赛#

介绍#

竞赛类用于在 VEX 机器人竞赛中使用 V5 系统的场地控制系统。有关使用此页面上的信息的竞赛模板及其在比赛中的应用的更多信息,请阅读在 VEXcode V5 中使用 Python 竞赛模板

以下是可用方法列表:

构造器

Getters

构造函数#

Competition#

Competition 函数用于创建竞赛控制。在 VEXcode V5 中,驾驶员控制的默认函数名为 driver_control,自主控制的默认函数名为 autonomous

用法:

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)

获取器#

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.

用法:

competition.is_enabled()

参数

描述

此方法没有参数。

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.

用法:

competition.is_driver_control()

参数

描述

此方法没有参数。

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.

用法:

competition.is_autonomous()

参数

描述

此方法没有参数。

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.

用法:

competition.is_competition_switch()

参数

描述

此方法没有参数。

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.

用法:

competition.is_field_control()

参数

描述

此方法没有参数。