Initial import
This commit is contained in:
27
boot/bumper.ks
Normal file
27
boot/bumper.ks
Normal file
@@ -0,0 +1,27 @@
|
||||
@lazyglobal off.
|
||||
wait until ship:unpacked.
|
||||
|
||||
runoncepath("0:/lib/stage/v2.ks").
|
||||
runoncepath("0:/lib/common.ks").
|
||||
|
||||
|
||||
local target_azimuth is 90.
|
||||
local target_pitch is 10.
|
||||
rcs off.
|
||||
v2:launch(target_azimuth, target_pitch).
|
||||
|
||||
|
||||
rcs on.
|
||||
local hdg is lookdirup(ship:srfprograde:forevector, ship:up:forevector).
|
||||
lock throttle to 1.0.
|
||||
lock steering to hdg.
|
||||
wait 1.
|
||||
wait until steering_locked().
|
||||
|
||||
stage.
|
||||
wait 3.
|
||||
stage.
|
||||
wait until stage:ready.
|
||||
stage.
|
||||
|
||||
wait until ship:thrust = 0.
|
||||
14
boot/cherenkov.ks
Normal file
14
boot/cherenkov.ks
Normal file
@@ -0,0 +1,14 @@
|
||||
@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 hdg is 90.
|
||||
|
||||
thor:launch(hdg, 250_000, 7).
|
||||
stage.
|
||||
able:orbit(hdg, true).
|
||||
stage.
|
||||
30
boot/gravimetric.ks
Normal file
30
boot/gravimetric.ks
Normal file
@@ -0,0 +1,30 @@
|
||||
@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 55.
|
||||
local target_alt is 1_050_000.
|
||||
local target_ecc is 0.0029.
|
||||
local hdg is launch_azimuth(target_inclination, target_alt).
|
||||
|
||||
thor:launch(hdg, target_alt, 5).
|
||||
stage.
|
||||
able:yeet(hdg, target_alt).
|
||||
able:power_down().
|
||||
wait 1.
|
||||
set warpmode to "rails".
|
||||
set warp to 2.
|
||||
wait until eta:apoapsis < 180.
|
||||
set warp to 1.
|
||||
wait until eta:apoapsis < 150.
|
||||
set warp to 0.
|
||||
wait 1.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
able:power_up().
|
||||
able:circularize(target_ecc).
|
||||
wait 1.
|
||||
stage.
|
||||
26
boot/high-altitude-cosmic.ks
Normal file
26
boot/high-altitude-cosmic.ks
Normal file
@@ -0,0 +1,26 @@
|
||||
@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 300_000.
|
||||
|
||||
local hdg is launch_azimuth(target_inclination, target_alt).
|
||||
|
||||
thor:launch(hdg, target_alt).
|
||||
stage.
|
||||
able:burn(hdg).
|
||||
|
||||
rcs on.
|
||||
lock steering to heading(hdg, 0, -hdg).
|
||||
wait until steering_locked().
|
||||
stage.
|
||||
wait 1.
|
||||
set warpmode to "physics".
|
||||
set warp to 3.
|
||||
wait until ship:thrust = 0.
|
||||
set warp to 0.
|
||||
19
boot/ir-radiometry.ks
Normal file
19
boot/ir-radiometry.ks
Normal file
@@ -0,0 +1,19 @@
|
||||
@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 80.
|
||||
local target_alt is 600_000.
|
||||
|
||||
local hdg is launch_azimuth(target_inclination, target_alt).
|
||||
|
||||
thor:launch(hdg, target_alt, 6).
|
||||
stage.
|
||||
able:orbit(hdg).
|
||||
|
||||
wait 1. // Ensure engine shuts down?
|
||||
stage.
|
||||
37
boot/jupiter.ks
Normal file
37
boot/jupiter.ks
Normal file
@@ -0,0 +1,37 @@
|
||||
@lazyglobal off.
|
||||
wait until ship:unpacked.
|
||||
|
||||
runoncepath("0:/lib/stage/v2.ks").
|
||||
runoncepath("0:/lib/common.ks").
|
||||
|
||||
|
||||
local target_azimuth is 90.
|
||||
|
||||
// 6Mm with A-6
|
||||
//local target_pitch is 10.
|
||||
// 7.5Mm with A-6H
|
||||
local target_pitch is 7.
|
||||
|
||||
rcs off.
|
||||
v2:launch(target_azimuth, target_pitch).
|
||||
|
||||
// Release upper stage and align.
|
||||
rcs on.
|
||||
stage.
|
||||
local hdg is lookdirup(ship:srfprograde:forevector, ship:up:forevector).
|
||||
lock throttle to 1.0.
|
||||
lock steering to hdg.
|
||||
wait 1.
|
||||
|
||||
// spin up solids
|
||||
wait until steering_locked(0.001).
|
||||
unlock steering.
|
||||
set ship:control:roll to 1.0.
|
||||
wait 20.
|
||||
|
||||
// Sequence solid motors
|
||||
stage.
|
||||
wait 8.
|
||||
stage.
|
||||
wait 8.
|
||||
stage.
|
||||
60
boot/kh-1.ks
Normal file
60
boot/kh-1.ks
Normal file
@@ -0,0 +1,60 @@
|
||||
@lazyglobal off.
|
||||
wait until ship:unpacked.
|
||||
rcs off.
|
||||
|
||||
runoncepath("0:/lib/common.ks").
|
||||
runoncepath("0:/lib/stage/thor.ks").
|
||||
runoncepath("0:/lib/stage/agena.ks").
|
||||
|
||||
local target_inclination is 90.
|
||||
local target_alt is 150_000.
|
||||
|
||||
local hdg is launch_azimuth(target_inclination, target_alt).
|
||||
|
||||
thor:launch(hdg, target_alt, 9.3).
|
||||
stage.
|
||||
agena:orbit(hdg).
|
||||
agena:power_down().
|
||||
print "Waiting for film or batteries to run out".
|
||||
|
||||
wait 1.
|
||||
set warpmode to "rails".
|
||||
set warp to 4.
|
||||
|
||||
local cam is ship:partsdubbed("RO-BasicFilmCamera")[0]:getmodule("Experiment").
|
||||
until false {
|
||||
if agena:low_power() {
|
||||
break.
|
||||
}
|
||||
local done is false.
|
||||
for evt in cam:allevents {
|
||||
if evt:contains("depleted") {
|
||||
set done to true.
|
||||
}
|
||||
}
|
||||
if done {
|
||||
break.
|
||||
}
|
||||
wait 1.
|
||||
}
|
||||
|
||||
set warp to 0.
|
||||
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").
|
||||
|
||||
print "Aligning for return".
|
||||
agena:power_up().
|
||||
rcs on.
|
||||
lock steering to ship:retrograde.
|
||||
wait 20.
|
||||
wait until steering_locked(0.001).
|
||||
|
||||
print "Deorbit!".
|
||||
stage.
|
||||
|
||||
// Stage parachute
|
||||
wait until ship:altitude < 25000.
|
||||
print "Parachute deploy".
|
||||
stage.
|
||||
53
boot/kh-4.ks
Normal file
53
boot/kh-4.ks
Normal file
@@ -0,0 +1,53 @@
|
||||
@lazyglobal off.
|
||||
wait until ship:unpacked.
|
||||
rcs off.
|
||||
|
||||
runoncepath("0:/lib/common.ks").
|
||||
runoncepath("0:/lib/stage/thor.ks").
|
||||
runoncepath("0:/lib/stage/agena.ks").
|
||||
|
||||
local target_inclination is 90.
|
||||
local target_alt is 200_000.
|
||||
|
||||
local hdg is launch_azimuth(target_inclination, target_alt).
|
||||
|
||||
thor:launch(hdg, target_alt, 8).
|
||||
stage.
|
||||
agena:orbit(hdg).
|
||||
agena:power_down().
|
||||
print "Waiting for film or batteries to run out".
|
||||
|
||||
wait 1.
|
||||
set warpmode to "rails".
|
||||
set warp to 4.
|
||||
|
||||
local cam is ship:partsdubbed("RO-ImprovedFilmCamera")[0]:getmodule("Experiment").
|
||||
until false {
|
||||
if agena:low_power() {
|
||||
break.
|
||||
}
|
||||
if cam:depleted {
|
||||
break.
|
||||
}
|
||||
wait 1.
|
||||
}
|
||||
|
||||
set warp to 0.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
print "Transferring data to return capsule".
|
||||
ship:rootpart:getmodule("HardDrive"):transferHere.
|
||||
|
||||
print "Aligning for return".
|
||||
agena:power_up().
|
||||
rcs on.
|
||||
lock steering to ship:retrograde.
|
||||
wait 20.
|
||||
wait until steering_locked(0.1).
|
||||
|
||||
print "Deorbit!".
|
||||
stage.
|
||||
|
||||
// Stage parachute
|
||||
wait until ship:altitude < 25000.
|
||||
print "Parachute deploy".
|
||||
stage.
|
||||
32
boot/magnetometry.ks
Normal file
32
boot/magnetometry.ks
Normal file
@@ -0,0 +1,32 @@
|
||||
@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 hdg is 90.
|
||||
|
||||
thor:launch(hdg, 250_000, 8).
|
||||
stage.
|
||||
able:yeet(hdg, 3_050_000).
|
||||
|
||||
rcs off.
|
||||
able:power_down().
|
||||
wait 1.
|
||||
set warpmode to "rails".
|
||||
set warp to 2.
|
||||
wait until eta:apoapsis < 120.
|
||||
set warp to 1.
|
||||
wait until eta:apoapsis < 45.
|
||||
set warp to 0.
|
||||
wait 1.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
able:power_up().
|
||||
lock steering to ship:prograde.
|
||||
rcs on.
|
||||
wait 1.
|
||||
wait until steering_locked(0.05).
|
||||
wait until eta:apoapsis < 20.
|
||||
stage.
|
||||
61
boot/mercury-orbit.ks
Normal file
61
boot/mercury-orbit.ks
Normal file
@@ -0,0 +1,61 @@
|
||||
@lazyglobal off.
|
||||
wait until ship:unpacked.
|
||||
rcs off.
|
||||
lock throttle to 0.
|
||||
|
||||
runoncepath("0:/lib/common.ks").
|
||||
runoncepath("0:/lib/moonmath.ks").
|
||||
runoncepath("0:/lib/stage/atlas.ks").
|
||||
|
||||
on abort {
|
||||
unlock steering.
|
||||
sas on.
|
||||
wait 5.
|
||||
stage.
|
||||
wait until stage:ready.
|
||||
stage.
|
||||
rcs on.
|
||||
set sasmode to "retrograde".
|
||||
ship:rootpart:getmodule("kOSProcessor"):deactivate.
|
||||
}
|
||||
|
||||
// Any automatic abort triggers go where
|
||||
when false then {
|
||||
abort on.
|
||||
}
|
||||
|
||||
local orbit_time is 26*60*60.
|
||||
local target_alt is 225_000.
|
||||
atlas:launch(90, target_alt, 7.5).
|
||||
|
||||
stage.
|
||||
panels on.
|
||||
wait 1.
|
||||
rcs on.
|
||||
local dir is sun:direction.
|
||||
lock steering to dir.
|
||||
wait 1.
|
||||
wait until steering_locked().
|
||||
set warpmode to "rails".
|
||||
set warp to 1.
|
||||
|
||||
// Human can time-warp faster here if they want
|
||||
|
||||
wait orbit_time.
|
||||
set warp to 0.
|
||||
wait 1.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
|
||||
local retro is ship:retrograde.
|
||||
lock steering to retro.
|
||||
wait 1.
|
||||
wait until steering_locked().
|
||||
stage.
|
||||
wait 20.
|
||||
stage.
|
||||
set warpmode to "rails".
|
||||
set warp to 2.
|
||||
wait until ship:altitude < 140_000.
|
||||
lock steering to ship:retrograde.
|
||||
wait until ship:altitude < 35_000.
|
||||
stage.
|
||||
39
boot/mercury-return.ks
Normal file
39
boot/mercury-return.ks
Normal file
@@ -0,0 +1,39 @@
|
||||
@lazyglobal off.
|
||||
wait until ship:unpacked.
|
||||
rcs off.
|
||||
lock throttle to 0.
|
||||
|
||||
runoncepath("0:/lib/common.ks").
|
||||
runoncepath("0:/lib/moonmath.ks").
|
||||
runoncepath("0:/lib/stage/atlas.ks").
|
||||
|
||||
local orbit_time is 24*60*60.
|
||||
stage.
|
||||
rcs on.
|
||||
local dir is ship:prograde.
|
||||
lock steering to dir.
|
||||
wait 1.
|
||||
wait until steering_locked().
|
||||
set warpmode to "rails".
|
||||
set warp to 1.
|
||||
|
||||
// Human can time-warp faster here if they want
|
||||
|
||||
wait orbit_time.
|
||||
set warp to 0.
|
||||
wait 1.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
|
||||
local retro is ship:retrograde.
|
||||
lock steering to retro.
|
||||
wait 1.
|
||||
wait until steering_locked().
|
||||
stage.
|
||||
wait 20.
|
||||
stage.
|
||||
set warpmode to "rails".
|
||||
set warp to 2.
|
||||
wait until ship:altitude < 140_000.
|
||||
lock steering to ship:retrograde.
|
||||
wait until ship:altitude < 35_000.
|
||||
stage.
|
||||
177
boot/moon-impactor.ks
Normal file
177
boot/moon-impactor.ks
Normal file
@@ -0,0 +1,177 @@
|
||||
@lazyglobal off.
|
||||
wait until ship:unpacked.
|
||||
rcs off.
|
||||
lock throttle to 0.
|
||||
|
||||
runoncepath("0:/lib/common.ks").
|
||||
runoncepath("0:/lib/moonmath.ks").
|
||||
runoncepath("0:/lib/stage/atlas.ks").
|
||||
runoncepath("0:/lib/stage/agena.ks").
|
||||
|
||||
local state is lex().
|
||||
|
||||
local function ship_volume {
|
||||
return ship:rootpart:getmodule("kosprocessor"):volume.
|
||||
}
|
||||
|
||||
local function phase {
|
||||
switch to ship_volume().
|
||||
if not ship_volume():exists("state.json") {
|
||||
set_phase("prelaunch").
|
||||
}
|
||||
set state to readjson("state.json").
|
||||
return state["phase"].
|
||||
}
|
||||
|
||||
local function set_phase {
|
||||
parameter new_phase.
|
||||
switch to ship_volume().
|
||||
set state["phase"] to new_phase.
|
||||
writejson(state, "state.json").
|
||||
kuniverse:quicksaveto("moon-impactor-"+new_phase).
|
||||
}
|
||||
|
||||
if phase() = "prelaunch" {
|
||||
local target_inclination is max(moon:obt:inclination,ship:latitude).
|
||||
local target_alt is 500_000.
|
||||
set state["azimuth"] to launch_azimuth(target_inclination, target_alt).
|
||||
|
||||
local launch_params is moonmath:calculate_launch(target_inclination, state["azimuth"], target_alt).
|
||||
local launch_time is launch_params:launch_time.
|
||||
set state["moon_altitude"] to launch_params:moon_altitude.
|
||||
set state["burn_longitude"] to launch_params:burn_longitude.
|
||||
print "Burning for moon at " + state["burn_longitude"] + " right ascension".
|
||||
|
||||
wait 2.
|
||||
|
||||
until launch_time - time:seconds < 10 {
|
||||
print "Not ready to launch yet, warping...".
|
||||
warpto(launch_time-9).
|
||||
wait 0.
|
||||
wait until warp = 0.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
print "Maybe done warping?".
|
||||
}
|
||||
wait until time:seconds > launch_time.
|
||||
|
||||
atlas:launch(state["azimuth"], target_alt, 4).
|
||||
stage.
|
||||
set_phase("circularize").
|
||||
}
|
||||
|
||||
if phase() = "circularize" {
|
||||
agena:orbit(state["azimuth"]).
|
||||
agena:power_down().
|
||||
|
||||
wait 1.
|
||||
set_phase("parkingorbit").
|
||||
}
|
||||
|
||||
local function ship_longitude {
|
||||
return mod(ship:longitude + ship:body:rotationangle + 360, 360).
|
||||
}
|
||||
|
||||
local function transfer_lead_angle {
|
||||
parameter moon_alt.
|
||||
local moon_range is moon:apoapsis - moon:periapsis.
|
||||
local moon_frac is (moon_alt - moon:periapsis) / moon_range.
|
||||
local lead_angle_frac is 1.0 - moon_frac.
|
||||
return 1.1 + 0.65 * lead_angle_frac.
|
||||
}
|
||||
|
||||
if phase() = "parkingorbit" {
|
||||
// Just in case our burn point is RIGHT HERE, we want to go around at least once.
|
||||
set warpmode to "physics".
|
||||
set warp to 3.
|
||||
wait until abs(ship_longitude() - state["burn_longitude"]) > 10.
|
||||
set warp to 0.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
wait 1.
|
||||
|
||||
// Rails warp until we're nearish to the burn point
|
||||
print "Warping to dLongitude < 15".
|
||||
set warpmode to "rails".
|
||||
set warp to 2.
|
||||
wait until abs(ship_longitude() - state["burn_longitude"]) < 15.
|
||||
set warp to 0.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
wait 1.
|
||||
|
||||
// Physics warp until we're nearish-er
|
||||
print "Warping to dLongitude < 7".
|
||||
set warpmode to "physics".
|
||||
set warp to 3.
|
||||
wait until abs(ship_longitude() - state["burn_longitude"]) < 4.
|
||||
set warp to 0.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
wait 1.
|
||||
|
||||
agena:power_up().
|
||||
rcs on.
|
||||
lock steering to ship:prograde.
|
||||
local lead_angle is transfer_lead_angle(state["moon_altitude"]).
|
||||
wait until abs(ship_longitude() - state["burn_longitude"]) < lead_angle. // Hand-picked rather than computing burn time & time to target longitude
|
||||
local transfer_vel is circular_vel() + hohmann_transfer_dv(earth, ship:altitude, state["moon_altitude"]).
|
||||
print "Moon altitude is: " + state["moon_altitude"].
|
||||
print "Transfer DV is: " + (transfer_vel - ship:velocity:orbit:mag).
|
||||
print "Burn lead angle is: " + lead_angle.
|
||||
agena:transfer_burn(transfer_vel).
|
||||
wait 1.
|
||||
stage.
|
||||
|
||||
set_phase("adjust").
|
||||
}
|
||||
|
||||
if phase() = "adjust" {
|
||||
panels on.
|
||||
rcs on.
|
||||
|
||||
lock throttle to 0.0.
|
||||
lock steering to lookdirup(ship:prograde:forevector, ship:up:forevector).
|
||||
local adjustment is 8_000_000. // 1.5%..2.0%?
|
||||
print "Alt Adjustment is " + adjustment.
|
||||
|
||||
local target_alt is state["moon_altitude"] + adjustment.
|
||||
local max_alt_delta is 1_000_000.
|
||||
local threshold is 0.1.
|
||||
until false {
|
||||
local p is threshold / max_alt_delta.
|
||||
local da is target_alt - ship:orbit:apoapsis.
|
||||
local horz_factor is da * p.
|
||||
if abs(horz_factor) < threshold {
|
||||
set ship:control:fore to 0.
|
||||
break.
|
||||
}
|
||||
set ship:control:fore to horz_factor.
|
||||
wait 0.
|
||||
}
|
||||
set_phase("pretransfer").
|
||||
}
|
||||
|
||||
if phase() = "pretransfer" {
|
||||
rcs on.
|
||||
lock steering to sun:direction.
|
||||
wait 1.
|
||||
wait until steering_locked().
|
||||
wait 1.
|
||||
local avi_mod is ship:rootpart:getmodule("ModuleProceduralAvionics").
|
||||
avi_mod:doaction("shutdown avionics", true).
|
||||
wait 1.
|
||||
|
||||
set_phase("transfer").
|
||||
}
|
||||
|
||||
if phase() = "transfer" {
|
||||
set warpmode to "rails".
|
||||
warpto(eta:transition + time:seconds).
|
||||
wait until ship:obt:body = moon.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
|
||||
set_phase("done").
|
||||
}
|
||||
|
||||
if phase() <> "done" {
|
||||
print "Phase logic failed, expected to be in phase '" + phase() + "'".
|
||||
}
|
||||
|
||||
print "Done".
|
||||
170
boot/moon-orbiter.ks
Normal file
170
boot/moon-orbiter.ks
Normal file
@@ -0,0 +1,170 @@
|
||||
@lazyglobal off.
|
||||
wait until ship:unpacked.
|
||||
rcs off.
|
||||
lock throttle to 0.
|
||||
|
||||
runoncepath("0:/lib/common.ks").
|
||||
runoncepath("0:/lib/moonmath.ks").
|
||||
runoncepath("0:/lib/stage/atlas.ks").
|
||||
runoncepath("0:/lib/stage/centaur.ks").
|
||||
runoncepath("0:/lib/stage/probe.ks").
|
||||
|
||||
local state is lex().
|
||||
|
||||
local function ship_volume {
|
||||
return ship:rootpart:getmodule("kosprocessor"):volume.
|
||||
}
|
||||
|
||||
local function phase {
|
||||
switch to ship_volume().
|
||||
if not ship_volume():exists("state.json") {
|
||||
set_phase("prelaunch").
|
||||
}
|
||||
set state to readjson("state.json").
|
||||
return state["phase"].
|
||||
}
|
||||
|
||||
local function set_phase {
|
||||
parameter new_phase.
|
||||
switch to ship_volume().
|
||||
set state["phase"] to new_phase.
|
||||
writejson(state, "state.json").
|
||||
kuniverse:quicksaveto("moon-impactor-"+new_phase).
|
||||
}
|
||||
|
||||
if phase() = "prelaunch" {
|
||||
local target_inclination is max(moon:obt:inclination,ship:latitude).
|
||||
local target_alt is 500_000.
|
||||
set state["azimuth"] to launch_azimuth(target_inclination, target_alt).
|
||||
|
||||
local launch_params is moonmath:calculate_launch(target_inclination, state["azimuth"], target_alt).
|
||||
local launch_time is launch_params:launch_time.
|
||||
set state["moon_altitude"] to launch_params:moon_altitude.
|
||||
set state["departure_ra"] to launch_params:burn_longitude.
|
||||
print "Departing for moon at " + state["departure_ra"] + " right ascension".
|
||||
|
||||
wait 2.
|
||||
|
||||
until launch_time - time:seconds < 10 {
|
||||
print "Not ready to launch yet, warping...".
|
||||
warpto(launch_time-9).
|
||||
wait 0.
|
||||
wait until warp = 0.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
print "Maybe done warping?".
|
||||
}
|
||||
wait until time:seconds > launch_time.
|
||||
|
||||
atlas:launch(state["azimuth"], target_alt, 4).
|
||||
stage.
|
||||
set_phase("circularize").
|
||||
}
|
||||
|
||||
if phase() = "circularize" {
|
||||
centaur:orbit(state["azimuth"]).
|
||||
centaur:power_down().
|
||||
|
||||
wait 1.
|
||||
set_phase("parkingorbit").
|
||||
}
|
||||
|
||||
local function ship_ra {
|
||||
return mod(ship:longitude + ship:body:rotationangle + 360, 360).
|
||||
}
|
||||
|
||||
if phase() = "parkingorbit" {
|
||||
local transfer_dv is hohmann_transfer_dv(earth, ship:altitude, state["moon_altitude"]).
|
||||
local burn_time is centaur:burn_time(transfer_dv / 2).
|
||||
local burn_angle is (burn_time / ship:obt:period) * 360.
|
||||
local burn_ra is mod(state["departure_ra"] - burn_angle + 360, 360).
|
||||
|
||||
|
||||
// Just in case our departure point is RIGHT HERE, we want to go around at least once.
|
||||
set warpmode to "physics".
|
||||
set warp to 3.
|
||||
wait until abs(ship_ra() - burn_ra) > 16.
|
||||
set warp to 0.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
wait 1.
|
||||
|
||||
// Rails warp until we're nearish to the burn point
|
||||
print "Warping to dLongitude < 15".
|
||||
set warpmode to "rails".
|
||||
set warp to 2.
|
||||
wait until abs(ship_ra() - burn_ra) < 15.
|
||||
set warp to 0.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
wait 1.
|
||||
|
||||
// Physics warp until we're nearish-er
|
||||
print "Warping to dLongitude < 4".
|
||||
set warpmode to "physics".
|
||||
set warp to 3.
|
||||
wait until abs(ship_ra() - burn_ra) < 4.
|
||||
set warp to 0.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
wait 1.
|
||||
|
||||
centaur:power_up().
|
||||
rcs on.
|
||||
lock steering to ship:prograde.
|
||||
wait until ship_ra() >= burn_ra.
|
||||
print "Moon altitude is: " + state["moon_altitude"].
|
||||
print "Transfer DV is: " + transfer_dv.
|
||||
centaur:transfer_burn(state["moon_altitude"]).
|
||||
wait 1.
|
||||
|
||||
set_phase("pretransfer").
|
||||
}
|
||||
|
||||
if phase() = "pretransfer" {
|
||||
rcs on.
|
||||
panels on.
|
||||
stage.
|
||||
wait 1.
|
||||
probe:power_up().
|
||||
lock steering to sun:direction.
|
||||
wait 1.
|
||||
wait until steering_locked().
|
||||
wait 1.
|
||||
rcs off.
|
||||
probe:power_down().
|
||||
wait 1.
|
||||
|
||||
set_phase("transfer").
|
||||
}
|
||||
|
||||
if phase() = "transfer" {
|
||||
set warpmode to "rails".
|
||||
warpto(eta:transition + time:seconds).
|
||||
wait until ship:obt:body = moon.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
|
||||
set_phase("lunar_arrival").
|
||||
}
|
||||
|
||||
if phase() = "lunar_arrival" {
|
||||
stage.
|
||||
probe:capture_burn().
|
||||
|
||||
set_phase("lunar_deploy").
|
||||
}
|
||||
|
||||
if phase() = "lunar_deploy" {
|
||||
probe:power_up().
|
||||
lock steering to sun:direction.
|
||||
wait 1.
|
||||
wait until steering_locked().
|
||||
wait 1.
|
||||
rcs off.
|
||||
probe:power_down().
|
||||
|
||||
set_phase("done").
|
||||
}
|
||||
|
||||
|
||||
if phase() <> "done" {
|
||||
print "Phase logic failed, expected to be in phase '" + phase() + "'".
|
||||
}
|
||||
|
||||
print "Done".
|
||||
28
boot/navsat-1.ks
Normal file
28
boot/navsat-1.ks
Normal file
@@ -0,0 +1,28 @@
|
||||
@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_alt is 500_000.
|
||||
local target_ecc is 0.01.
|
||||
local hdg is 30.
|
||||
|
||||
thor:launch(hdg, target_alt, 1.4).
|
||||
stage.
|
||||
able:yeet(hdg, target_alt).
|
||||
able:power_down().
|
||||
wait 1.
|
||||
set warpmode to "rails".
|
||||
set warp to 2.
|
||||
wait until eta:apoapsis < 180.
|
||||
set warp to 1.
|
||||
wait until eta:apoapsis < 150.
|
||||
set warp to 0.
|
||||
wait 1.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
able:power_up().
|
||||
able:circularize(target_ecc).
|
||||
wait 1.
|
||||
30
boot/navsat-2.ks
Normal file
30
boot/navsat-2.ks
Normal file
@@ -0,0 +1,30 @@
|
||||
@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_alt is 800_000.
|
||||
local target_ecc is 0.0025.
|
||||
local hdg is launch_azimuth(89, target_alt).
|
||||
|
||||
thor:launch(hdg, target_alt, 5, 300).
|
||||
stage.
|
||||
able:yeet(hdg, target_alt).
|
||||
able:power_down().
|
||||
wait 1.
|
||||
set warpmode to "rails".
|
||||
set warp to 2.
|
||||
wait until eta:apoapsis < 180.
|
||||
set warp to 1.
|
||||
wait until eta:apoapsis < 150.
|
||||
set warp to 0.
|
||||
wait 1.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
able:power_up().
|
||||
able:circularize(target_ecc).
|
||||
wait 1.
|
||||
stage.
|
||||
|
||||
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.
|
||||
42
boot/orbiter.ks
Normal file
42
boot/orbiter.ks
Normal file
@@ -0,0 +1,42 @@
|
||||
@lazyglobal off.
|
||||
wait until ship:unpacked.
|
||||
|
||||
runoncepath("0:/lib/stage/v2.ks").
|
||||
runoncepath("0:/lib/common.ks").
|
||||
|
||||
// First polar and first solar
|
||||
//local target_azimuth is 355.
|
||||
//local target_pitch is 5.
|
||||
|
||||
// First orbit and first scientific
|
||||
local target_azimuth is 90.
|
||||
local target_pitch is 6.5.
|
||||
//local target_pitch is 2.0.
|
||||
|
||||
// First atmospheric analysis
|
||||
// local target_azimuth is 60.
|
||||
// local target_pitch is 5.
|
||||
|
||||
rcs off.
|
||||
v2:launch(target_azimuth, target_pitch).
|
||||
|
||||
wait until eta:apoapsis < 30.
|
||||
|
||||
// Release upper stage and track prograde.
|
||||
rcs on.
|
||||
stage.
|
||||
lock steering to prograde.
|
||||
wait 1.
|
||||
|
||||
// Stabilize
|
||||
wait until eta:apoapsis < 10.
|
||||
local hdg is ship:prograde.
|
||||
lock steering to hdg.
|
||||
wait until steering_locked(0.001).
|
||||
|
||||
// Sequence solid motors
|
||||
stage.
|
||||
wait 8.
|
||||
stage.
|
||||
wait 8.
|
||||
stage.
|
||||
24
boot/sun-synchronous.ks
Normal file
24
boot/sun-synchronous.ks
Normal file
@@ -0,0 +1,24 @@
|
||||
@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 97.
|
||||
local target_alt is 350_000.
|
||||
|
||||
local hdg is launch_azimuth(target_inclination, target_alt).
|
||||
|
||||
thor:launch(hdg, target_alt).
|
||||
stage.
|
||||
able:launch(hdg, target_alt).
|
||||
|
||||
warpto(time:seconds + (eta:apoapsis - 30)).
|
||||
wait until eta:apoapsis < 30.
|
||||
|
||||
rcs on.
|
||||
lock steering to ship:prograde.
|
||||
wait until eta:apoapsis < 10.
|
||||
stage.
|
||||
37
boot/tv.ks
Normal file
37
boot/tv.ks
Normal file
@@ -0,0 +1,37 @@
|
||||
@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_alt is 1_200_000.
|
||||
local target_ecc is 0.0025.
|
||||
local hdg is launch_azimuth(89, target_alt).
|
||||
|
||||
set steeringmanager:pitchts to 3.
|
||||
set steeringmanager:yawts to 3.
|
||||
|
||||
thor:launch(hdg, target_alt, 5, 300).
|
||||
stage.
|
||||
able:yeet(hdg, target_alt).
|
||||
able:power_down().
|
||||
wait 1.
|
||||
set warpmode to "rails".
|
||||
set warp to 2.
|
||||
wait until eta:apoapsis < 180.
|
||||
set warp to 1.
|
||||
wait until eta:apoapsis < 150.
|
||||
set warp to 0.
|
||||
wait 1.
|
||||
wait until kuniverse:timewarp:issettled.
|
||||
able:power_up().
|
||||
able:circularize(target_ecc).
|
||||
wait 1.
|
||||
rcs on.
|
||||
panels on.
|
||||
lock steering to sun:direction.
|
||||
wait 1.
|
||||
wait until steering_locked().
|
||||
stage.
|
||||
15
boot/v2_camera.ks
Normal file
15
boot/v2_camera.ks
Normal file
@@ -0,0 +1,15 @@
|
||||
@lazyglobal off.
|
||||
wait until ship:unpacked.
|
||||
|
||||
runoncepath("0:/lib/stage/v2.ks").
|
||||
|
||||
local target_azimuth is 90.
|
||||
v2:launch(target_azimuth).
|
||||
|
||||
wait until ship:verticalspeed < 0 and ship:altitude < 140000.
|
||||
stage.
|
||||
|
||||
wait until stage:ready.
|
||||
|
||||
wait until ship:altitude < 75000.
|
||||
stage.
|
||||
17
boot/wac.ks
Normal file
17
boot/wac.ks
Normal file
@@ -0,0 +1,17 @@
|
||||
@lazyglobal off.
|
||||
wait until ship:unpacked.
|
||||
lock throttle to 1.0.
|
||||
|
||||
local sustainer is ship:partsdubbed("ROE-Aerobee")[0].
|
||||
//local tim is ship:partsdubbed("TinyTim").
|
||||
local ks18 is ship:partsdubbed("ROE-25KS18000").
|
||||
local nike is ship:partsdubbed("ROE-NikeM5E1").
|
||||
local booster is choose nike[0] if ks18:empty else ks18[0].
|
||||
|
||||
stage.
|
||||
wait until stage:ready.
|
||||
wait until sustainer:thrust > booster:thrust.
|
||||
stage.
|
||||
|
||||
wait until ship:verticalspeed < 0 and ship:altitude < 75000.
|
||||
stage.
|
||||
Reference in New Issue
Block a user