mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-28 09:40:36 +08:00
navigator: do not set a mode while disarmed
This avoids premature state machine execution, most notably for missions. In particular this fixes these issues: - when landed, and the vehicle has a valid mission: switching to mission would execute the first item. - after executing a mission with a land waypoint, the mission is reset and the first item is executed. In case the first waypoint is a takeoff, it would print a user message: "Takeoff to x meters above home.". If it was a vehicle command, it would execute that. Note that because the vehicle is disarmed, the vehicle would not actually do anything (except for commands that are accepted while disarmed).
This commit is contained in:
@@ -647,6 +647,11 @@ Navigator::run()
|
||||
break;
|
||||
}
|
||||
|
||||
// Do not execute any state machine while we are disarmed
|
||||
if (_vstatus.arming_state != vehicle_status_s::ARMING_STATE_ARMED) {
|
||||
navigation_mode_new = nullptr;
|
||||
}
|
||||
|
||||
// update the vehicle status
|
||||
_previous_nav_state = _vstatus.nav_state;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user