Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clearscreen.
- print " ".
- print " ".
- if body:atm:oxygen = true {
- print " Begin Marauder launch sequence...".
- } else {
- print " ERROR!".
- wait 0.5.
- print " No oxygen detected".
- wait 0.5.
- print " Aborting launch".
- set x to 1/0.
- }
- set terminal:height to 30.
- set terminal:width to 40.
- set apo_PID to PIDLoop(0.25, 0.02, 0.005, 0, 1).
- set apo_PID:setpoint to 60.
- set tgtThrot to 1.
- set tgtVel to sqrt(body:mu / (body:radius + body:atm:height)) * 0.9.
- lock tgtApo to body:atm:height * 1.03 * (1 + ship:q).
- lock tgtETA to (body:atm:height * 0.01) * orbit:eccentricity.
- lock nucAlt to tgtApo * 0.33.
- lock rapAlt to tgtApo * 0.4.
- function vel_bearing {
- local trig_x is vdot(heading(90, 0):vector, facing:vector).
- local trig_y is vdot(heading(0, 0):vector, facing:vector).
- return mod(arctan2(trig_x, trig_y) + 360, 360).
- }
- function flightText {
- print round(altitude) + "m " at(13,4).
- print round(apoapsis) + "m " at(13,5).
- print round(tgtApo) + "m " at(13,6).
- print round(periapsis) + "m " at(13,7).
- print round(eta:apoapsis,2) + " " at(13,9).
- print round(tgtETA,2) + " " at(13,10).
- print round(tgtThrot,2) + " " at(13,12).
- print round(ship:availablethrust,2) + "kN " at(13,13).
- print round(vel_bearing(),2) + " " at(13,15).
- print round(ship:q,4) + " " at(13,16).
- print round(body:atm:altitudepressure(altitude),4) + " " at(13,17).
- }
- print "----------------------------------------".
- print " ALT: True:".
- print " APO: NOW:".
- print " APO: TRGT:".
- print " Periapsis:".
- print " ".
- print " ETA: NOW:".
- print " ETA: TRGT:".
- print " ".
- print " Throttle:".
- print " Thrust:".
- print " ".
- print " Bearing:".
- print " Pressure:".
- print " Atmosphere:".
- print "----------------------------------------".
- print " STATE".
- print "NEXT AT" at(20,19).
- wait 1.
- stage.
- sas off.
- brakes off.
- print " Launch".
- print "Airspeed: 50m/s" at(20,20).
- lock throttle to tgtThrot.
- wait until airspeed > 50.
- print " Take-off".
- print "Altitude: 20m" at(20,21).
- lock steering to heading(90,10).
- wait until alt:radar > 20.
- print " Flight".
- print "Altitude:" at(20,22).
- lock steering to heading(90,15).
- gear off.
- until altitude > nucalt {
- flightText().
- print round(nucAlt) + "m" at(31,22).
- }
- print " Nuclear stage".
- print "Altitude:" at(20,23).
- lock tgtThrot to 1 - ship:q.
- toggle ag4.
- until altitude > rapAlt {
- flightText().
- print round(rapAlt) + "m" at(31,23).
- }
- print " Closed cycle".
- print "Airspeed: " + round(tgtVel) + "m/s" at(20,24).
- toggle ag3.
- until velocity:orbit:mag > tgtVel { flightText(). }
- toggle ag5.
- print " RAPIER shutdown".
- print "Apoapsis:" at(20,25).
- until apoapsis > tgtApo {
- flightText().
- print round(tgtApo) + "m" at(31,25).
- }
- print " Burn complete".
- print "Altitude: " + body:atm:height + "m" at(20,26).
- lock steering to prograde.
- until altitude > body:atm:height {
- flightText().
- set apo_PID:setpoint to tgtETA.
- set tgtThrot to apo_PID:update(time:seconds, eta:apoapsis).
- }
- print " Circularization".
- print "Periapsis:" at(20,27).
- lock steering to vxcl(up:vector, prograde:vector).
- toggle ag10.
- until periapsis > altitude * 0.99 {
- flightText().
- print round(altitude * 0.99) + "m" at(31,27).
- set apo_PID:setpoint to tgtETA.
- set tgtThrot to apo_PID:update(time:seconds, eta:apoapsis).
- }
- flightText().
- print " Orbit - manual controls".
- set ship:control:pilotmainthrottle to 0.
- lock throttle to 0.
- unlock all.
- sas on.
Add Comment
Please, Sign In to add comment