[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

@@ -52,15 +52,25 @@ void glass::DisplayProfiledPIDController(ProfiledPIDControllerModel* m) {
double value = d->GetValue();
createTuningParameter("D", &value, [=](auto v) { m->SetD(v); });
}
if (auto s = m->GetGoalData()) {
double value = s->GetValue();
createTuningParameter("Goal", &value, [=](auto v) { m->SetGoal(v); });
}
if (auto s = m->GetIZoneData()) {
double value = s->GetValue();
createTuningParameterNoFilter("IZone", &value,
[=](auto v) { m->SetIZone(v); });
}
if (auto s = m->GetMaxVelocityData()) {
double value = s->GetValue();
createTuningParameter("Max Velocity", &value,
[=](auto v) { m->SetMaxVelocity(v); });
}
if (auto s = m->GetMaxAccelerationData()) {
double value = s->GetValue();
createTuningParameter("Max Acceleration", &value,
[=](auto v) { m->SetMaxAcceleration(v); });
}
if (auto s = m->GetGoalData()) {
double value = s->GetValue();
createTuningParameter("Goal", &value, [=](auto v) { m->SetGoal(v); });
}
} else {
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(96, 96, 96, 255));
ImGui::Text("Unknown PID Controller");