PWMSim
- class wpilib.simulation.PWMSim(*args, **kwargs)
Bases:
pybind11_objectClass to control a simulated PWM output.
Overloaded function.
__init__(self: wpilib.simulation._simulation.PWMSim, pwm: wpilib._wpilib.PWM) -> None
Constructs from a PWM object.
- Parameters:
pwm – PWM to simulate
__init__(self: wpilib.simulation._simulation.PWMSim, channel: typing.SupportsInt | typing.SupportsIndex) -> None
Constructs from a PWM channel number.
- Parameters:
channel – Channel number
- get_initialized() bool
Check whether the PWM has been initialized.
- Returns:
true if initialized
- get_output_period() int
Get the PWM period scale.
- Returns:
the PWM period scale
- get_pulse_microsecond() int
Get the PWM pulse microsecond value.
- Returns:
the PWM pulse microsecond value
- register_initialized_callback(callback: collections.abc.Callable[[str, hal._wpi_hal.Value], None], initial_notify: bool) wpilib.simulation._simulation.CallbackStore
Register a callback to be run when the PWM is initialized.
- Parameters:
callback – the callback
initial_notify – whether to run the callback with the initial state
- Returns:
the CallbackStore object associated with this callback
- register_output_period_callback(callback: collections.abc.Callable[[str, hal._wpi_hal.Value], None], initial_notify: bool) wpilib.simulation._simulation.CallbackStore
Register a callback to be run when the PWM period scale changes.
- Parameters:
callback – the callback
initial_notify – whether to run the callback with the initial value
- Returns:
the CallbackStore object associated with this callback
- register_pulse_microsecond_callback(callback: collections.abc.Callable[[str, hal._wpi_hal.Value], None], initial_notify: bool) wpilib.simulation._simulation.CallbackStore
Register a callback to be run when the PWM pulse microsecond value changes.
- Parameters:
callback – the callback
initial_notify – whether to run the callback with the initial value
- Returns:
the CallbackStore object associated with this callback
- reset_data() None
Reset all simulation data.
- set_initialized(initialized: bool) None
Define whether the PWM has been initialized.
- Parameters:
initialized – whether this object is initialized
- set_output_period(period: SupportsInt | SupportsIndex) None
Set the PWM period scale.
- Parameters:
period – the PWM period scale
- set_pulse_microsecond(microsecond_pulse_time: SupportsInt | SupportsIndex) None
Set the PWM pulse microsecond value.
- Parameters:
microsecond_pulse_time – the PWM pulse microsecond value