接近开关-硬件

备注

This section covers proximity switch hardware. For a guide to using proximity switches in software, see Digital Inputs - Software.

机器人上最常见的传感任务之一是检测物体(无论是机制,游戏块还是场地元素)何时在机器人上已知点的一定距离内。这种类型的感测是通过“接近开关”完成的。

接近开关操作

接近开关是开关-它们在“断开”状态(电路中没有连接)和“闭合”状态(其中有*)之间操作电路。因此,接近开关会产生数字信号,因此,它们几乎总是连接到roboRIO的:doc:digital input <digital-inputs-hardware> 端口。

接近开关可以是“常开”,其中激活开关可以使电路闭合;也可以是“常开”,其中激活开关可以使电路断开。某些开关*同时提供* NO和连接到同一开关的NC电路。实际上,在常开和常闭开关之间的有效区别是在到开关的接线失败的情况下系统的行为,因为接线故障几乎总是会导致开路。 NC开关通常是“更安全的”,因为布线故障会导致系统像按下开关一样工作-因为经常使用开关来防止机械装置自身损坏,因此在这种情况下,可以减轻机械装置损坏的机会接线故障。

roboRIO上的数字输入具有上拉电阻,当开关断开时,上拉电阻会使输入为高(1值),但是当开关闭合时,该值将变为0,因为现在输入已接地。

接近开关的种类

There are several types of proximity switches that are commonly used in FRC®:

机械接近开关(“限位开关”)

A normally open limit switch connected to a channel of the roboRIO DIO.

Mechanical proximity switches (more commonly known as “limit switches”) are probably the most commonly used proximity switch in FRC, due to their simplicity, ease-of-use, and low cost. A limit switch is quite simply a switch attached to a mechanical arm, usually at the limits of travel. The switch is activated when an object pushes against the switch arm, actuating the switch.

限位开关的大小,开关臂的几何形状以及激活开关所需的“投掷”量各不相同。尽管限位开关非常便宜,但其机械致动有时不如无触点替代品可靠。但是,它们也具有极强的通用性,因为它们可以由能够移动开关臂的任何物理物体触发。

See this article for writing the software for Limit Switches.

磁性接近开关

A magnetic proximity switch hooked up to a DIO channel of the roboRIO.

当磁铁进入传感器的特定范围内时,将激活磁性接近开关。因此,它们是“非接触式”开关-它们不需要与被感测的物体接触。

There are two major types of magnetic proximity switches - reed switches and hall-effect sensors. In a reed switch, the magnetic field causes a pair of flexible metal contacts (the “reeds”) to touch each other, closing the circuit. A hall-effect sensor, on the other hand, detects the induced voltage transversely across a current-carrying conductor. Hall-effect sensors are generally the cheaper and more reliable of the two. Pictured above is the Hall effect sensor from West Coast Products.

磁性接近开关可以是“单极”,“双极”或“全极”。单极开关根据磁铁的给定磁极的存在(根据开关的不同,是南极还是北极)来激活和停用。双极开关从一个极的附近激活,而从相对极的附近去激活。全极性开关将在任一极存在时激活,并在没有磁体的情况下禁用。

尽管磁性接近开关通常比机械接近开关更可靠,但是它们要求用户将磁体安装在要感测的物体上-因此,它们大多用于感测机构的位置。

电感式接近开关

Example industrial inductive proximity switch.

当任何类型的导体进入传感器的特定范围内时,感应式接近开关就会激活。像磁性接近开关一样,它们是“无触点”开关。

电感式接近开关用于许多与磁性接近开关相同的目的。根据应用的性质,它们的更一般的性质(在任何导体而不是仅在磁体的存在下激活)可以是帮助或阻碍。

光电接近开关

Connecting a photoelectric proximity switch to a DIO port.

光电接近开关是在FRC中广泛使用的另一种非接触式接近开关。光电接近开关包含一个光源(通常为IR激光)和一个光电传感器,当检测到的光(从传感器目标反射回来)超过给定阈值时,光电传感器将激活该开关。一种这样的传感器是下图中的`IR Obstacle Avoidance Module <https://www.electrodragon.com/product/infraredir-obstacle-avoidance-sensor-moduleadjust-distance/>`__。

Since photoelectric proximity switches rely on measuring the amount of reflected light, they are often inconsistent in their triggering range between different materials - accordingly, most photoelectric sensors have an adjustable activation point (typically controlled by turning a screw somewhere on the sensor body). On the other hand, photoelectric sensors are also extremely versatile, as they can detect a greater variety of objects than the other types of no-contact switches.

Photoelectric sensors are also often used in a “beam break” configuration, in which the emitter is separate from the sensor. These typically activate when an object is interposed between the emitter and the sensor. Pictured above is a beam break sensor with an IR LED transmitter and IR receiver.

Connecting a beam break receiver and transmitter each to one DIO channel on the roboRIO.

飞行时间接近开关

VL53L0X time of flight sensor hooked up to the I2C port.

Time-of-flight Proximity Switches are newer to the market and are not commonly found in FRC. They use a concentrated light source, such as a small laser, and measure the time between the emission of light and when the receiver detects it. Using the speed of light, it can produce a very accurate distance measurement for a very small target area. Range on this type of sensor can range greatly, between 30mm to around 1000mm for the VL53L0X sensor pictured above. There are also longer range versions available. More information about time of flight sensors can be found in this article and more about the circuitry can be found in this article.