From 056c10c3468f2d81d0e19cc5412bba8e82e31e6c Mon Sep 17 00:00:00 2001 From: templeofshadow Date: Mon, 29 Jun 2026 23:47:45 -0500 Subject: [PATCH] add a debug print to the PID update function --- main.lua | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/main.lua b/main.lua index 5a300d8..0c74253 100644 --- a/main.lua +++ b/main.lua @@ -876,6 +876,8 @@ function CreatePID(kp, ki, kd) local raw_output = P + potential_i + D + if Config.Debug then print("DEBUG: PID raw output: "..raw_output) end + local clampedOutput = 0 if self.minOutput <= potential_i and potential_i <= self.maxOutput then @@ -919,28 +921,6 @@ PIDs = { ForeAftRatePID = CreatePID(0.1, 0.01, 0.05) } -local function createRollingAverage(window) - local buffer = {} - local index = 0 - local count = 0 - local sum = 0 - - return function(new_value) - index = (index % window) + 1 - - if buffer[index] then - sum = sum - buffer[index] - else - count = count + 1 - end - - buffer[index] = new_value - sum = sum + new_value - - return sum / count - end -end - -- min and max thrust for thrust normalization local minThrust = math.huge local maxThrust = -math.huge