線路追蹤器#

介紹#

循線器是一種類比感測器,它利用紅外線LED和光感測器來檢測前方表面的反射率。它設計用於安裝在機器人底盤下方,使機器人能夠沿著預先標記的路徑行進。

VEX線路追蹤器。

本頁面使用 line_tracker 作為範例線路追蹤器名稱。請根據需要將其替換為您自己配置的名稱。

以下是可用方法清單:

  • reflectivity – 回傳一個 integer,表示從表面反射的光量,以百分比表示。

建構函式 – 手動初始化線路追蹤器。

  • Line – 建立行追蹤器。

反射率#

reflectivity 回傳一個 integer,表示表面反射光量的百分比。這可用於幫助機器人沿著預先標記的路徑行進。

筆記:

  • 0%反射率意味著物體非常暗。

  • 100%反射率意味著物體非常明亮。

Usage:
line_tracker.reflectivity(units)

範圍

描述

units

可選。傳回反射率的單位: PERCENT (預設值)。

建構函數#

建構函式用於手動建立 Line 對象,這是在 VEXcode 之外配置 Line Tracker 所必需的。

Line#

Line 行建立行追蹤器。

Usage:
Line(port)

範圍

描述

port

The 3-Wire Port that the Line Tracker is connected to:

  • On the EXP Brain – brain.three_wire_port.x where x is the number of the port.
  • On a 3-Wire Expander – expander.a where expander is the name of the expander instance.

# Create a Line Tracker in Port A
line_tracker = Line(brain.three_wire_port.a)