Skip to content

Instantly share code, notes, and snippets.

Created September 6, 2014 14:16
Show Gist options
  • Save anonymous/2e5a906eeb5a407598cb to your computer and use it in GitHub Desktop.
Save anonymous/2e5a906eeb5a407598cb to your computer and use it in GitHub Desktop.
sas off.
print "[STATUS] Executing maneuver node.".
set n to nextnode.
set maxtwr to ship:maxthrust / ship:mass.
set dob to n:deltav:mag / maxtwr.
print "[DEBUG] Burn duration: " + dob.
lock steering to n:deltav.
wait until n:eta < dob / 2.
set remaining_time to n:deltav:mag / (throttle * ship:maxthrust / ship:mass).
print "foo " + remaining_time.
lock throttle to 1.
until remaining_time < 3 {
set remaining_time to n:deltav:mag / (throttle * ship:maxthrust / ship:mass).
print "foo " + remaining_time.
}.
lock throttle to (remaining_time / 3).
until remaining_time < 1 {
set remaining_time to n:deltav:mag / (throttle * ship:maxthrust / ship:mass).
print "foo " + remaining_time.
}.
lock throttle to 0.3.
until remaining_time < 0.1 {
set remaining_time to n:deltav:mag / (throttle * ship:maxthrust / ship:mass).
print remaining_time.
print "foo " + remaining_time.
}.
lock throttle to 0.
unlock throttle.
unlock steering.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment