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 authored and Ramon Roche committed 2026-07-17 10:51:42 -05:00
1 parent ac14e4a93e
commit 0f78cd65a0
1 file changed
+6 -2
+6 -2
View File
@@ -185,8 +185,12 @@ void AutopilotTester::set_param_vt_fwd_thrust_en(int value)
void AutopilotTester::arm()
{
const auto result = _action->arm();
REQUIRE(result == Action::Result::Success);
// Even after wait_until_ready() passes, the is_armable health flag can
// 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()