ui: expose lateral control learning state (#35519)

* add lagd

* add live torque params

* clean up

* too many openpilot is's

* add back

* fix weird pattern causing segfault

* cu

* 10 more lines for "all complete"

* Revert "10 more lines for "all complete""

This reverts commit de1ad0b7386f4c5d9967ea733edbe5bf1df5039c.

* one line
This commit is contained in:
Shane Smiskol
2025-06-10 01:48:46 -07:00
committed by GitHub
parent a9e8649137
commit c1794e6f83
+41 -4
View File
@@ -298,9 +298,7 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
}
void DevicePanel::updateCalibDescription() {
QString desc =
tr("openpilot requires the device to be mounted within 4° left or right and "
"within 5° up or 9° down. openpilot is continuously calibrating, resetting is rarely required.");
QString desc = tr("\nopenpilot requires the device to be mounted within 4° left or right and within 5° up or 9° down.");
std::string calib_bytes = params.get("CalibrationParams");
if (!calib_bytes.empty()) {
try {
@@ -318,7 +316,46 @@ void DevicePanel::updateCalibDescription() {
qInfo() << "invalid CalibrationParams";
}
}
desc += tr(" Resetting calibration will restart openpilot if the car is powered on.");
int lag_perc = 0;
std::string lag_bytes = params.get("LiveDelay");
if (!lag_bytes.empty()) {
try {
AlignedBuffer aligned_buf;
capnp::FlatArrayMessageReader cmsg(aligned_buf.align(lag_bytes.data(), lag_bytes.size()));
lag_perc = cmsg.getRoot<cereal::Event>().getLiveDelay().getCalPerc();
} catch (kj::Exception) {
qInfo() << "invalid LiveDelay";
}
}
if (lag_perc < 100) {
desc += tr("\n\nSteering lag calibration is %1% complete.").arg(lag_perc);
} else {
desc += tr("\n\nSteering lag calibration is complete.");
}
std::string torque_bytes = params.get("LiveTorqueParameters");
if (!torque_bytes.empty()) {
try {
AlignedBuffer aligned_buf;
capnp::FlatArrayMessageReader cmsg(aligned_buf.align(torque_bytes.data(), torque_bytes.size()));
auto torque = cmsg.getRoot<cereal::Event>().getLiveTorqueParameters();
// don't add for non-torque cars
if (torque.getUseParams()) {
int torque_perc = torque.getCalPerc();
if (torque_perc < 100) {
desc += tr(" Steering torque response calibration is %1% complete.").arg(torque_perc);
} else {
desc += tr(" Steering torque response calibration is complete.");
}
}
} catch (kj::Exception) {
qInfo() << "invalid LiveTorqueParameters";
}
}
desc += tr("\n\nopenpilot is continuously calibrating, resetting is rarely required. "
"Resetting calibration will restart openpilot if the car is powered on.");
resetCalibBtn->setDescription(desc);
}