Fix throttling, first attempt to fix gravity turn.

This commit is contained in:
2021-07-18 16:06:38 -04:00
parent ed31a1fda3
commit 5cb608ff01
3 changed files with 14 additions and 9 deletions

View File

@ -1,16 +1,17 @@
// Functions for calculating navigational and guidance values.
@lazyglobal off.
// Returns the throttle value you should use to achieve the
// target TWR. If TWR can't be achieved, returns 1.0. (full throttle)
function ThrottleToTWR {
parameter twr is 1.5.
parameter targetTWR is 1.5.
local m is SHIP:MASS.
local g is 9.81.
if HAS_GRAV_SENSOR = true {
set g to SHIP:SENSORS:GRAV:MAG.
}
return min((twr*m*g)/SHIP:AVAILABLETHRUST, 1.0).
return min((targetTWR*m*g)/SHIP:AVAILABLETHRUST, 1.0).
}
// Calculates the ship's current TWR.