From 69d20ac53984a106dfbfe478d6d047af4556db0d Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Thu, 28 Sep 2023 23:41:07 -0700 Subject: [PATCH] Don't display LQR tolerance units in theoretical mode Fixes #399. --- .../src/main/native/cpp/view/Analyzer.cpp | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/sysid-application/src/main/native/cpp/view/Analyzer.cpp b/sysid-application/src/main/native/cpp/view/Analyzer.cpp index 2b6b1884..b42cd2a7 100644 --- a/sysid-application/src/main/native/cpp/view/Analyzer.cpp +++ b/sysid-application/src/main/native/cpp/view/Analyzer.cpp @@ -815,13 +815,16 @@ void Analyzer::DisplayFeedbackGains() { // Come back to the starting y pos. ImGui::SetCursorPosY(beginY); - std::string_view abbreviation = GetAbbreviation(m_manager->GetUnit()); - if (m_selectedLoopType == 0) { ImGui::SetCursorPosX(ImGui::GetFontSize() * 9); - if (DisplayGain( - fmt::format("Max Position Error ({})", abbreviation).c_str(), - &m_settings.lqr.qp, false)) { + + std::string unit; + if (m_state != AnalyzerState::kWaitingForJSON) { + unit = fmt::format(" ({})", GetAbbreviation(m_manager->GetUnit())); + } + + if (DisplayGain(fmt::format("Max Position Error{}", unit).c_str(), + &m_settings.lqr.qp, false)) { if (m_settings.lqr.qp > 0) { UpdateFeedbackGains(); } @@ -829,9 +832,14 @@ void Analyzer::DisplayFeedbackGains() { } ImGui::SetCursorPosX(ImGui::GetFontSize() * 9); - if (DisplayGain( - fmt::format("Max Velocity Error ({}/s)", abbreviation).c_str(), - &m_settings.lqr.qv, false)) { + + std::string unit; + if (m_state != AnalyzerState::kWaitingForJSON) { + unit = fmt::format(" ({}/s)", GetAbbreviation(m_manager->GetUnit())); + } + + if (DisplayGain(fmt::format("Max Velocity Error{}", unit).c_str(), + &m_settings.lqr.qv, false)) { if (m_settings.lqr.qv > 0) { UpdateFeedbackGains(); }