Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sysid] Filter valid test names #6200

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions sysid/src/main/native/cpp/view/DataSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,31 @@ void DataSelector::Display() {
if (m_testsFuture.valid() &&
m_testsFuture.wait_for(0s) == std::future_status::ready) {
m_tests = m_testsFuture.get();
for (auto it = m_tests.begin(); it != m_tests.end();) {
if (it->first != "quasistatic" && it->first != "dynamic") {
WPI_WARNING(m_logger, "Unrecognized test {}, removing", it->first);
it = m_tests.erase(it);
continue;
}
for (auto it2 = it->second.begin(); it2 != it->second.end();) {
auto direction = wpi::rsplit(it2->first, '-').second;
if (direction != "forward" && direction != "reverse") {
WPI_WARNING(m_logger, "Unrecognized direction {}, removing",
direction);
it2 = it->second.erase(it2);
continue;
}
WPI_INFO(m_logger, "Loaded test state {}", it2->first);
++it2;
}
if (it->second.empty()) {
WPI_WARNING(m_logger, "No data for test {}, removing", it->first);
it = m_tests.erase(it);
continue;
}
++it;
}
WPI_INFO(m_logger, "Loaded {} tests", m_tests.size());
}

if (m_tests.empty()) {
Expand Down
4 changes: 2 additions & 2 deletions sysid/src/main/native/include/sysid/view/DataSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class DataSelector : public glass::View {
* @param logger The program logger
*/
explicit DataSelector(glass::Storage& storage, wpi::Logger& logger)
/*: m_logger{logger}*/ {}
: m_logger{logger} {}

/**
* Displays the log loader window.
Expand All @@ -57,7 +57,7 @@ class DataSelector : public glass::View {
std::function<void(TestData)> testdata;

private:
// wpi::Logger& m_logger;
wpi::Logger& m_logger;
using Runs = std::vector<std::pair<int64_t, int64_t>>;
using State = std::map<std::string, Runs, std::less<>>; // full name
using Tests = std::map<std::string, State, std::less<>>; // e.g. "dynamic"
Expand Down