距离#

介绍#

距离传感器可以检测物体是否在传感器前方,并报告该物体与传感器的距离。

以下是可用模块列表:

距离测量结果显示物体#

检测到物体的距离布尔模块报告距离传感器当前是否检测到 2000 毫米范围内的物体。

  • 正确 — 距离传感器检测到物体。

  • 错误 — 距离传感器未检测到物体。

<[FrontDistance v] 发现对象?>

参数

描述

距离传感器

要使用的距离传感器。请从适用于 VR 机器人的距离传感器中进行选择。

例子

当开始 :: hat events
[Spin until the Distance Sensor detects an object.]
[右 v] 转
等到 <[FrontDistance v] 发现对象?>
驱动停止

物距#

物体距离报告模块报告距离传感器与最近检测到的物体之间的距离。

([FrontDistance v] 距离 [毫米 v])

参数

描述

距离传感器

要使用的距离传感器。请从适用于 VR 机器人的距离传感器中进行选择。

单元

距离单位:毫米英寸

例子

当开始 :: hat events
[Print the distance only after the Distance Sensor detects an object.]
[右 v] 转
等到 <[FrontDistance v] 发现对象?>
驱动停止
打印 ([FrontDistance v] 距离 [毫米 v]) ▶