I think this last bit should mostly function.

This commit is contained in:
Kenwood 2021-04-12 17:25:06 -04:00
parent 6b5b88286b
commit 253c9afca5
3 changed files with 28 additions and 25 deletions

View File

@ -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!").
}

View File

@ -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.
UNTIL false { // Run forever
SET MYSTEER TO HEADING(90,(altitude*23.3/body:atm:height)^0.7*15).
//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.
// 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.
OR SHIP:VERTICALSPEED > 20 // This is bad, we've started to fall down.
{
BREAK.
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.
}
PRINT "Waiting for ship to reach 100000".
UNTIL SHIP:APOAPSIS >= 100000 {
WAIT 0.5.
}
WAIT 0.5. // Run this loop every half second.
}
NOTIFY("We broke out of the ascent loop! If thats a good thing you'ld know.").
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

View File

@ -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").