[glass] Add Profiled PID controller support & IZone Support (#5959)

This commit is contained in:
m10653
2023-12-22 14:29:25 -05:00
committed by GitHub
parent bcef6c5398
commit 43fb6e9f87
11 changed files with 303 additions and 2 deletions

View File

@@ -409,7 +409,16 @@ public class PIDController implements Sendable, AutoCloseable {
builder.addDoubleProperty("p", this::getP, this::setP);
builder.addDoubleProperty("i", this::getI, this::setI);
builder.addDoubleProperty("d", this::getD, this::setD);
builder.addDoubleProperty("izone", this::getIZone, this::setIZone);
builder.addDoubleProperty(
"izone",
this::getIZone,
(double toSet) -> {
try {
setIZone(toSet);
} catch (IllegalArgumentException e) {
MathSharedStore.reportError("IZone must be a non-negative number!", e.getStackTrace());
}
});
builder.addDoubleProperty("setpoint", this::getSetpoint, this::setSetpoint);
}
}

View File

@@ -426,7 +426,16 @@ public class ProfiledPIDController implements Sendable {
builder.addDoubleProperty("p", this::getP, this::setP);
builder.addDoubleProperty("i", this::getI, this::setI);
builder.addDoubleProperty("d", this::getD, this::setD);
builder.addDoubleProperty("izone", this::getIZone, this::setIZone);
builder.addDoubleProperty(
"izone",
this::getIZone,
(double toSet) -> {
try {
setIZone(toSet);
} catch (IllegalArgumentException e) {
MathSharedStore.reportError("IZone must be a non-negative number!", e.getStackTrace());
}
});
builder.addDoubleProperty("goal", () -> getGoal().position, this::setGoal);
}
}