2021-07-18 19:05:26 +00:00
|
|
|
run once "lib/functions".
|
2021-07-18 08:07:00 +00:00
|
|
|
|
2021-07-18 19:05:26 +00:00
|
|
|
local APOAPSIS_TARGET is 80000.
|
|
|
|
local GRAVITY_TURN_START is 5000.
|
|
|
|
SensorCheck().
|
2021-07-18 08:07:00 +00:00
|
|
|
|
2021-07-18 19:05:26 +00:00
|
|
|
// Countdowns are cute.
|
|
|
|
print "Initiating automated launch sequence".
|
|
|
|
from { local x is 5. } until x = 0 step { set x to x - 1. } do {
|
|
|
|
print "..." + x.
|
|
|
|
wait 1.
|
2021-07-18 08:07:00 +00:00
|
|
|
}
|
2021-07-18 19:05:26 +00:00
|
|
|
print "Launching".
|
2021-07-18 08:07:00 +00:00
|
|
|
|
2021-07-18 19:05:26 +00:00
|
|
|
// Disable subsystems.
|
|
|
|
RCS off.
|
|
|
|
SAS off.
|
|
|
|
|
|
|
|
// throttle controls
|
|
|
|
when TWR() > 1.5 then {
|
|
|
|
if SHIP:ALTITUDE > 32000 {
|
|
|
|
lock THROTTLE to 1.0.
|
|
|
|
return false.
|
2021-07-18 08:07:00 +00:00
|
|
|
}
|
|
|
|
|
2021-07-18 19:05:26 +00:00
|
|
|
lock THROTTLE to ThrottleToTWR(1.5).
|
|
|
|
return true.
|
2021-07-18 08:07:00 +00:00
|
|
|
}
|
|
|
|
|
2021-07-18 19:05:26 +00:00
|
|
|
// Main ascent control.
|
|
|
|
lock THROTTLE to 1.0.
|
|
|
|
lock STEERING to UP.
|
|
|
|
stage.
|
2021-07-18 08:07:00 +00:00
|
|
|
|
2021-07-18 19:05:26 +00:00
|
|
|
wait until SHIP:ALTITUDE > 200.
|
|
|
|
lock STEERING to heading(90, 85, 90).
|
2021-07-18 08:07:00 +00:00
|
|
|
|
2021-07-18 19:05:26 +00:00
|
|
|
wait until SHIP:ALTITUDE > GRAVITY_TURN_START.
|
|
|
|
until SHIP:APOAPSIS > 80000 {
|
|
|
|
local angle is min(30, SHIP:PROGRADE:PITCH - 2).
|
|
|
|
lock STEERING to heading(90, angle, 90).
|
2021-07-18 08:07:00 +00:00
|
|
|
wait 0.001.
|
|
|
|
}
|
|
|
|
|
2021-07-18 19:05:26 +00:00
|
|
|
set THROTTLE to 0.0.
|