Initial import
This commit is contained in:
73
boot/orbit-return.ks
Normal file
73
boot/orbit-return.ks
Normal file
@@ -0,0 +1,73 @@
|
||||
@lazyglobal off.
|
||||
wait until ship:unpacked.
|
||||
rcs off.
|
||||
|
||||
runoncepath("0:/lib/common.ks").
|
||||
runoncepath("0:/lib/stage/thor.ks").
|
||||
runoncepath("0:/lib/stage/able.ks").
|
||||
|
||||
local target_inclination is ship:latitude.
|
||||
local target_alt is 600_000.
|
||||
|
||||
local hdg is launch_azimuth(target_inclination, target_alt).
|
||||
|
||||
thor:launch(hdg, target_alt).
|
||||
stage.
|
||||
able:launch(hdg, target_alt).
|
||||
|
||||
set warpmode to "rails".
|
||||
|
||||
warpto(time:seconds + (eta:apoapsis - 20)).
|
||||
wait until eta:apoapsis < 20.
|
||||
|
||||
// Kick stage.
|
||||
rcs on.
|
||||
lock steering to ship:prograde.
|
||||
wait until eta:apoapsis < 10.
|
||||
stage.
|
||||
|
||||
// Burn out kick stage
|
||||
wait until ship:thrust = 0.
|
||||
stage.
|
||||
|
||||
rcs off.
|
||||
unlock steering.
|
||||
unlock throttle.
|
||||
wait 0.
|
||||
|
||||
// Skip a day for science collection
|
||||
warpto(time:seconds + 24 * 60 * 60).
|
||||
wait 24 * 60 * 60 + 1.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
|
||||
print "Transferring data to return capsule".
|
||||
wait until ship:rootpart:getmodule("HardDrive"):hasevent("transfer data here").
|
||||
ship:rootpart:getmodule("HardDrive"):doevent("Transfer data here").
|
||||
|
||||
if eta:apoapsis < 35 {
|
||||
print "Skipping this orbit".
|
||||
wait until eta:apoapsis > eta:periapsis.
|
||||
}
|
||||
|
||||
print "Warping to AP for deorbit".
|
||||
wait 1.
|
||||
warpto(time:seconds + eta:apoapsis - 120).
|
||||
wait until eta:apoapsis < 120.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
|
||||
print "Aligning for return".
|
||||
rcs on.
|
||||
lock steering to ship:retrograde.
|
||||
set warpmode to "physics".
|
||||
set warp to 3.
|
||||
wait until eta:apoapsis < 5.
|
||||
set warp to 0.
|
||||
wait until eta:apoapsis < 1.
|
||||
|
||||
print "Deorbit!".
|
||||
stage.
|
||||
|
||||
// Stage parachute
|
||||
wait until ship:altitude < 35000.
|
||||
print "Parachute deploy".
|
||||
stage.
|
||||
Reference in New Issue
Block a user