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.

is_connected() 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.

set_connected(is_connected: bool) None

Set if the encoder is connected.

Parameters:

is_connected – Whether or not the sensor is connected.