navigator treat TAKEOFF like POSITION if already flying

This commit is contained in:
Daniel Agar
2017-04-17 11:03:34 -04:00
committed by Julian Oes
parent 304aeddf03
commit 809fec8c05
+15 -3
View File
@@ -542,10 +542,22 @@ MissionBlock::mission_item_to_position_setpoint(const struct mission_item_s *ite
break;
case NAV_CMD_TAKEOFF:
// set pitch and ensure that the hold time is zero
sp->pitch_min = item->pitch_min;
// fall through
// if already flying (armed and !landed) treat TAKEOFF like regular POSITION
if ((_navigator->get_vstatus()->arming_state == vehicle_status_s::ARMING_STATE_ARMED)
&& !_navigator->get_land_detected()->landed) {
sp->type = position_setpoint_s::SETPOINT_TYPE_POSITION;
} else {
sp->type = position_setpoint_s::SETPOINT_TYPE_TAKEOFF;
// set pitch and ensure that the hold time is zero
sp->pitch_min = item->pitch_min;
}
break;
case NAV_CMD_VTOL_TAKEOFF:
sp->type = position_setpoint_s::SETPOINT_TYPE_TAKEOFF;