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:
Julian Oes
2021-06-15 09:35:46 +02:00
committed by Lorenz Meier
parent 749f213ca5
commit 8415692f2a
3 changed files with 16 additions and 5 deletions
+8 -2
View File
@@ -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;
}
}