Skip to content

Instantly share code, notes, and snippets.

@KSAMissionCtrl
Created May 23, 2018 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KSAMissionCtrl/0a4092846240f8d7d1a11ddf98b24e25 to your computer and use it in GitHub Desktop.
Save KSAMissionCtrl/0a4092846240f8d7d1a11ddf98b24e25 to your computer and use it in GitHub Desktop.
FOR YOUR EYES ONLY
function reentry {
// keep tabs on our pitch angle - if we manage to make it to horizontal, pitch up 15 degrees and hold
if abs(pitch_for(ship)) < 1 {
set pitch to 15.
operations:remove("reentry").
output("Level glide achieved").
}
}
function coastToLanding {
if ship:status = "SPLASHED" {
output("Splashdown @ " + round(abs(chuteSpeed), 3) + "m/s, " + round(circle_distance(launchPosition, ship:geoposition, ship:orbit:body:radius)/1000, 3) + "km downrange").
landed().
} else if ship:status = "LANDED" {
output("Touchdown @ " + round(abs(chuteSpeed), 3) + "m/s, " + round(circle_distance(launchPosition, ship:geoposition, ship:orbit:body:radius)/1000, 3) + "km downrange").
landed().
} else if time:seconds - currTime >= logInterval { set chuteSpeed to ship:verticalspeed. }
}
function landed {
operations:remove("ongoingOps").
operations:remove("coastToLanding").
output("flight operations concluded").
// output one final log entry
if time:seconds - currTime >= logInterval {
set currTime to floor(time:seconds).
logTlm(currTime - launchTime).
} else {
when time:seconds - currTime >= logInterval then {
set currTime to floor(time:seconds).
logTlm(currTime - launchTime).
}
}
}
output("Return ops loaded").
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment