线路跟踪器#

介绍#

循线器是一种模拟传感器,它利用红外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 V5 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)