Skip to content

Commit

Permalink
various updates
Browse files Browse the repository at this point in the history
  • Loading branch information
appenz committed May 23, 2020
1 parent 3ac8953 commit ef7cff5
Show file tree
Hide file tree
Showing 23 changed files with 1,447 additions and 573 deletions.
8 changes: 6 additions & 2 deletions burn.ks
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
// burn the next maneuver node
run once libguido.

parameter wrp is 0.

myinit().
set mynode to nextnode.
exec_n(mynode).
until NOT hasnode {
set mynode to nextnode.
exec_n(mynode,wrp).
}
myexit().

18 changes: 9 additions & 9 deletions go_dun.ks
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
// Launch from Kerbin to Duna
run once libguido.

print "Duna 1.0".

KUniverse:QUICKSAVETO("x0-prelaunch").
parameter alt is -1.
parameter incl_change is False.

if body = Kerbin {
if ship:altitude < 65000 {
myquicksave("x0-prelaunch").
run go_orb(250000).
lock throttle to 0.
wait until KUniverse:CANQUICKSAVE.
KUniverse:QUICKSAVETO("x1-orbit").
myquicksave("x1-orbit").
}
if ship:orbit:inclination > 0.01 {
run incl.
}
if ship:apoapsis < 1000000*0.99 {
run reorb(1000000).
wait until KUniverse:CANQUICKSAVE.
KUniverse:QUICKSAVETO("x2-pretransfer").
myquicksave("x2-pretransfer").
}
run tr_pl(Duna).
run tr_pl(Duna,alt).
} else {
// In SOI, but not yet on a stable orbit.
if ship:apoapsis < 0 OR ship:apoapsis > 200000 { run tr_pl(Duna). }
}

wait until KUniverse:CANQUICKSAVE.
KUniverse:QUICKSAVETO("x3-dstorbit").
print "You arrived at Duna!".

10 changes: 5 additions & 5 deletions go_eve.ks
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
print "Eve 1.0".

run once libguido

KUniverse:QUICKSAVETO("x0-prelaunch").
if body = Kerbin {
if ship:altitude < 65000 {
run go_orb(250000).
lock throttle to 0.
wait until KUniverse:CANQUICKSAVE.
KUniverse:QUICKSAVETO("x1-orbit").
myquicksave("x1-orbit").
}
if ship:orbit:inclination > 0.01 {
run incl.
}
if ship:apoapsis < 1000000*0.99 {
run reorb(1000000).
wait until KUniverse:CANQUICKSAVE.
KUniverse:QUICKSAVETO("x2-pretransfer").
myquicksave("x2-pretransfer").
}
run tr_pl(Eve).
} else {
// In SOI, but not yet on a stable orbit.
if ship:apoapsis < 0 OR ship:apoapsis > 200000 { run tr_pl(Eve). }
}

wait until KUniverse:CANQUICKSAVE.
KUniverse:QUICKSAVETO("x5-dstlow").
myquicksave("x5-dstlow").
print "You arrived at Eve!".

70 changes: 70 additions & 0 deletions go_ir.ks
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//
// Launch a new IR Telescope on a new orbit
//

parameter ir_ap.
parameter ir_pe.
parameter ir_incl is 0.
parameter ir_lan is 0.

run once libguido.
run once liborbital.

if ir_ap < ir_pe {
panic("AP < PE!.").
}

set ir_ap to 1000000*ir_ap.
set ir_pe to 1000000*ir_pe.

// Launch from Kerbin to Minmus
print "Launching IR Telescope to Orbit".
print "AP : "+km(ir_ap).
print "PE : "+km(ir_pe).
if ir_incl <> 0 {
print "Incl: "+ir_incl.
print "LAN : "+ir_lan.
}

if body = Kerbin {
if ship:altitude < 65000 {
myquicksave("x0-prelaunch").
run go_orb(250000).
myquicksave("x1-orbit").
}
lock throttle to 0.
panels ON.

if ship:orbit:inclination > 0.01 {
run incl.
myquicksave("x2a-postincl").
}

// Escape Kerbin
// We are sloppy and don't care where we burn.
// 1000 m/s burn should do it.
set mynode to NODE(time:seconds+600,0,0,1000).
ADD mynode.
exec_n(mynode,0).
wait_until_in_orbit_of(Sun).
print "In orbit around the Sun.".
myquicksave("x3-solarorbit").
}

if ship:apoapsis > ir_ap {
// Outside of Kerbin Orbit.
run reorb(ir_pe).
set n to change_ap_at_pe(ir_ap).
ADD n.
exec_n(n).
myquicksave("x5-finalorbit").
} else {
// Outside of Kerbin Orbit.
run reorb(ir_ap).
set n to change_pe_at_ap(ir_pe).
ADD n.
exec_n(n).
myquicksave("x5-finalorbit").

}
myexit().
30 changes: 30 additions & 0 deletions go_jool.ks
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Launch from Kerbin to Dres
run once libguido.

clearscreen.
print "Jool Launcher".

if body = Kerbin {
if ship:altitude < 65000 {
myquicksave("x0-prelaunch").
run go_orb(250000).
lock throttle to 0.
myquicksave("x1-orbit").
}
if ship:orbit:inclination > 0.01 {
run incl.
myquicksave("x2a-postincl").
}
if ship:apoapsis < 1000000*0.99 {
run reorb(5000000).
myquicksave("x2b-pretransfer").
}
run tr_pl(Jool).
} else {
// In SOI, but not yet on a stable orbit.
if ship:apoapsis < 0 OR ship:apoapsis > 100000000 { run tr_pl(Jool). }
}

panic("You arrived at Jool!").
myexit().

32 changes: 32 additions & 0 deletions go_min-v1.ks
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Launch from Kerbin to Minmus
print "Minmus 1.0".

KUniverse:QUICKSAVETO("x0-prelaunch").
if body = Kerbin {
if ship:altitude < 65000 {
run go_orb.
}
lock throttle to 0.
wait until KUniverse:CANQUICKSAVE.
KUniverse:QUICKSAVETO("x1-orbit").
if ship:orbit:inclination < 5 {
run reorb(80000).
run incl.
run incl(6,Minmus:orbit:lan).

}
wait until KUniverse:CANQUICKSAVE.
KUniverse:QUICKSAVETO("x2-pretransfer").
run tr_min.
} else {
// In SOI of Minimus, but not yet on a stable orbit.
if ship:apoapsis < 0 OR ship:apoapsis > 100000 { run tr_min. }
}

//if ship:apoapsis > 11000 { run reorb(10000). }
//if ship:orbit:inclination > 0.1 { run incl. }
wait until KUniverse:CANQUICKSAVE.
KUniverse:QUICKSAVETO("x3-dstorbit").
//run hit(0,6).
print "You arrived on Minmus!".

29 changes: 16 additions & 13 deletions go_min.ks
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
// Launch from Kerbin to Minmus
print "Minmus 1.0".
run once libguido.

KUniverse:QUICKSAVETO("x0-prelaunch").
if body = Kerbin {
if ship:altitude < 65000 {
run go_orb.
run go_orb(250000).
}
lock throttle to 0.
wait until KUniverse:CANQUICKSAVE.
KUniverse:QUICKSAVETO("x1-orbit").
myquicksave("x1-orbit").
if ship:orbit:inclination < 5 {
run reorb(80000).
run incl.
run incl(6,Minmus:orbit:lan).

}
run reorb(80000).
wait until KUniverse:CANQUICKSAVE.
KUniverse:QUICKSAVETO("x2-pretransfer").
myquicksave("x2a-postincl").
if ship:apoapsis < 1000000*0.99 {
run reorb(1000000).
wait until KUniverse:CANQUICKSAVE.
KUniverse:QUICKSAVETO("x2-pretransfer").
}
myquicksave("x2b-pretransfer").
run tr_min.
} else {
}

if body = Minmus {
// In SOI of Minimus, but not yet on a stable orbit.
if ship:apoapsis < 0 OR ship:apoapsis > 100000 { run tr_min. }
}

if ship:apoapsis > 11000 { run reorb(10000). }
//if ship:orbit:inclination > 0.1 { run incl. }
wait until KUniverse:CANQUICKSAVE.
KUniverse:QUICKSAVETO("x3-dstorbit").
if ship:orbit:inclination > 0.1 { run incl. }
myquicksave("x6-minimus-orbit").
//run hit(0,6).
print "You arrived on Minmus!".

myexit().
33 changes: 29 additions & 4 deletions go_orb.ks
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
// Orbital Launch Control

run once libguido.
run once libtransfer.
myinit().

declare parameter apoa is 80000.
set v_target to vv_circular(apoa).

set incl to 0.

clearscreen.print "Orbital Launch Control v0.1".
print "Orbit: " + apoa + " m, " + incl + " deg".
clearscreen.

print "Orbital Launch Control v0.1".
print "
Orbit: " + apoa + " m, " + incl + " deg".

set alt_s to 1000.

Expand All @@ -27,6 +32,8 @@ if ship:altitude < 1000 {
} else if n = "KSS-2" {
set elist to list(e[2]).
print "Type: KSS-2 (single stage L)".
} else if n = "KSS-4" {
set elist to list(e[9],e[8],e[4]).
} else if n:startswith("KSS-") {
set elist to list(e[1],e[0]).
print "Type: KSS Launcher (LL).".
Expand All @@ -48,6 +55,8 @@ if ship:altitude < 1000 {
set elist to list(e[14],e[10], e[9]).
} else if n:startswith("Sat-1") {
set elist to list(e[5],e[4],e[3]).
} else if n:startswith("Sat-2") {
set elist to list(e[2],e[1],e[0]).
} else {
print "Unknown vessel. Abort!".
}
Expand Down Expand Up @@ -89,12 +98,20 @@ function eng_check {
}
}

// Main --------------------------------------------------
function u_status {
p_status("Rocket Launch "+mytimer(),0).
p_status("Alt: "+km(ship:altitude)+" / "+percent(ship:altitude,apoa),2).
p_status("AP: "+km(ship:apoapsis)+" / "+percent(ship:apoapsis,apoa),3).
p_status("v: "+round(ship:velocity:orbit:mag)+" m/s / "+percent(ship:velocity:orbit:mag,v_target),4).
}

// Main --------------------------------------------------

clr_status().

if ship:altitude < 1000 {

p_status("Launching.",0).
print " ". print "Launching.".
print "3". wait 1. print "2". wait 1. print "1". wait 1.
mytimer_s().
Expand All @@ -105,8 +122,12 @@ if ship:altitude < 1000 {
lock steering to heading(90,90).

// Initiate gravity turn
p_status("Ascent Phase I",0).
print mytimer()+"climb to grav turn at "+alt_s.
wait until ship:altitude > alt_s.
until ship:altitude > alt_s {
u_status().
wait 0.1.
}


// Raise orbit to 10k below apoapsis, wait until out of the athmosphere, stage if necessary
Expand All @@ -115,6 +136,7 @@ if ship:altitude < 1000 {
}

if ship:altitude < apoa*0.75 {
p_status("Ascent Phase II: 75% AP",0).
print mytimer()+"raising AP to 75% of target: "+floor(apoa*0.75).

until ship:altitude > 45000 {
Expand All @@ -126,13 +148,15 @@ if ship:altitude < apoa*0.75 {
else {lock throttle to 1.0.}

lock steering to heading(90,calc_angle(ship:altitude)).
u_status().
wait 0.2.
}
}

if ship:apoapsis < apoa*0.999 {
// Now we are out of the athmosphere and high. Raise orbit to apoapsis, stage if necessary
print mytimer()+"raising AP to 100% of target: "+floor(apoa).
p_status("Ascent Phase III: 100% AP",0).

lock steering to ship:prograde.

Expand All @@ -143,6 +167,7 @@ if ship:apoapsis < apoa*0.999 {
set app to ship:apoapsis/apoa.
if app > .999 {lock throttle to 0.0.}
else {lock throttle to 1.0.}
u_status().
wait 0.1.
}

Expand Down
Loading

0 comments on commit ef7cff5

Please sign in to comment.