From 34cb69898e8b2757223554890a5012d12bd0f110 Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Thu, 25 Apr 2024 16:35:01 +0200 Subject: [PATCH] FW Position Controller: fix Altitude mode without valid z reference (e.g. no GPS) Signed-off-by: Silvan Fuhrer --- src/modules/fw_pos_control/FixedwingPositionControl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/fw_pos_control/FixedwingPositionControl.cpp b/src/modules/fw_pos_control/FixedwingPositionControl.cpp index 35a3c32c7df8..c4ce648381ad 100644 --- a/src/modules/fw_pos_control/FixedwingPositionControl.cpp +++ b/src/modules/fw_pos_control/FixedwingPositionControl.cpp @@ -2304,7 +2304,7 @@ FixedwingPositionControl::Run() _reference_altitude = 0.f; } - _current_altitude = -_local_pos.z + _local_pos.ref_alt; // Altitude AMSL in meters + _current_altitude = -_local_pos.z + _reference_altitude; // Altitude AMSL in meters // handle estimator reset events. we only adjust setpoins for manual modes if (_control_mode.flag_control_manual_enabled) {