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
- getInitialized() bool
Check whether the PWM has been initialized.
- Returns:
true if initialized
- getOutputPeriod() int
Get the PWM period scale.
- Returns:
the PWM period scale
- getPulseMicrosecond() int
Get the PWM pulse microsecond value.
- Returns:
the PWM pulse microsecond value
- registerInitializedCallback(callback: collections.abc.Callable[[str, hal._wpiHal.Value], None], initialNotify: bool) wpilib.simulation._simulation.CallbackStore
Register a callback to be run when the PWM is initialized.
- Parameters:
callback – the callback
initialNotify – whether to run the callback with the initial state
- Returns:
the CallbackStore object associated with this callback
- registerOutputPeriodCallback(callback: collections.abc.Callable[[str, hal._wpiHal.Value], None], initialNotify: bool) wpilib.simulation._simulation.CallbackStore
Register a callback to be run when the PWM period scale changes.
- Parameters:
callback – the callback
initialNotify – whether to run the callback with the initial value
- Returns:
the CallbackStore object associated with this callback
- registerPulseMicrosecondCallback(callback: collections.abc.Callable[[str, hal._wpiHal.Value], None], initialNotify: bool) wpilib.simulation._simulation.CallbackStore
Register a callback to be run when the PWM pulse microsecond value changes.
- Parameters:
callback – the callback
initialNotify – whether to run the callback with the initial value
- Returns:
the CallbackStore object associated with this callback
- resetData() None
Reset all simulation data.
- setInitialized(initialized: bool) None
Define whether the PWM has been initialized.
- Parameters:
initialized – whether this object is initialized
- setOutputPeriod(period: SupportsInt | SupportsIndex) None
Set the PWM period scale.
- Parameters:
period – the PWM period scale
- setPulseMicrosecond(microsecondPulseTime: SupportsInt | SupportsIndex) None
Set the PWM pulse microsecond value.
- Parameters:
microsecondPulseTime – the PWM pulse microsecond value