競賽#

介紹#

競賽類別用於在 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 檢查比賽狀態是否已啟用或已停用。

  • True 表示比賽已啟用。

  • False 如果比賽被禁用。

用法:

competition.is_enabled()

參數

描述

此方法沒有參數。

is_driver_control#

is_driver_control 檢查比賽狀態是否為車手控制。

  • True 為比賽處於駕駛控制模式。

  • False 如果比賽不在駕駛控制模式下。

用法:

competition.is_driver_control()

參數

描述

此方法沒有參數。

is_autonomous#

is_autonomous 檢查比賽狀態是否為自主狀態。

  • True 表示比賽處於自主模式。

  • False 如果比賽不是自主模式。

用法:

competition.is_autonomous()

參數

描述

此方法沒有參數。

is_competition_switch#

is_competition_switch 檢查競爭交換器是否已連線。

  • True 表示比賽開關已連接。

  • False 表示未連線。

用法:

competition.is_competition_switch()

參數

描述

此方法沒有參數。

is_field_control#

is_field_control 檢查現場控制系統是否已連接。

  • True 表示已連接。

  • False 表示未連線。

用法:

competition.is_field_control()

參數

描述

此方法沒有參數。