From 5397aa7c6ed20a7672a58fb86c8859eb91ecaa2f Mon Sep 17 00:00:00 2001 From: NoRePercussions Date: Tue, 7 Feb 2023 21:22:22 -0500 Subject: [PATCH] Fix: make more universally buildable OkapiLib did not build on all systems due to not-officially-supported idioms and by referencing some attributes of high_resolution_clock. --- include/okapi/api/units/RQuantityName.hpp | 1 + include/test/tests/api/implMocks.hpp | 2 +- src/api/chassis/controller/defaultOdomChassisController.cpp | 4 +++- test/implMocks.cpp | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/okapi/api/units/RQuantityName.hpp b/include/okapi/api/units/RQuantityName.hpp index 28e629846..ad7a17416 100644 --- a/include/okapi/api/units/RQuantityName.hpp +++ b/include/okapi/api/units/RQuantityName.hpp @@ -2,6 +2,7 @@ #include "okapi/api/units/QLength.hpp" #include "okapi/api/units/QSpeed.hpp" #include +#include #include #include diff --git a/include/test/tests/api/implMocks.hpp b/include/test/tests/api/implMocks.hpp index ee5841811..34943fb86 100644 --- a/include/test/tests/api/implMocks.hpp +++ b/include/test/tests/api/implMocks.hpp @@ -251,7 +251,7 @@ class MockTimer : public AbstractTimer { QTime millis() const override; - std::chrono::system_clock::time_point epoch = std::chrono::high_resolution_clock::from_time_t(0); + std::chrono::system_clock::time_point epoch = std::chrono::system_clock::from_time_t(0); }; /** diff --git a/src/api/chassis/controller/defaultOdomChassisController.cpp b/src/api/chassis/controller/defaultOdomChassisController.cpp index ed95a7df4..a28c9e4d8 100644 --- a/src/api/chassis/controller/defaultOdomChassisController.cpp +++ b/src/api/chassis/controller/defaultOdomChassisController.cpp @@ -39,7 +39,9 @@ void DefaultOdomChassisController::driveToPoint(const Point &ipoint, const QLength &ioffset) { waitForOdomTask(); - auto [length, angle] = OdomMath::computeDistanceAndAngleToPoint( + QLength length; + QAngle angle; + std::tie(length, angle) = OdomMath::computeDistanceAndAngleToPoint( ipoint.inFT(defaultStateMode), odom->getState(StateMode::FRAME_TRANSFORMATION)); if (ibackwards) { diff --git a/test/implMocks.cpp b/test/implMocks.cpp index e7737fbbe..beb3d4df2 100644 --- a/test/implMocks.cpp +++ b/test/implMocks.cpp @@ -192,7 +192,7 @@ MockTimer::MockTimer() : AbstractTimer(millis()) { QTime MockTimer::millis() const { return std::chrono::duration_cast( - std::chrono::high_resolution_clock::now() - epoch) + std::chrono::system_clock::now() - epoch) .count() * millisecond; }