Navigator: add terrain collision avoidance logic for Mission/RTL

Avoid flying into terrain using the distance sensor.
Enable through the parameter NAV_MIN_GND_DIST.
Only active during commanded descents with vz>0 (to prevent climb-aways),
excluding landing and VTOL transitions.
It changes the altitude setpoint in the triplet to maintain the current altitude
and republish the triplet. We also change the mission item altitude used for
acceptance calculations to prevent getting stuck in a loop.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer
2024-07-19 11:25:56 +02:00
parent b74e46b1ac
commit 75ce550db3
7 changed files with 69 additions and 0 deletions
+5
View File
@@ -104,6 +104,11 @@ void RtlDirect::on_active()
set_rtl_item();
}
if (_rtl_state == RTLState::LOITER_HOLD) { //TODO: rename _rtl_state to _rtl_state_next
//check for terrain collision and update altitude if needed
updateAltToAvoidTerrainCollisionAndRepublishTriplet(_mission_item);
}
if (_rtl_state == RTLState::LAND && _param_rtl_pld_md.get() > 0) {
// Need to update the position and type on the current setpoint triplet.
_navigator->get_precland()->on_active();