[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

@@ -444,6 +444,18 @@ public class ProfiledPIDController implements Sendable {
MathSharedStore.reportError("IZone must be a non-negative number!", e.getStackTrace());
}
});
builder.addDoubleProperty(
"maxVelocity",
() -> getConstraints().maxVelocity,
maxVelocity ->
setConstraints(
new TrapezoidProfile.Constraints(maxVelocity, getConstraints().maxAcceleration)));
builder.addDoubleProperty(
"maxAcceleration",
() -> getConstraints().maxAcceleration,
maxAcceleration ->
setConstraints(
new TrapezoidProfile.Constraints(getConstraints().maxVelocity, maxAcceleration)));
builder.addDoubleProperty("goal", () -> getGoal().position, this::setGoal);
}
}