disable min loiter altitude

This commit is contained in:
ChristophTobler
2017-06-15 09:18:35 +02:00
committed by Dennis Mannhart
parent 1c56cad3b1
commit bc406a122e
4 changed files with 23 additions and 9 deletions
+11 -2
View File
@@ -1131,8 +1131,17 @@ Mission::do_abort_landing()
// loiter at the larger of MIS_LTRMIN_ALT above the landing point
// or 2 * FW_CLMBOUT_DIFF above the current altitude
float alt_landing = get_absolute_altitude_for_item(_mission_item);
float alt_sp = math::max(alt_landing + _param_loiter_min_alt.get(),
_navigator->get_global_position()->alt + (2 * _param_fw_climbout_diff.get()));
// ignore _param_loiter_min_alt if smaller then 0 (-1)
float alt_sp;
if (_param_loiter_min_alt.get() > 0.0f) {
alt_sp = math::max(alt_landing + _param_loiter_min_alt.get(),
_navigator->get_global_position()->alt + (2 * _param_fw_climbout_diff.get()));
} else {
alt_sp = math::max(alt_landing, _navigator->get_global_position()->alt + (2 * _param_fw_climbout_diff.get()));
}
_mission_item.nav_cmd = NAV_CMD_LOITER_UNLIMITED;
_mission_item.altitude_is_relative = false;
+8 -2
View File
@@ -571,9 +571,15 @@ MissionBlock::mission_item_to_position_setpoint(const struct mission_item_s *ite
break;
case NAV_CMD_LOITER_TO_ALT:
// initially use current altitude, and switch to mission item altitude once in loiter position
sp->alt = math::max(_navigator->get_global_position()->alt,
_navigator->get_home_position()->alt + _param_loiter_min_alt.get());
if (_param_loiter_min_alt.get() > 0.0f) { // ignore _param_loiter_min_alt if smaller then 0 (-1)
sp->alt = math::max(_navigator->get_global_position()->alt,
_navigator->get_home_position()->alt + _param_loiter_min_alt.get());
} else {
sp->alt = _navigator->get_global_position()->alt;
}
// fall through
case NAV_CMD_LOITER_TIME_LIMIT:
+3 -2
View File
@@ -61,15 +61,16 @@ PARAM_DEFINE_FLOAT(MIS_TAKEOFF_ALT, 2.5f);
* Minimum Loiter altitude
*
* This is the minimum altitude the system will always obey. The intent is to stay out of ground effect.
* set to -1, if there shouldn't be a minimum loiter altitude
*
* @unit m
* @min 0
* @min -1
* @max 80
* @decimal 1
* @increment 0.5
* @group Mission
*/
PARAM_DEFINE_FLOAT(MIS_LTRMIN_ALT, 1.2f);
PARAM_DEFINE_FLOAT(MIS_LTRMIN_ALT, -1.0f);
/**
* Persistent onboard mission storage