DutyCycleEncoderSim
- class wpilib.simulation.DutyCycleEncoderSim(*args, **kwargs)
Bases:
pybind11_object
Class to control a simulated duty cycle encoder.
Overloaded function.
__init__(self: wpilib.simulation._simulation.DutyCycleEncoderSim, encoder: wpilib._wpilib.DutyCycleEncoder) -> None
Constructs from a DutyCycleEncoder object.
- Parameters:
encoder – DutyCycleEncoder to simulate
__init__(self: wpilib.simulation._simulation.DutyCycleEncoderSim, channel: int) -> None
Constructs from a digital input channel.
- Parameters:
channel – digital input channel
- get() float
Get the position in turns.
- Returns:
The position.
- getAbsolutePosition() float
Get the absolute position.
- Returns:
The absolute position
- getDistance() float
- getDistancePerRotation() float
Get the distance per rotation for this encoder.
- Returns:
The scale factor that will be used to convert rotation to useful units.
- isConnected() bool
Get if the encoder is connected.
- Returns:
true if the encoder is connected.
- set(turns: wpimath.units.turns) None
Set the position in turns.
- Parameters:
turns – The position.
- setAbsolutePosition(position: float) None
Set the absolute position.
- Parameters:
position – The absolute position
- setConnected(isConnected: bool) None
Set if the encoder is connected.
- Parameters:
isConnected – Whether or not the sensor is connected.
- setDistance(distance: float) None
Set the distance.
- Parameters:
distance – The distance.