Sensor de distancia#

Introducción#

The Distance Sensor can detect whether an object is in front of the sensor and return how far away that object is. It can also report the detected object’s relative velocity and estimate whether the object is small, medium, or large.

The Distance Sensor operates over a range of 20 mm to 2000 mm.

Below 200mm, accuracy is approximately ±15mm. Above 200mm, accuracy improves to about 5%.

The Distance Sensor uses a Class 1 laser. Detection is directed straight ahead and is classroom-safe.

The Distance Sensor.

A continuación se muestra una lista de los bloques disponibles:

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

  • object velocity — Reports how quickly the detected object is moving toward or away from the Distance Sensor.

  • object size is — Reports whether the detected object matches the selected size.

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

distancia del objeto#

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

([Distance 1 v] distancia del objeto en [mm v])

Parámetros

Descripción

dispositivo

The Distance Sensor to use. Choose from the Distance Sensors configured in the Devices window.

unidades

The distance unit: mm (20 mm to 2000 mm) or inches (0.78 inches to 78.74 inches).

Ejemplo

Avance hasta que se detecte un objeto a menos de 200 mm.#
cuando empezó
[Drive forward until the object is within 50 mm away.]
unidad [adelante v]
esperar hasta <([Distance 1 v] distancia del objeto en [mm v]) [math_less_than v] [50]>
deja de conducir

velocidad del objeto#

The object velocity reporter block reports the relative velocity of the detected object as a decimal number in m/s (meters per second).

Velocity shows how quickly the object is moving toward or away from the Distance Sensor. A value near 0 means the object is not moving much relative to the sensor.

([Distance 1 v] velocidad del objeto en m/s)

Parámetros

Descripción

dispositivo

The Distance Sensor to use. Choose from the Distance Sensors configured in the Devices window.

object size is#

The object size is Boolean block reports whether the object detected by the Distance Sensor matches the selected size.

The Distance Sensor estimates object size based on how much of the sensor’s view is taken up by the detected object.

  • True — The Distance Sensor detects an object of the selected size.

  • False — The Distance Sensor does not detect an object of the selected size.

<¿El tamaño del objeto [Distance 1 v] es [pequeño v]?>

Parámetros

Descripción

dispositivo

The Distance Sensor to use. Choose from the Distance Sensors configured in the Devices window.

tamaño

The object size to check for:

  • small
  • medium
  • large

Distance found an object#

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

  • True — The Distance Sensor detects an object.

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

<[Distance 1 v] Encontraste un objeto?>

Parámetros

Descripción

dispositivo

The Distance Sensor to use. Choose from the Distance Sensors configured in the Devices window.

Ejemplo

Avanza hasta que se detecte un objeto a menos de 50 mm.#
cuando empezó
[Drive forward until the object is within 50 mm away.]
para siempre
unidad [adelante v]
si <[Distance 1 v] Encontraste un objeto?> entonces
si <([Distance 1 v] distancia del objeto en [mm v]) [math_less_than v] [50]> entonces
deja de conducir
romper