AnalogEncoder
- class wpilib.AnalogEncoder(*args, **kwargs)
Bases:
Sendable
Class for supporting continuous analog encoders, such as the US Digital MA3.
Overloaded function.
__init__(self: wpilib._wpilib.AnalogEncoder, channel: int) -> None
Construct a new AnalogEncoder attached to a specific AnalogIn channel.
This has a fullRange of 1 and an expectedZero of 0.
- Parameters:
channel – the analog input channel to attach to
__init__(self: wpilib._wpilib.AnalogEncoder, analogInput: wpilib._wpilib.AnalogInput) -> None
Construct a new AnalogEncoder attached to a specific AnalogInput.
This has a fullRange of 1 and an expectedZero of 0.
- Parameters:
analogInput – the analog input to attach to
__init__(self: wpilib._wpilib.AnalogEncoder, channel: int, fullRange: float, expectedZero: float) -> None
Construct a new AnalogEncoder attached to a specific AnalogIn channel.
- Parameters:
channel – the analog input channel to attach to
fullRange – the value to report at maximum travel
expectedZero – the reading where you would expect a 0 from get()
__init__(self: wpilib._wpilib.AnalogEncoder, analogInput: wpilib._wpilib.AnalogInput, fullRange: float, expectedZero: float) -> None
Construct a new AnalogEncoder attached to a specific AnalogInput.
- Parameters:
analogInput – the analog input to attach to
fullRange – the value to report at maximum travel
expectedZero – the reading where you would expect a 0 from get()
- get() float
Get the encoder value.
- Returns:
the encoder value scaled by the full range input
- getChannel() int
Get the channel number.
- Returns:
The channel number.
- initSendable(builder: wpiutil._wpiutil.SendableBuilder) None
- setInverted(inverted: bool) None
Set if this encoder is inverted.
- Parameters:
inverted – true to invert the encoder, false otherwise
- setVoltagePercentageRange(min: float, max: float) None
Set the encoder voltage percentage range. Analog sensors are not always fully stable at the end of their travel ranges. Shrinking this range down can help mitigate issues with that.
- Parameters:
min – minimum voltage percentage (0-1 range)
max – maximum voltage percentage (0-1 range)