![]() |
WPILibC++ 2025.3.2
|
Class to control a simulated PWM output. More...
#include <frc/simulation/PWMSim.h>
Public Member Functions | |
| PWMSim (const PWM &pwm) | |
| Constructs from a PWM object. | |
| PWMSim (const PWMMotorController &motorctrl) | |
| Constructs from a PWMMotorController object. | |
| PWMSim (int channel) | |
| Constructs from a PWM channel number. | |
| std::unique_ptr< CallbackStore > | RegisterInitializedCallback (NotifyCallback callback, bool initialNotify) |
| Register a callback to be run when the PWM is initialized. | |
| bool | GetInitialized () const |
| Check whether the PWM has been initialized. | |
| void | SetInitialized (bool initialized) |
| Define whether the PWM has been initialized. | |
| std::unique_ptr< CallbackStore > | RegisterPulseMicrosecondCallback (NotifyCallback callback, bool initialNotify) |
| Register a callback to be run when the PWM pulse microsecond value changes. | |
| int32_t | GetPulseMicrosecond () const |
| Get the PWM pulse microsecond value. | |
| void | SetPulseMicrosecond (int32_t microsecondPulseTime) |
| Set the PWM pulse microsecond value. | |
| std::unique_ptr< CallbackStore > | RegisterSpeedCallback (NotifyCallback callback, bool initialNotify) |
| Register a callback to be run when the PWM speed changes. | |
| double | GetSpeed () const |
| Get the PWM speed. | |
| void | SetSpeed (double speed) |
| Set the PWM speed. | |
| std::unique_ptr< CallbackStore > | RegisterPositionCallback (NotifyCallback callback, bool initialNotify) |
| Register a callback to be run when the PWM position changes. | |
| double | GetPosition () const |
| Get the PWM position. | |
| void | SetPosition (double position) |
| Set the PWM position. | |
| std::unique_ptr< CallbackStore > | RegisterPeriodScaleCallback (NotifyCallback callback, bool initialNotify) |
| Register a callback to be run when the PWM period scale changes. | |
| int | GetPeriodScale () const |
| Get the PWM period scale. | |
| void | SetPeriodScale (int periodScale) |
| Set the PWM period scale. | |
| std::unique_ptr< CallbackStore > | RegisterZeroLatchCallback (NotifyCallback callback, bool initialNotify) |
| Register a callback to be run when the PWM zero latch state changes. | |
| bool | GetZeroLatch () const |
| Check whether the PWM is zero latched. | |
| void | SetZeroLatch (bool zeroLatch) |
| Define whether the PWM has been zero latched. | |
| void | ResetData () |
| Reset all simulation data. | |
Class to control a simulated PWM output.
|
explicit |
|
explicit |
Constructs from a PWMMotorController object.
| motorctrl | PWMMotorController to simulate |
|
explicit |
Constructs from a PWM channel number.
| channel | Channel number |
| bool frc::sim::PWMSim::GetInitialized | ( | ) | const |
Check whether the PWM has been initialized.
| int frc::sim::PWMSim::GetPeriodScale | ( | ) | const |
| double frc::sim::PWMSim::GetPosition | ( | ) | const |
| int32_t frc::sim::PWMSim::GetPulseMicrosecond | ( | ) | const |
| bool frc::sim::PWMSim::GetZeroLatch | ( | ) | const |
Check whether the PWM is zero latched.
|
nodiscard |
Register a callback to be run when the PWM is initialized.
| callback | the callback |
| initialNotify | whether to run the callback with the initial state |
|
nodiscard |
Register a callback to be run when the PWM period scale changes.
| callback | the callback |
| initialNotify | whether to run the callback with the initial value |
|
nodiscard |
Register a callback to be run when the PWM position changes.
| callback | the callback |
| initialNotify | whether to run the callback with the initial value |
|
nodiscard |
Register a callback to be run when the PWM pulse microsecond value changes.
| callback | the callback |
| initialNotify | whether to run the callback with the initial value |
|
nodiscard |
Register a callback to be run when the PWM speed changes.
| callback | the callback |
| initialNotify | whether to run the callback with the initial value |
|
nodiscard |
Register a callback to be run when the PWM zero latch state changes.
| callback | the callback |
| initialNotify | whether to run the callback with the initial state |
| void frc::sim::PWMSim::ResetData | ( | ) |
Reset all simulation data.
| void frc::sim::PWMSim::SetInitialized | ( | bool | initialized | ) |
Define whether the PWM has been initialized.
| initialized | whether this object is initialized |
| void frc::sim::PWMSim::SetPeriodScale | ( | int | periodScale | ) |
| void frc::sim::PWMSim::SetPosition | ( | double | position | ) |
| void frc::sim::PWMSim::SetPulseMicrosecond | ( | int32_t | microsecondPulseTime | ) |
| void frc::sim::PWMSim::SetSpeed | ( | double | speed | ) |
| void frc::sim::PWMSim::SetZeroLatch | ( | bool | zeroLatch | ) |
Define whether the PWM has been zero latched.
| zeroLatch | true to indicate zero latched |