class wpilib.AnalogPotentiometer(channel, fullRange=1.0, offset=0.0)[source]

Bases: wpilib.LiveWindowSendable

Reads a potentiometer via an AnalogInput

Analog potentiometers read in an analog voltage that corresponds to a position. The position is in whichever units you choose, by way of the scaling and offset constants passed to the constructor.

AnalogPotentiometer constructor.

Use the fullRange and offset values so that the output produces meaningful values. I.E: you have a 270 degree potentiometer and you want the output to be degrees with the halfway point as 0 degrees. The fullRange value is 270.0(degrees) and the offset is -135.0 since the halfway point after scaling is 135 degrees.

  • channel (int or AnalogInput) – The analog channel this potentiometer is plugged into.
  • fullRange (float) – The scaling to multiply the fraction by to get a meaningful unit. Defaults to 1.0 if unspecified.
  • offset (float) – The offset to add to the scaled value for controlling the zero value. Defaults to 0.0 if unspecified.
class PIDSourceType

Bases: object

A description for the type of output value to provide to a PIDController

kDisplacement = 0
kRate = 1[source]

Get the current reading of the potentiometer.

Returns:The current position of the potentiometer.
Return type:float

Implement the PIDSource interface.

Returns:The current reading.
Return type:float

Set which parameter you are using as a process control variable.

Parameters:pidSource (PIDSource.PIDSourceType) – An enum to select the parameter.