test(mavsdk): retry arming to tolerate transient is_armable flicker

wait_until_ready() polls MAVSDK's is_armable, but a known hysteresis gap
(and estimator heading-reference flicker at startup) means the flag can
read armable while PX4 then denies the arm command with 'no heading
reference'. This made arm() fail intermittently. Retry the arm command
until the autopilot accepts it, so the transient is absorbed while real
failures still time out.

Signed-off-by: Julian Oes <julian@oes.ch>
This commit is contained in:
Julian Oes
2026-07-16 08:52:49 +12:00
committed by Ramon Roche
parent ac14e4a93e
commit 0f78cd65a0

View File

@@ -185,8 +185,12 @@ void AutopilotTester::set_param_vt_fwd_thrust_en(int value)
void AutopilotTester::arm() void AutopilotTester::arm()
{ {
const auto result = _action->arm(); // Even after wait_until_ready() passes, the is_armable health flag can
REQUIRE(result == Action::Result::Success); // transiently flicker (e.g. the estimator's heading reference briefly
// dropping out during startup), causing the arm command to be denied.
// Retry until the autopilot actually accepts it.
REQUIRE(poll_condition_with_timeout(
[this]() { return _action->arm() == Action::Result::Success; }, std::chrono::seconds(30)));
} }
void AutopilotTester::takeoff() void AutopilotTester::takeoff()