diff --git a/RadarrSeries/boot.ks b/RadarrSeries/boot.ks index d9145a0..c078bb8 100644 --- a/RadarrSeries/boot.ks +++ b/RadarrSeries/boot.ks @@ -29,7 +29,7 @@ NOTIFY("Program compiled and ready to run."). IF alt:radar < 100 { // If our radar alt is lower than 10 WAIT 5. - RUN ascent.ks. // Run the ascent stage! + RUN ascent. // Run the ascent stage! } ELSE { NOTIFY("System booted but did not pass pre-flight checks, aborting excecution!"). } diff --git a/RadarrSeries/radarr_kerbin.ks b/RadarrSeries/radarr_kerbin.ks index 01d9e9f..3817161 100644 --- a/RadarrSeries/radarr_kerbin.ks +++ b/RadarrSeries/radarr_kerbin.ks @@ -2,16 +2,15 @@ CLEARSCREEN. // Clear the screen NOTIFY("Ascent software ready."). +FUNCTION getAscentAngle { + PARAMETER targetHeight. + + RETURN 90 - ((altitude / targetHeight) * 90). +} + // Lock throttle to 1, (throttle up) LOCK THROTTLE TO 1.0. // 1.0 is the max, 0.0 is idle. -// Countdown from 10! -NOTIFY("Counting down:"). -FROM {local countdown is 10.} UNTIL countdown = 0 STEP {SET countdown to countdown - 1.} DO { - NOTIFY(countdown, 1). // Notify the countdown number and keep the number for 1 second. - WAIT 1. // pauses the script here for 1 second. -} - // First goal should be to get into space, // I found this rule of thumb expression " // (altitude*23.3/body:atm:height)^0.7*15. @@ -19,24 +18,28 @@ FROM {local countdown is 10.} UNTIL countdown = 0 STEP {SET countdown to countdo CLEARSCREEN. // Clear the screen. -SET MYSTEER TO HEADING(90,90). // Default to up -LOCK STEERING TO MYSTEER. // Set steering to the value of MYSTEER, when it updates so will our steering. +//SET MYSTEER TO HEADING(90,90). // Default to up +//LOCK STEERING TO MYSTEER. // Set steering to the value of MYSTEER, when it updates so will our steering. -UNTIL false { // Run forever - - SET MYSTEER TO HEADING(90,(altitude*23.3/body:atm:height)^0.7*15). - - // One of these conditions must be met to call a break in this ascent! - IF SHIP:APOAPSIS > 100000 // This is good! We made it to space! - OR SHIP:VERTICALSPEED > 0 // This is bad, we've started to fall down. - { - BREAK. - } - - WAIT 0.5. // Run this loop every half second. +// One of these conditions must be met to call a break in this ascent! +IF SHIP:APOAPSIS > 100000 // This is good! We made it to space! +OR SHIP:VERTICALSPEED > 20 // This is bad, we've started to fall down. +{ + PRINT NOTIFY("We broke out of the ascent loop! If thats a good thing you'ld know."). +} ELSE { + LOCK STEERING TO HEADING(90,(getAscentAngle(100000))). + STAGE. } -NOTIFY("We broke out of the ascent loop! If thats a good thing you'ld know."). + +PRINT "Waiting for ship to reach 100000". +UNTIL SHIP:APOAPSIS >= 100000 { + WAIT 0.5. +} + +WAIT 0.5. // Run this loop every half second. + + LOCK THROTTLE TO 0. // Throttle back SET SHIP:CONTROL:PILOTMAINTHROTTLE TO 0. // Protects the throttle from "jumping" when we hand control back to the pilot diff --git a/boot/tagBoot.ks b/boot/tagBoot.ks index 2581fb6..d90e9ac 100644 --- a/boot/tagBoot.ks +++ b/boot/tagBoot.ks @@ -8,9 +8,9 @@ CLEARSCREEN. core:part:getmodule("kOSProcessor"):doevent("Open Terminal"). // Open the terminal on boot! PRINT "Using TagBoot ver 1.0". -WAIT 5. +WAIT 0.1. PRINT "Booting with tag " + core:part:tag + "...". -WAIT 5. +WAIT 0.5. // reddit says the path cant be fully qualified (no 0:/) COPYPATH("0:/" + core:part:tag + "/boot.ks", "1:/boot/boot.ks").