[wpimath] Add constraints support to ProfiledPIDController Sendable implementation (#6354)

This commit is contained in:
Ryan Blue
2024-05-24 13:39:56 -04:00
committed by GitHub
parent badd090538
commit 65f4505e3c
6 changed files with 87 additions and 17 deletions

View File

@@ -404,6 +404,19 @@ class ProfiledPIDController
builder.AddDoubleProperty(
"izone", [this] { return GetIZone(); },
[this](double value) { SetIZone(value); });
builder.AddDoubleProperty(
"maxVelocity", [this] { return GetConstraints().maxVelocity.value(); },
[this](double value) {
SetConstraints(
Constraints{Velocity_t{value}, GetConstraints().maxAcceleration});
});
builder.AddDoubleProperty(
"maxAcceleration",
[this] { return GetConstraints().maxAcceleration.value(); },
[this](double value) {
SetConstraints(
Constraints{GetConstraints().maxVelocity, Acceleration_t{value}});
});
builder.AddDoubleProperty(
"goal", [this] { return GetGoal().position.value(); },
[this](double value) { SetGoal(Distance_t{value}); });