WPILibC++ 2024.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. More... | |
PWMSim (const PWMMotorController &motorctrl) | |
Constructs from a PWMMotorController object. More... | |
PWMSim (int channel) | |
Constructs from a PWM channel number. More... | |
std::unique_ptr< CallbackStore > | RegisterInitializedCallback (NotifyCallback callback, bool initialNotify) |
Register a callback to be run when the PWM is initialized. More... | |
bool | GetInitialized () const |
Check whether the PWM has been initialized. More... | |
void | SetInitialized (bool initialized) |
Define whether the PWM has been initialized. More... | |
std::unique_ptr< CallbackStore > | RegisterPulseMicrosecondCallback (NotifyCallback callback, bool initialNotify) |
Register a callback to be run when the PWM pulse microsecond value changes. More... | |
int32_t | GetPulseMicrosecond () const |
Get the PWM pulse microsecond value. More... | |
void | SetPulseMicrosecond (int32_t microsecondPulseTime) |
Set the PWM pulse microsecond value. More... | |
std::unique_ptr< CallbackStore > | RegisterSpeedCallback (NotifyCallback callback, bool initialNotify) |
Register a callback to be run when the PWM speed changes. More... | |
double | GetSpeed () const |
Get the PWM speed. More... | |
void | SetSpeed (double speed) |
Set the PWM speed. More... | |
std::unique_ptr< CallbackStore > | RegisterPositionCallback (NotifyCallback callback, bool initialNotify) |
Register a callback to be run when the PWM position changes. More... | |
double | GetPosition () const |
Get the PWM position. More... | |
void | SetPosition (double position) |
Set the PWM position. More... | |
std::unique_ptr< CallbackStore > | RegisterPeriodScaleCallback (NotifyCallback callback, bool initialNotify) |
Register a callback to be run when the PWM period scale changes. More... | |
int | GetPeriodScale () const |
Get the PWM period scale. More... | |
void | SetPeriodScale (int periodScale) |
Set the PWM period scale. More... | |
std::unique_ptr< CallbackStore > | RegisterZeroLatchCallback (NotifyCallback callback, bool initialNotify) |
Register a callback to be run when the PWM zero latch state changes. More... | |
bool | GetZeroLatch () const |
Check whether the PWM is zero latched. More... | |
void | SetZeroLatch (bool zeroLatch) |
Define whether the PWM has been zero latched. More... | |
void | ResetData () |
Reset all simulation data. More... | |
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.
std::unique_ptr< CallbackStore > frc::sim::PWMSim::RegisterInitializedCallback | ( | NotifyCallback | callback, |
bool | initialNotify | ||
) |
Register a callback to be run when the PWM is initialized.
callback | the callback |
initialNotify | whether to run the callback with the initial state |
std::unique_ptr< CallbackStore > frc::sim::PWMSim::RegisterPeriodScaleCallback | ( | NotifyCallback | callback, |
bool | initialNotify | ||
) |
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 |
std::unique_ptr< CallbackStore > frc::sim::PWMSim::RegisterPositionCallback | ( | NotifyCallback | callback, |
bool | initialNotify | ||
) |
Register a callback to be run when the PWM position changes.
callback | the callback |
initialNotify | whether to run the callback with the initial value |
std::unique_ptr< CallbackStore > frc::sim::PWMSim::RegisterPulseMicrosecondCallback | ( | NotifyCallback | callback, |
bool | initialNotify | ||
) |
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 |
std::unique_ptr< CallbackStore > frc::sim::PWMSim::RegisterSpeedCallback | ( | NotifyCallback | callback, |
bool | initialNotify | ||
) |
Register a callback to be run when the PWM speed changes.
callback | the callback |
initialNotify | whether to run the callback with the initial value |
std::unique_ptr< CallbackStore > frc::sim::PWMSim::RegisterZeroLatchCallback | ( | NotifyCallback | callback, |
bool | initialNotify | ||
) |
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 |