FlightTasks: add Descend task to land without GPS

This adds a flight task to catch the case where we want to do an
emergency descent without GPS but only a baro.

Previously, this would lead to the navigator land class being called
without position estimates which then made the flight tasks fail and
react with a flight task failsafe. This however meant that landed was
never detected and a couple of confusing error messages.

This applies if NAV_RCL_ACT is set to 3 "land".
This commit is contained in:
Julian Oes
2019-10-18 16:18:19 +02:00
parent 5f53ae1253
commit de90543d6f
7 changed files with 184 additions and 7 deletions
@@ -845,6 +845,28 @@ MulticopterPositionControl::start_flight_task()
// we want to be in this mode, reset the failure count
_task_failure_count = 0;
}
} else if (_vehicle_status.nav_state == vehicle_status_s::NAVIGATION_STATE_DESCEND) {
// Emergency descend
should_disable_task = false;
FlightTaskError error = FlightTaskError::NoError;
error = _flight_tasks.switchTask(FlightTaskIndex::Descend);
if (error != FlightTaskError::NoError) {
if (prev_failure_count == 0) {
PX4_WARN("Descend activation failed with error: %s", _flight_tasks.errorToString(error));
}
task_failure = true;
_task_failure_count++;
} else {
// we want to be in this mode, reset the failure count
_task_failure_count = 0;
}
}
// manual position control