mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-07-24 15:27:41 +08:00
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user