Refactor boot/os code, add graphical interface, more attempts to fix steering logic.
This commit is contained in:
parent
5cb608ff01
commit
5b9da6f0f1
|
@ -1,5 +1,11 @@
|
||||||
COPYPATH("0:/noop", "").
|
// rocketOS bootstrapping sequence
|
||||||
COMPILE "0:/launch" to "1:/launch".
|
|
||||||
COMPILE "0:/lib/guidance" to "1:/lib/guidance".
|
|
||||||
|
|
||||||
SET core:bootfilename to "noop".
|
// Install software.
|
||||||
|
compile "0:/os/rocketos" to "1:/boot/rocketos".
|
||||||
|
compile "0:/lib/guidance" to "1:/lib/guidance".
|
||||||
|
compile "0:/launch" to "1:/launch".
|
||||||
|
|
||||||
|
// Set OS to boot and restart.
|
||||||
|
set core:bootfilename to "boot/rocketos".
|
||||||
|
|
||||||
|
reboot.
|
||||||
|
|
24
launch.ks
24
launch.ks
|
@ -4,6 +4,11 @@ local APOAPSIS_TARGET is 80000.
|
||||||
local GRAVITY_TURN_START is 5000.
|
local GRAVITY_TURN_START is 5000.
|
||||||
SensorCheck().
|
SensorCheck().
|
||||||
|
|
||||||
|
// Configure subsystems.
|
||||||
|
CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Open Terminal").
|
||||||
|
RCS off.
|
||||||
|
SAS off.
|
||||||
|
|
||||||
// Countdowns are cute.
|
// Countdowns are cute.
|
||||||
print "Initiating automated launch sequence".
|
print "Initiating automated launch sequence".
|
||||||
from { local x is 5. } until x = 0 step { set x to x - 1. } do {
|
from { local x is 5. } until x = 0 step { set x to x - 1. } do {
|
||||||
|
@ -12,10 +17,6 @@ from { local x is 5. } until x = 0 step { set x to x - 1. } do {
|
||||||
}
|
}
|
||||||
print "Launching".
|
print "Launching".
|
||||||
|
|
||||||
// Disable subsystems.
|
|
||||||
RCS off.
|
|
||||||
SAS off.
|
|
||||||
|
|
||||||
// throttle controls
|
// throttle controls
|
||||||
when TWR() > 1.5 then {
|
when TWR() > 1.5 then {
|
||||||
if SHIP:ALTITUDE > 32000 {
|
if SHIP:ALTITUDE > 32000 {
|
||||||
|
@ -23,9 +24,7 @@ when TWR() > 1.5 then {
|
||||||
return false.
|
return false.
|
||||||
}
|
}
|
||||||
|
|
||||||
local newThrot is ThrottleToTWR(1.5).
|
lock THROTTLE to ThrottleToTWR(1.5).
|
||||||
print "Setting throttle to " + newThrot.
|
|
||||||
lock THROTTLE to newThrot.
|
|
||||||
return true.
|
return true.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,11 +38,18 @@ lock STEERING to heading(90, 85, -90).
|
||||||
|
|
||||||
wait until SHIP:ALTITUDE > GRAVITY_TURN_START.
|
wait until SHIP:ALTITUDE > GRAVITY_TURN_START.
|
||||||
print "Beginning gravity turn".
|
print "Beginning gravity turn".
|
||||||
until SHIP:APOAPSIS > 80000 {
|
until SHIP:ORBIT:APOAPSIS > 80000 {
|
||||||
local angle is max(30, SHIP:PROGRADE:PITCH - 2).
|
local adjustedPrograde is SHIP:ORBIT:PROGRADE * NORTH.
|
||||||
|
local angle is max(30, adjustedPrograde:pitch).
|
||||||
|
print "Adjusted Prograde = " + adjustedPrograde.
|
||||||
|
print "Angle = " + angle.
|
||||||
lock STEERING to heading(90, angle, -90).
|
lock STEERING to heading(90, angle, -90).
|
||||||
wait 0.001.
|
wait 0.001.
|
||||||
}
|
}
|
||||||
|
|
||||||
print "Releasing controls. Good luck, Kerman!".
|
print "Releasing controls. Good luck, Kerman!".
|
||||||
set THROTTLE to 0.0.
|
set THROTTLE to 0.0.
|
||||||
|
unlock THROTTLE.
|
||||||
|
unlock STEERING.
|
||||||
|
wait 5.
|
||||||
|
CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Close Terminal").
|
||||||
|
|
13
os/rocketos.ks
Normal file
13
os/rocketos.ks
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
function launchButtonPressed {
|
||||||
|
run "launch".
|
||||||
|
}
|
||||||
|
|
||||||
|
// Button panel
|
||||||
|
local interface is gui(200).
|
||||||
|
|
||||||
|
// Launch button
|
||||||
|
local launchButton is interface:addbutton("Launch").
|
||||||
|
set launchButton:onClick to launchButtonPressed@.
|
||||||
|
interface:show().
|
||||||
|
|
||||||
|
wait until false.
|
Loading…
Reference in New Issue
Block a user