Fix throttling, first attempt to fix gravity turn.
This commit is contained in:
parent
ed31a1fda3
commit
5cb608ff01
|
@ -1,5 +1,5 @@
|
|||
COPYPATH("0:/noop", "").
|
||||
COMPILE "0:/launch" to "1:/launch".
|
||||
COMPILE "0:/lib/functions" to "1:/lib/functions".
|
||||
COMPILE "0:/lib/guidance" to "1:/lib/guidance".
|
||||
|
||||
SET core:bootfilename to "noop".
|
||||
|
|
16
launch.ks
16
launch.ks
|
@ -1,4 +1,4 @@
|
|||
run once "lib/functions".
|
||||
run once "lib/guidance".
|
||||
|
||||
local APOAPSIS_TARGET is 80000.
|
||||
local GRAVITY_TURN_START is 5000.
|
||||
|
@ -23,23 +23,27 @@ when TWR() > 1.5 then {
|
|||
return false.
|
||||
}
|
||||
|
||||
lock THROTTLE to ThrottleToTWR(1.5).
|
||||
local newThrot is ThrottleToTWR(1.5).
|
||||
print "Setting throttle to " + newThrot.
|
||||
lock THROTTLE to newThrot.
|
||||
return true.
|
||||
}
|
||||
|
||||
// Main ascent control.
|
||||
lock THROTTLE to 1.0.
|
||||
lock STEERING to UP.
|
||||
lock STEERING to heading(90,90,-90).
|
||||
stage.
|
||||
|
||||
wait until SHIP:ALTITUDE > 200.
|
||||
lock STEERING to heading(90, 85, 90).
|
||||
lock STEERING to heading(90, 85, -90).
|
||||
|
||||
wait until SHIP:ALTITUDE > GRAVITY_TURN_START.
|
||||
print "Beginning gravity turn".
|
||||
until SHIP:APOAPSIS > 80000 {
|
||||
local angle is min(30, SHIP:PROGRADE:PITCH - 2).
|
||||
lock STEERING to heading(90, angle, 90).
|
||||
local angle is max(30, SHIP:PROGRADE:PITCH - 2).
|
||||
lock STEERING to heading(90, angle, -90).
|
||||
wait 0.001.
|
||||
}
|
||||
|
||||
print "Releasing controls. Good luck, Kerman!".
|
||||
set THROTTLE to 0.0.
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue
Block a user