Created
November 7, 2020 11:36
-
-
Save adriansr/1be760518af826101996baeecddae6eb to your computer and use it in GitHub Desktop.
flightgear landing evaluator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# print G force when touchdown. | |
var VERSION = "1.1"; | |
props.globals.initNode("position/gear-agl-ft", 0); | |
var N = 100; | |
var count = N; | |
var maxG = 0.0; | |
var minVs = 0.0; | |
var touchGs = 0.0; | |
var kill = 0; | |
var printGforce = func { | |
var vs = getprop("velocities/vertical-speed-fps") * 60; | |
var ias = getprop("velocities/airspeed-kt"); | |
var ggl = getprop("position/gear-agl-ft"); | |
var gr1_cmprs = getprop("gear/gear[1]/compression-norm"); | |
var gr2_cmprs = getprop("gear/gear[2]/compression-norm"); | |
var gdamped = getprop("accelerations/pilot-gdamped"); | |
var replay_state = getprop("sim/freeze/replay-state"); | |
if (count < N and (gr1_cmprs != 0 or gr2_cmprs != 0) and replay_state == 0) { | |
if (gdamped > 0.0) { | |
if (gdamped > maxG) { | |
maxG = gdamped; | |
} | |
gs = getprop("velocities/groundspeed-kt"); | |
if (gs > touchGs) { | |
touchGs = gs; | |
} | |
if (vs < minVs) { | |
minVs = vs; | |
} | |
} | |
if (count == N - 1){ | |
print(">======================================="); | |
print("> Touchdown G Force: ", maxG); | |
print("> Touchdown VS: ", minVs); | |
print("> Touchdown GS: ", touchGs); | |
if (minVs > -100) { | |
print("> Too soft landing (<100fpm)"); | |
} else if (minVs >= -250) { | |
print("> Correct landing (100-250fpm)"); | |
} else if (minVs >= -400) { | |
print("> A bit too firm landing (250-400fpm)"); | |
} else if (minVs > -700) { | |
print("> Firm landing (240-700fpm)"); | |
} else { | |
print("> Hard landing (>700fpm)"); | |
} | |
print(">======================================="); | |
} | |
count = count + 1; | |
} | |
var delay = 0.05; | |
if (ggl > 30){ | |
count = 0; | |
if (maxG > 0.0) { | |
maxG = 0.0; | |
minVs = 0.0; | |
touchGs = 0.0; | |
} | |
if (ggl > 100) { | |
delay = 0.2; | |
} | |
} | |
if (kill == 0) { | |
settimer(printGforce, delay); | |
} else { | |
print("> Stopped version ", VERSION); | |
} | |
}; | |
print("> Loaded printGforce version ", VERSION); | |
setlistener("/sim/signals/fdm-initialized", printGforce); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment