AnalogInputSim

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

Bases: pybind11_object

Class to control a simulated analog input.

Overloaded function.

  1. __init__(self: wpilib.simulation._simulation.AnalogInputSim, analog_input: wpilib._wpilib.AnalogInput) -> None

Constructs from an AnalogInput object.

Parameters:

analog_input – AnalogInput to simulate

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

Constructs from an analog input channel number.

Parameters:

channel – Channel number

get_initialized() bool

Check if this analog input has been initialized.

Returns:

true if initialized

get_voltage() float

Get the voltage.

Returns:

the voltage

register_initialized_callback(callback: collections.abc.Callable[[str, hal._wpi_hal.Value], None], initial_notify: bool) wpilib.simulation._simulation.CallbackStore

Register a callback on whether the analog input is initialized.

Parameters:
  • callback – the callback that will be called whenever the analog input is initialized

  • initial_notify – if true, the callback will be run on the initial value

Returns:

the CallbackStore object associated with this callback

register_voltage_callback(callback: collections.abc.Callable[[str, hal._wpi_hal.Value], None], initial_notify: bool) wpilib.simulation._simulation.CallbackStore

Register a callback on the voltage.

Parameters:
  • callback – the callback that will be called whenever the voltage is changed

  • initial_notify – if true, the callback will be run on the initial value

Returns:

the CallbackStore object associated with this callback

reset_data() None

Reset all simulation data for this object.

set_initialized(initialized: bool) None

Change whether this analog input has been initialized.

Parameters:

initialized – the new value

set_voltage(voltage: SupportsFloat | SupportsIndex) None

Change the voltage.

Parameters:

voltage – the new value