add heading offset correction value in config
This commit is contained in:
15
main.lua
15
main.lua
@@ -162,6 +162,11 @@ Config.Autopilot = {
|
||||
AutopilotDesiredHeading = nil
|
||||
}
|
||||
|
||||
-- Correctional values for when some sensor values are offset
|
||||
Config.SensorCorrection = {
|
||||
Heading = 0 -- this should be +/- 180
|
||||
}
|
||||
|
||||
Config.Throttles = nil
|
||||
|
||||
function ThrottleInit()
|
||||
@@ -501,6 +506,16 @@ function PollNavTable()
|
||||
SensorData.NavTable = {}
|
||||
|
||||
Heading = navTable.getHeading()
|
||||
|
||||
if Config.SensorCorrection.Heading ~= 0 then
|
||||
if Heading + Config.SensorCorrection.Heading > 360 then
|
||||
local difference = 360 - Heading
|
||||
Heading = 0 + (Config.SensorCorrection.Heading - difference)
|
||||
else
|
||||
Heading = Heading + Config.SensorCorrection.Heading
|
||||
end
|
||||
end
|
||||
|
||||
NavTableHasTarget = navTable.hasTarget()
|
||||
|
||||
SensorData.NavTable.Heading = Heading
|
||||
|
||||
Reference in New Issue
Block a user