add nil check for main SensorData subtables (but not values in those subtables)
This commit is contained in:
4
main.lua
4
main.lua
@@ -771,6 +771,10 @@ function UpdateGlobalThrust()
|
|||||||
|
|
||||||
local dt = GetDeltaTime()
|
local dt = GetDeltaTime()
|
||||||
|
|
||||||
|
if SensorData.Gimbal == nil or SensorData.Altitude == nil or SensorData.Velocity == nil then
|
||||||
|
print("ERROR: One or more of SensorData is nil. Cannot update thrust.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local throttleOutput = PIDs.AltitudePID:update(Config.Autopilot.AutopilotDesiredAltitude or 0, SensorData.Altitude.Altitude or 0, dt)
|
local throttleOutput = PIDs.AltitudePID:update(Config.Autopilot.AutopilotDesiredAltitude or 0, SensorData.Altitude.Altitude or 0, dt)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user