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, analogInput: wpilib._wpilib.AnalogInput) -> None

Constructs from an AnalogInput object.

Parameters:

analogInput – 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

getInitialized() bool

Check if this analog input has been initialized.

Returns:

true if initialized

getVoltage() float

Get the voltage.

Returns:

the voltage

registerInitializedCallback(callback: collections.abc.Callable[[str, hal._wpiHal.Value], None], initialNotify: 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

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

Returns:

the CallbackStore object associated with this callback

registerVoltageCallback(callback: collections.abc.Callable[[str, hal._wpiHal.Value], None], initialNotify: bool) wpilib.simulation._simulation.CallbackStore

Register a callback on the voltage.

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

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

Returns:

the CallbackStore object associated with this callback

resetData() None

Reset all simulation data for this object.

setInitialized(initialized: bool) None

Change whether this analog input has been initialized.

Parameters:

initialized – the new value

setVoltage(voltage: SupportsFloat | SupportsIndex) None

Change the voltage.

Parameters:

voltage – the new value