DIOSim

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

Bases: pybind11_builtins.pybind11_object

Class to control a simulated digital input or output.

Overloaded function.

  1. __init__(self: wpilib.simulation._simulation.DIOSim, input: wpilib._wpilib.DigitalInput) -> None

Constructs from a DigitalInput object.

Parameters

input – DigitalInput to simulate

  1. __init__(self: wpilib.simulation._simulation.DIOSim, output: wpilib._wpilib.DigitalOutput) -> None

Constructs from a DigitalOutput object.

Parameters

output – DigitalOutput to simulate

  1. __init__(self: wpilib.simulation._simulation.DIOSim, channel: int) -> None

Constructs from an digital I/O channel number.

Parameters

channel – Channel number

getFilterIndex()int

Read the filter index.

Returns

the filter index of this DIO port

getInitialized()bool

Check whether this DIO has been initialized.

Returns

true if initialized

getIsInput()bool

Check whether this DIO port is currently an Input.

Returns

true if Input

getPulseLength()float

Read the pulse length.

Returns

the pulse length of this DIO port

getValue()bool

Read the value of the DIO port.

Returns

the DIO value

registerFilterIndexCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

Register a callback to be run whenever the filter index changes.

Parameters
  • callback – the callback

  • initialNotify – whether the callback should be called with the initial value

Returns

the CallbackStore object associated with this callback

registerInitializedCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

Register a callback to be run when this DIO is initialized.

Parameters
  • callback – the callback

  • initialNotify – whether to run the callback with the initial state

Returns

the CallbackStore object associated with this callback

registerIsInputCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

Register a callback to be run whenever this DIO changes to be an input.

Parameters
  • callback – the callback

  • initialNotify – whether the callback should be called with the initial state

Returns

the CallbackStore object associated with this callback

registerPulseLengthCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

Register a callback to be run whenever the pulse length changes.

Parameters
  • callback – the callback

  • initialNotify – whether to call the callback with the initial state

Returns

the CallbackStore object associated with this callback

registerValueCallback(callback: Callable[[str, HAL_Value], None], initialNotify: bool)wpilib.simulation.CallbackStore

Register a callback to be run whenever the DIO value changes.

Parameters
  • callback – the callback

  • initialNotify – whether the callback should be called with the initial value

Returns

the CallbackStore object associated with this callback

resetData()None

Reset all simulation data of this object.

setFilterIndex(filterIndex: int)None

Change the filter index of this DIO port.

Parameters

filterIndex – the new filter index

setInitialized(initialized: bool)None

Define whether this DIO has been initialized.

Parameters

initialized – whether this object is initialized

setIsInput(isInput: bool)None

Define whether this DIO port is an Input.

Parameters

isInput – whether this DIO should be an Input

setPulseLength(pulseLength: float)None

Change the pulse length of this DIO port.

Parameters

pulseLength – the new pulse length

setValue(value: bool)None

Change the DIO value.

Parameters

value – the new value