mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-12 20:40:34 +08:00
commander: enable user override when GPS is lost
When user override using the RC sticks is allowed, I would expect this feature to also work in the case where GPS is lost and the vehicle goes into a blind land/descent. Without this commit, the vehicle would switch to Land mode and a pilot could not take over control unless they switch to Altitude control in a ground station. With this commit, user override works as I would expect it and it will switch to Altitude control allowing a pilot to recover in this situation.
This commit is contained in:
@@ -2279,11 +2279,17 @@ Commander::run()
|
||||
// abort autonomous mode and switch to position mode if sticks are moved significantly
|
||||
if ((_status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING)
|
||||
&& !in_low_battery_failsafe && !_geofence_warning_action_on
|
||||
&& _manual_control.wantsOverride(_vehicle_control_mode)) {
|
||||
&& _manual_control.wantsOverride(_vehicle_control_mode, _status)) {
|
||||
if (main_state_transition(_status, commander_state_s::MAIN_STATE_POSCTL, _status_flags,
|
||||
_internal_state) == TRANSITION_CHANGED) {
|
||||
tune_positive(true);
|
||||
mavlink_log_info(&_mavlink_log_pub, "Pilot took over control using sticks");
|
||||
mavlink_log_info(&_mavlink_log_pub, "Pilot took over position control using sticks");
|
||||
_status_changed = true;
|
||||
|
||||
} else if (main_state_transition(_status, commander_state_s::MAIN_STATE_ALTCTL, _status_flags,
|
||||
_internal_state) == TRANSITION_CHANGED) {
|
||||
tune_positive(true);
|
||||
mavlink_log_info(&_mavlink_log_pub, "Pilot took over altitude control using sticks");
|
||||
_status_changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user