From 5f2abb66a49340d030147e82b4c99cdc40dce899 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 15 Jul 2020 13:47:22 +0200 Subject: [PATCH] mavsdk_tests: add workaround to prevent failsafe This workaround should fix the test failure where we disarm before taking off because we accidentally switched to failsafe mode right before taking off because we were still in Manual mode and not Hold yet. --- test/mavsdk_tests/autopilot_tester.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/mavsdk_tests/autopilot_tester.cpp b/test/mavsdk_tests/autopilot_tester.cpp index 4ddf82c72e..e032df2a1e 100644 --- a/test/mavsdk_tests/autopilot_tester.cpp +++ b/test/mavsdk_tests/autopilot_tester.cpp @@ -112,6 +112,11 @@ void AutopilotTester::wait_until_ready() std::cout << "Waiting for system to be ready" << std::endl; CHECK(poll_condition_with_timeout( [this]() { return _telemetry->health_all_ok(); }, std::chrono::seconds(20))); + + // FIXME: workaround to prevent race between PX4 switching to Hold mode + // and us trying to arm and take off. If PX4 is not in Hold mode yet, + // our arming presumably triggers a failsafe in manual mode. + std::this_thread::sleep_for(std::chrono::seconds(1)); } void AutopilotTester::wait_until_ready_local_position_only()