Potentiometers to measure joint angle or linear motion

Potentiometers are a common analog sensor used to measure absolute angular rotation or linear motion (string pots) of a mechanism. A potentiometer is a three terminal device that uses a moving contact to from a variable resistor divider. When the outer contacts are connected to 5V and ground and the variable contact is connected to an analog input, the analog input will see an analog voltage that varies as the potentiometer is turned.

Potentiometer Taper

The taper of a potentiometer describes the relationship between the position and the resistance. The two common tapers are linear and logarithmic. A linear taper potentiometer will vary the resistance proportionally to the rotation of the shaft; For example, the shaft will measure 50% of the resistave value at the midpoint of the rotation. A logarithmic taper potentiometer will vary the resistance logarithmically with the rotation of the shaft. Logarithmic potentiometers are commonly used in audio controls due to human perception of audio volume also being logarithmic.

Most or all FRC uses for potentiometers should use linear potentiometers so that angle can be deduced directly from the voltage.

Using Potentiometers with WPILib

WPILib does not contain an explicit class for using potentiometers, as an analog device code should use the Analog Channel class to interface with the potentiometer. Some teams choose to create a class in their code which extends Analog Channel which implements the scaling and offset operations which convert voltages to angles or other real world units used on the robot.