-
Notifications
You must be signed in to change notification settings - Fork 39
Description
Hi,
Since I finally figured out how to edit (my own) HeliosExport16.lua to add the magnetic yaw to the common simulator telemetry, I went on a search for which other telemetry might be available.
I found a good source on Github which I will mention below.
But the main useful telemetry that could be added are these five:
local magneticyaw = LoGetMagneticYaw()
local tas = LoGetTrueAirSpeed()
local dcsModelTime = LoGetModelTime()
local missionStartTime = LoGetMissionStartTime()
local local windAloft = LoGetVectorWindVelocity() // this is an array to be processed as shown further down
It's also useful to use these new variables to pre-calculate the following additional variables:
--------------------------------------
local magneticvariance = yaw - magneticyaw // all three need to be converted from radians to degrees
--------------------------------------
local dcsTimeLocal = formatTime(LoGetMissionStartTime() + LoGetModelTime())
function formatTime(time)
local delimiter = '-'
local seconds = math.floor(time) % 60
local minutes = math.floor(time / 60) % 60
local hours = math.floor(time / (60 * 60)) % 24
return string.format("%02d", hours) .. delimiter .. string.format("%02d", minutes) .. delimiter .. string.format("%02d", seconds)
end
--------------------------------------
local windStrength = math.sqrt((windAloft.x)^2 + (windAloft.z)^2)
local windDirectionGeographicRad = math.atan2(windAloft.z, windAloft.x)
local windDirectionGeographic = math.deg(windDirectionGeographicRad)
if windDirectionGeographic < 0 then windDirectionGeographic = 360 + windDirectionGeographic
end
-- Convert to direction to from direction
if windDirectionGeographic > 180 then windDirectionGeographic = windDirectionGeographic - 180
else windDirectionGeographic = windDirectionGeographic + 180
end
local windDirectionMagnetic = math.deg(windDirectionGeographicRad - magneticvariance)
if windDirectionMagnetic < 0 then windDirectionMagnetic = 360 + windDirectionMagnetic
end
-- Convert to direction to from direction
if windDirectionMagnetic > 180 then windDirectionMagnetic = windDirectionMagnetic - 180
else windDirectionMagnetic = windDirectionMagnetic + 180
end
local windDirectionRelative = windDirectionGeographic - math.deg(yaw)
if windDirectionRelative < 0 then windDirectionRelative = 360 + windDirectionRelative end
if windDirectionRelative > 360 then windDirectionRelative = windDirectionRelative - 360 end
I send those variables to Helios as follows:
helios.send("T1", tonumber(string.format("%.2f",math.deg(pitch))))
helios.send("T2", tonumber(string.format("%.2f",math.deg(bank))))
helios.send("T3", tonumber(string.format("%.2f",math.deg(yaw))))
helios.send("T6", tonumber(string.format("%.2f",math.deg(magneticyaw))))
helios.send("S1", tonumber(string.format("%.2f",math.deg(magneticvariance))))
helios.send("S2", tas, "%.3f")
helios.send("S3", dcsModelTime, "%.2f")
helios.send("S4", dcsTimeLocal)
helios.send("S5", windDirectionGeographic)
helios.send("S6", windDirectionMagnetic)
helios.send("S7", windDirectionRelative)
helios.send("S8", windStrength)
Note: It would also be useful to add the other common telemetry like Air Temperature and Air Pressure to the section of the common DCS Simulator Telemetry as opposed to only in (for example) the aircraft Temperature Gauge and/or the Standby Altimeter.
That would improve the reusability of non-aircraft-specific panels or overlays.
I took my information from:
There you can see that there is a lot more possible but I sticked to the primary telemetry for now.