add a debug print to the PID update function
This commit is contained in:
24
main.lua
24
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
|
||||
|
||||
Reference in New Issue
Block a user