From 412ad3344858d997435552b102a99776152610b6 Mon Sep 17 00:00:00 2001 From: Lokesh-Ramina Date: Thu, 21 Mar 2024 23:11:45 -0700 Subject: [PATCH] AP_Scripting: added QUIK_MAX_REDUCE parameter to VTOL-quicktune.lua this limits the amount that rate gains can reduce from the original values in a quicktune. Large reductions in rate gains can be incorrectly triggered by a frame resonance or gust of wind which can result in gains that are dangerously low, which can trigger an angle P oscillation SW-116 SW-131 --- libraries/AP_Scripting/applets/VTOL-quicktune.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Scripting/applets/VTOL-quicktune.lua b/libraries/AP_Scripting/applets/VTOL-quicktune.lua index 9f76241981..2381302705 100644 --- a/libraries/AP_Scripting/applets/VTOL-quicktune.lua +++ b/libraries/AP_Scripting/applets/VTOL-quicktune.lua @@ -404,6 +404,7 @@ end -- limit a gain change to QUIK_MAX_REDUCE function limit_gain(pname, value) + local P = params[pname] local saved_value = param_saved[pname] local max_reduction = QUIK_MAX_REDUCE:get() if max_reduction >= 0 and max_reduction < 100 and saved_value > 0 then @@ -590,7 +591,7 @@ function update() new_gain = 0.001 end adjust_gain_limited(pname, new_gain) - logger.write('QUIK','SRate,Gain,Param', 'ffn', srate, P:get(), axis .. stage) + logger:write('QUIK','SRate,Gain,Param', 'ffn', srate, P:get(), axis .. stage) if get_time() - last_gain_report > 3 then last_gain_report = get_time() gcs:send_text(MAV_SEVERITY_INFO, string.format("%s %.4f sr:%.2f", pname, new_gain, srate))