DutyCycleEncoderSim

class wpilib.simulation.DutyCycleEncoderSim(*args, **kwargs)

Bases: pybind11_object

Class to control a simulated duty cycle encoder.

Overloaded function.

  1. __init__(self: wpilib.simulation._simulation.DutyCycleEncoderSim, encoder: wpilib._wpilib.DutyCycleEncoder) -> None

Constructs from a DutyCycleEncoder object.

Parameters:

encoder – DutyCycleEncoder to simulate

  1. __init__(self: wpilib.simulation._simulation.DutyCycleEncoderSim, channel: typing.SupportsInt | typing.SupportsIndex) -> None

Constructs from a digital input channel.

Parameters:

channel – digital input channel

get() float

Get the position.

Returns:

The position.

isConnected() bool

Get if the encoder is connected.

Returns:

true if the encoder is connected.

set(value: SupportsFloat | SupportsIndex) None

Set the position.

Parameters:

value – The position.

setConnected(isConnected: bool) None

Set if the encoder is connected.

Parameters:

isConnected – Whether or not the sensor is connected.