have UpdateGlobalThrust attempt to counteract the actual pitch/roll instead of the pitch/roll rates

This commit is contained in:
2026-06-29 21:01:46 -05:00
parent 485c2eac37
commit 1ab0510826

View File

@@ -847,10 +847,16 @@ function UpdateGlobalThrust()
end
local throttleOutput = PIDs.AltitudePID:update(Config.Autopilot.AutopilotDesiredAltitude or 0, SensorData.Altitude.Altitude or 0, dt)
local pitchOutput = PIDs.PitchAttitudePID:update(0, SensorData.Gimbal.Angles.xAngle, dt)
local rollOutput = PIDs.RollAttitudePID:update(0, SensorData.Gimbal.Angles.zAngle, dt)
local yawOutput = PIDs.YawAttitudePID:update(Config.Autopilot.AutopilotDesiredHeading or 0, SensorData.NavTable.Heading, dt)
local pitchRateOutput = PIDs.PitchRatePID:update(Config.Autopilot.AutopilotDesiredPitchRate or 0, SensorData.Gimbal.AngularRates.wx or 0, dt)
local rollRateOutput = PIDs.RollRatePID:update(Config.Autopilot.AutopilotDesiredRollRate or 0, SensorData.Gimbal.AngularRates.wz or 0, dt)
local yawRateOutput = PIDs.YawRatePID:update(Config.Autopilot.AutopilotDesiredYawRate or 0, SensorData.Gimbal.AngularRates.wy or 0, dt)
local pitchOutput = PIDs.PitchRatePID:update(Config.Autopilot.AutopilotDesiredPitchRate or 0, SensorData.Gimbal.AngularRates.wx or 0, dt)
local rollOutput = PIDs.RollRatePID:update(Config.Autopilot.AutopilotDesiredRollRate or 0, SensorData.Gimbal.AngularRates.wz or 0, dt)
local yawOutput = PIDs.YawRatePID:update(Config.Autopilot.AutopilotDesiredYawRate or 0, SensorData.Gimbal.AngularRates.wy or 0, dt)
for _, thruster in pairs(Thrusters) do
@@ -858,13 +864,13 @@ function UpdateGlobalThrust()
-- Calculate desired thrust based on affectVectors and PID outputs
if thruster.affectVectors.angular.pitch ~= nil and thruster.primary_pitch_thruster then
desiredThrust = desiredThrust + pitchOutput
desiredThrust = desiredThrust + pitchOutput + pitchRateOutput
end
if thruster.affectVectors.angular.roll ~= nil and thruster.primary_roll_thruster then
desiredThrust = desiredThrust + rollOutput
desiredThrust = desiredThrust + rollOutput + rollRateOutput
end
if thruster.affectVectors.angular.yaw ~= nil and thruster.primary_yaw_thruster then
desiredThrust = desiredThrust + yawOutput
desiredThrust = desiredThrust + yawRateOutput
end
if thruster.affectVectors.lateral.y == "up" then