mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[sysid] Error on missing tests in loaded DataLog (#7747)
* add exception
* detect missing tests
* throw in analyzer
* define tests setter
* change to std::map
* alignas fail
* make missingTests parameter const&
* const& impl
* use set and naive comparison
* use default comparison
* add <utility>
* Revert "alignas fail"
This reverts commit 5e97940f34.
* indent validtests
* format
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <numbers>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <glass/Context.h>
|
||||
@@ -251,6 +252,13 @@ void Analyzer::Display() {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AnalyzerState::kMissingTestsError: {
|
||||
CreateErrorPopup(m_errorPopup, m_exception);
|
||||
if (!m_errorPopup) {
|
||||
m_state = AnalyzerState::kWaitingForData;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AnalyzerState::kGeneralDataError:
|
||||
case AnalyzerState::kTestDurationError:
|
||||
case AnalyzerState::kVelocityThresholdError: {
|
||||
@@ -269,6 +277,9 @@ void Analyzer::Display() {
|
||||
void Analyzer::PrepareData() {
|
||||
WPI_INFO(m_logger, "{}", "Preparing data");
|
||||
try {
|
||||
if (m_missingTests.size() > 0) {
|
||||
throw sysid::MissingTestsError{m_missingTests};
|
||||
}
|
||||
m_manager->PrepareData();
|
||||
UpdateFeedforwardGains();
|
||||
UpdateFeedbackGains();
|
||||
@@ -281,6 +292,9 @@ void Analyzer::PrepareData() {
|
||||
} catch (const sysid::NoDynamicDataError& e) {
|
||||
m_state = AnalyzerState::kTestDurationError;
|
||||
HandleError(e.what());
|
||||
} catch (const sysid::MissingTestsError& e) {
|
||||
m_state = AnalyzerState::kMissingTestsError;
|
||||
HandleError(e.what());
|
||||
} catch (const AnalysisManager::FileReadingError& e) {
|
||||
m_state = AnalyzerState::kFileError;
|
||||
HandleError(e.what());
|
||||
@@ -324,6 +338,10 @@ void Analyzer::HandleError(std::string_view msg) {
|
||||
PrepareRawGraphs();
|
||||
}
|
||||
|
||||
void Analyzer::SetMissingTests(const std::vector<std::string>& missingTests) {
|
||||
m_missingTests = missingTests;
|
||||
}
|
||||
|
||||
void Analyzer::DisplayGraphs() {
|
||||
ImGui::SetNextWindowPos(ImVec2{kDiagnosticPlotWindowPos},
|
||||
ImGuiCond_FirstUseEver);
|
||||
|
||||
Reference in New Issue
Block a user