距离#

介绍#

The Distance Sensor can detect whether an object is in front of the sensor and report how far away that object is.

以下是可用模块列表:

  • Distance found an object — Reports whether the Distance Sensor currently detects an object.

  • object distance — Reports the distance between the Distance Sensor and the nearest detected object.

Distance found an object#

The Distance found an object Boolean block reports whether the Distance Sensor currently detects an object within 2000mm.

  • True — The Distance Sensor detects an object.

  • False — The Distance Sensor does not detect an object.

<[FrontDistance v] 发现对象?>

参数

描述

距离传感器

The Distance Sensor to use. Choose from the Distance Sensors available for the VR Robot.

例子

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

物距#

The object distance reporter block reports the distance between the Distance Sensor and the nearest detected object.

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

参数

描述

距离传感器

The Distance Sensor to use. Choose from the Distance Sensors available for the VR Robot.

单元

The distance unit: mm or inches.

例子

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