From 22cad6ebf706b6827b777ce1c63e24f138ba7bb9 Mon Sep 17 00:00:00 2001 From: ttechnick Date: Fri, 13 Mar 2026 13:50:26 +0100 Subject: [PATCH] fix(fw_att_control): guard against 0 in param --- src/modules/fw_att_control/CMakeLists.txt | 2 +- src/modules/fw_att_control/FixedwingAttitudeControl.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/fw_att_control/CMakeLists.txt b/src/modules/fw_att_control/CMakeLists.txt index 749519f9b9..f3f9b458c5 100644 --- a/src/modules/fw_att_control/CMakeLists.txt +++ b/src/modules/fw_att_control/CMakeLists.txt @@ -43,4 +43,4 @@ px4_add_module( px4_work_queue ) -px4_add_unit_gtest(SRC FixedwingAttitudeControlTest.cpp) +px4_add_unit_gtest(SRC FixedwingAttitudeControlTest.cpp LINKLIBS modules__fw_att_control) diff --git a/src/modules/fw_att_control/FixedwingAttitudeControl.cpp b/src/modules/fw_att_control/FixedwingAttitudeControl.cpp index 6ddf57e49f..9323aca6fd 100644 --- a/src/modules/fw_att_control/FixedwingAttitudeControl.cpp +++ b/src/modules/fw_att_control/FixedwingAttitudeControl.cpp @@ -74,8 +74,8 @@ FixedwingAttitudeControl::init() void FixedwingAttitudeControl::parameters_update() { - _proportional_gain = matrix::Vector3f(1.0f / _param_fw_r_tc.get(), - 1.0f / _param_fw_p_tc.get(), + _proportional_gain = matrix::Vector3f(1.0f / math::max(0.01f, _param_fw_r_tc.get()), + 1.0f / math::max(0.01f, _param_fw_p_tc.get()), 1.0f); _wheel_ctrl.set_k_p(_param_fw_wr_p.get());