mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-15 08:50:34 +08:00
fix commander: handle mode executor correctly on disarm
There were a number of cases where the state was not correct or not as desired after disarming, when running an external mode 'MyMission' with executor: - run MyMission, which triggers Hold, then Land - before: Mode: Hold, executor_in_charge: 1 - after: Mode: MyMission, executor_in_charge: 1 - run MyMission, then user switches to RTL - before: Mode: MyMission, executor_in_charge: 0 - after: Mode: MyMission, executor_in_charge: 1 - run MyMission, then while in Hold mode, low battery failsafe (RTL) - before: Mode: Hold, executor_in_charge: 1 - after: Mode: MyMission, executor_in_charge: 1 - run MyMission, then stop external mode (terminate the process) - before: Mode: (mode not available), executor_in_charge: 0 - after: Mode: Hold, executor_in_charge: 0 This case is unchanged: - run MyMission, then low battery failsafe (RTL) - before: Mode: MyMission, executor_in_charge: 1 - after: Mode: MyMission, executor_in_charge: 1
This commit is contained in:
@@ -92,5 +92,10 @@ bool UserModeIntention::change(uint8_t user_intended_nav_state, ModeChangeSource
|
||||
|
||||
void UserModeIntention::onDisarm()
|
||||
{
|
||||
_user_intented_nav_state = _nav_state_after_disarming;
|
||||
if (_handler) {
|
||||
_user_intented_nav_state = _handler->onDisarm(_nav_state_after_disarming);
|
||||
|
||||
} else {
|
||||
_user_intented_nav_state = _nav_state_after_disarming;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user