Initial cleanup of ascent logic, not tested
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
copyPath("0:/ascent.ks", "1:/ascent.ks").
|
||||
copyPath("0:/maneuver.ks", "1:/maneuver.ks").
|
||||
copyPath("0:/staging.ks", "1:/staging.ks").
|
||||
run once ascent.
|
||||
|
||||
wait until ship:unpacked.
|
||||
core:part:getmodule("kOSProcessor"):doevent("Open Terminal").
|
||||
|
||||
basicAscent(90, 80000).
|
||||
|
||||
core:part:getmodule("kOSProcessor"):doevent("Close Terminal").
|
||||
@@ -1,97 +0,0 @@
|
||||
//hellolaunch
|
||||
set TARGET_ALTITUDE to 80000.
|
||||
set ETA_TARGET to 60.
|
||||
|
||||
//First, we'll clear the terminal screen to make it look nice
|
||||
wait until ship:unpacked.
|
||||
clearscreen.
|
||||
|
||||
core:part:getmodule("kOSProcessor"):doevent("Open Terminal").
|
||||
|
||||
lock throttle to 1.0.
|
||||
|
||||
//This is our countdown loop, which cycles from 10 to 0
|
||||
print "Counting down:".
|
||||
from {local countdown is 5.} until countdown = 0 step {set countdown to countdown - 1.} do {
|
||||
print "..." + countdown.
|
||||
wait 1. // pauses the script here for 1 second.
|
||||
}
|
||||
|
||||
when maxThrust = 0 then {
|
||||
print "Staging".
|
||||
stage.
|
||||
preserve.
|
||||
}.
|
||||
|
||||
// GRAVITY TURN
|
||||
|
||||
// pitch to 80 degrees over the first 100 m/s
|
||||
set tarSteer to heading(90, 90).
|
||||
lock steering to tarSteer.
|
||||
until ship:velocity:surface:mag >= 100 {
|
||||
set tarSteer to heading(90, 90 - (ship:velocity:surface:mag / 10)).
|
||||
wait 0.
|
||||
}
|
||||
|
||||
print "Finished initial pitch".
|
||||
|
||||
// actual gravity turn
|
||||
lock steering to ship:srfprograde.
|
||||
// lock steering to heading(90, max(90 - vang(ship:up:vector, ship:srfprograde:vector), 10)).
|
||||
// wait until eta:apoapsis > 45.
|
||||
|
||||
// // burn to target apoapsis
|
||||
// clearscreen.
|
||||
// set circ_pid to pidloop(1/30, 0, 0, 0, 1).
|
||||
// set circ_pid:setpoint to ETA_TARGET.
|
||||
|
||||
// set gravThrottle to 1.0.
|
||||
// lock throttle to gravThrottle.
|
||||
// until apoapsis >= TARGET_ALTITUDE {
|
||||
// set gravThrottle to circ_pid:update(time:seconds, eta:apoapsis).
|
||||
// print "Throttle: " + round(100 * gravThrottle, 0) + "%" at (0, 0).
|
||||
// print "ETA: " + round(eta:apoapsis, 0) at (0, 1).
|
||||
// wait 0.
|
||||
// }
|
||||
|
||||
// clearscreen.
|
||||
|
||||
wait until ship:apoapsis >= TARGET_ALTITUDE.
|
||||
print "80km apoapsis reached".
|
||||
lock throttle to 0.
|
||||
lock steering to ship:prograde.
|
||||
|
||||
wait until ship:altitude >= 70000.
|
||||
|
||||
// try to get apoapsis closer to target
|
||||
if ship:apoapsis < TARGET_ALTITUDE and eta:apoapsis > 30 {
|
||||
lock throttle to 1.
|
||||
wait until ship:apoapsis >= TARGET_ALTITUDE.
|
||||
lock throttle to 0.
|
||||
}
|
||||
|
||||
wait until eta:apoapsis < 30.
|
||||
|
||||
// CIRCULARIZATION CALCS
|
||||
set circThrottle to 0.
|
||||
lock throttle to circThrottle.
|
||||
set throttlePID to pidLoop(0.25, 0, 0, 0, 1).
|
||||
set throttlePID:setpoint to 15.
|
||||
|
||||
set circPitch to 0.
|
||||
lock steering to heading(90, circPitch).
|
||||
set pitchPID to pidLoop(1, 0, 0, -10, 10).
|
||||
set pitchPID:setpoint to 15.
|
||||
|
||||
until apoapsis - periapsis < 100 or periapsis > TARGET_ALTITUDE {
|
||||
set circThrottle to max(0.1, throttlePID:update(time:seconds, eta:apoapsis)).
|
||||
set circPitch to pitchPID:update(time:seconds, eta:apoapsis).
|
||||
wait 0.
|
||||
}
|
||||
|
||||
unlock steering.
|
||||
unlock throttle.
|
||||
wait 1.
|
||||
|
||||
set ship:control:pilotmainthrottle to 0.
|
||||
print "Circularized.".
|
||||
Reference in New Issue
Block a user