[hal] Unify PWM simulation Speed, Position, and Raw (#5277)

Setting one will set the others, like it does in real hardware.
Add tests for boundary conditions and conversions.
Update PWM sendable implementation to include all forms.
Fixes #5264
Fixes #3606
This commit is contained in:
sciencewhiz
2023-07-09 21:28:50 -07:00
committed by GitHub
parent fd5699b240
commit f8e74e2f7c
5 changed files with 283 additions and 22 deletions

View File

@@ -180,4 +180,10 @@ void PWM::InitSendable(wpi::SendableBuilder& builder) {
builder.AddDoubleProperty(
"Value", [=, this] { return GetPulseTime().value(); },
[=, this](double value) { SetPulseTime(units::millisecond_t{value}); });
builder.AddDoubleProperty(
"Speed", [=, this] { return GetSpeed(); },
[=, this](double value) { SetSpeed(value); });
builder.AddDoubleProperty(
"Position", [=, this] { return GetPosition(); },
[=, this](double value) { SetPosition(value); });
}