From 790b60f02751073959a102cc4cdda40339d1b07c Mon Sep 17 00:00:00 2001 From: Balduin Date: Wed, 29 Jan 2025 15:36:55 +0100 Subject: [PATCH] mavsdk tests: use tester sleep function the original std::this_thread::sleep_for is with respect to host system time which is different from autopilot time if speed factor != 1, if some component runs slower than real time, or if debugging. tester.sleep_for (which already existed) correctly sleeps w.r.t. px4/simulation time. --- .../simulation/sensor_airspeed_sim/SensorAirspeedSim.cpp | 2 +- test/mavsdk_tests/autopilot_tester.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/simulation/sensor_airspeed_sim/SensorAirspeedSim.cpp b/src/modules/simulation/sensor_airspeed_sim/SensorAirspeedSim.cpp index e369a32818..6d3ee9d0c8 100644 --- a/src/modules/simulation/sensor_airspeed_sim/SensorAirspeedSim.cpp +++ b/src/modules/simulation/sensor_airspeed_sim/SensorAirspeedSim.cpp @@ -153,7 +153,7 @@ void SensorAirspeedSim::Run() if (_airspeed_blocked_timestamp > 0) { airspeed_blockage_scale = math::constrain(1.f - (hrt_absolute_time() - _airspeed_blocked_timestamp) / - airspeed_blockage_rampup_time, 1.f - blockage_fraction, 1.f); + airspeed_blockage_rampup_time, 1.f - blockage_fraction, 1.f); } diff --git a/test/mavsdk_tests/autopilot_tester.h b/test/mavsdk_tests/autopilot_tester.h index b0ac078d5d..8f57f68de1 100644 --- a/test/mavsdk_tests/autopilot_tester.h +++ b/test/mavsdk_tests/autopilot_tester.h @@ -283,7 +283,11 @@ private: } +<<<<<<< HEAD mavsdk::Mavsdk _mavsdk{Mavsdk::Configuration{ComponentType::GroundStation}}; +======= + mavsdk::Mavsdk _mavsdk{}; +>>>>>>> 5a03cfb986e (mavsdk tests: use tester sleep function) std::unique_ptr _action{}; std::unique_ptr _failure{}; std::unique_ptr _info{};