编码器 - 硬件

备注

This section covers encoder hardware. For a software guide to encoders, see Encoders - Software.

Encoders are by far the most common method for measuring rotational motion in FRC®, and for good reason - they are cheap, easy-to-use, and reliable. As they produce digital signals, they are less-prone to noise and interference than analog devices (such as potentiometers).

编码器的种类

There are three main ways encoders connect physically that are typically used in FRC:

  • 轴编码器

  • 轴上编码器

  • 磁编码器

这些编码器的安装方式有所不同。除了这些类型的编码器,许多队伍还将正交编码器集成到机械设计中。

There are also three main ways the encoder data is communicated that are typically used in FRC:

备注

Some encoders may support more then one communication method

Shafted Encoders

Diagram of the Greyhill 63R Optical Encoder.

Shafted encoders have a sealed body with a shaft protruding out of it that must be coupled rotationally to a mechanism. This is often done with a helical beam coupling, or, more cheaply, with a length of flexible tubing (such as surgical tubing or pneumatic tubing), fastened with cable ties and/or adhesive at either end. Many commercial off-the-shelf FRC gearboxes have purpose-built mounting points for shafted encoders.

Examples of shafted encoders:

On-shaft Encoders

Diagram of the AMT103 and the AMT102 shaft encoders.

On-shaft encoders couple to a shaft by fitting around it, forming a friction coupling between the shaft and a rotating hub inside the encoder.

Examples of On-shaft encoders:

Magnetic Encoders

Picture of the CTRE Mag Encoder.

Magnetic encoders require no mechanical coupling to the shaft at all; rather, they track the orientation of a magnet fixed to the shaft. While the no-contact nature of magnetic encoders can be handy, they often require precise construction in order to ensure that the magnet is positioned correctly with respect to the encoder.

Examples of magnetic encoders:

Quadrature Encoders

术语“正交”是指测量/编码运动的方法。正交编码器会产生两个相位相差为90度的方波脉冲,如下图所示:

The signal pattern in both directions and how using two channels allows us to tell the direction.

因此,在这两个信号通道之间,每个周期有四个“边”(因此为“ quad”)。通过判断两个不同相位的信号脉冲,哪个脉冲在另一个脉冲的前面,就可以明确确定运动方向,

As each square wave pulse is a digital signal, quadrature encoders connect to the digital input ports on the roboRIO.

Examples of quadrature encoders:

Quadrature Encoder Wiring

Wiring the E4T Optical Encoder to two DIO ports.

Quadrature Encoders, such as the E4T OEM Miniature Optical Encoder, can be wired to two digital input ports as shown above.

Index

Some quadrature encoders have a third index pin which pulses when the encoder completes a revolution.

Quaderature Encoder Resolution

警告

首字母缩写词“ CPR”和“ PPR”被不同的来源*同时*使用,以表示每转的两个边沿*和*每转的循环数,因此仅首字母缩写还不足以说明两者中的哪一个是何时给定的价值。如有疑问,请查阅您特定编码器的技术手册。

当编码器使用数字脉冲测量旋转时,测量精度受每给定旋转运动量的脉冲数限制。这被称为编码器的“分辨率”,并且通常以两种不同方式之一进行测量:每转的边沿或每转的圈数。

*每转边沿*是指编码器轴每转两个通道从高到低或从低到高的过渡总数。一个完整的周期包含*四个*边。

*每转周期*是指编码器轴每转两个通道的*完整周期*的总数。一个完整的周期是*一*转。

因此,以每转边缘表示的分辨率的值是以每转周期表示的相同分辨率的值的四倍。

通常,编码器每转边的分辨率应比定位中可接受的最小误差稍好。因此,如果您想知道正负一度的机制,则应使用分辨率稍高于每转360个边缘的编码器。

Duty Cycle Encoders

The PWM signal pattern for minimum and maximum angles.

Duty cycle encoders connect to a single digital input on the roboRIO. They output a pulse where the length of a pulse is proportional to the absolute position of the encoder.

Examples of duty cycle encoders:

Analog Encoders

The connection of a US Digital MA3 Analog encoder to the roboRIO analog input.

Analog encoders connect to a analog input on the roboRIO. They output a voltage proportional to the absolute position of the encoder.

Examples of analog encoders: