mc_pos_control: support VTOL transitions again

Signed-off-by: Roman <bapstroman@gmail.com>
This commit is contained in:
Roman 2018-10-27 09:05:10 +02:00 committed by Lorenz Meier
parent fea309b606
commit 50724bce86
1 changed files with 21 additions and 0 deletions

View File

@ -813,6 +813,27 @@ MulticopterPositionControl::start_flight_task()
bool task_failure = false;
int prev_failure_count = _task_failure_count;
if (!_vehicle_status.is_rotary_wing) {
_flight_tasks.switchTask(FlightTaskIndex::None);
return;
}
if (_vehicle_status.in_transition_mode) {
int error = _flight_tasks.switchTask(FlightTaskIndex::Transition);
if (error != 0) {
PX4_WARN("Follow-Me 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;
}
return;
}
// offboard
if (_vehicle_status.nav_state == vehicle_status_s::NAVIGATION_STATE_OFFBOARD
&& (_control_mode.flag_control_altitude_enabled ||