Refactor and clean up lots of code.

This commit is contained in:
Anna Rose 2021-08-01 17:53:09 -04:00
parent 94c374fcf4
commit a4d79c9826
9 changed files with 30 additions and 32 deletions

View File

@ -1,8 +1,7 @@
deletepath("/boot/helicopter").
copypath("0:/lib/control", "1:/lib/control").
copypath("0:/helicopter/hover", "1:/hover").
copypath("0:/helicopter/init", "1:/init").
compile "0:/lib/stabilize_helicopter" to "1:/lib/".
comiple "0:/init/helicopter" to "1:/init".
// Set OS to boot and restart.
set core:bootfilename to "/init".

View File

@ -1,6 +1,5 @@
copypath("0:/lib/control", "1:/lib/control").
copypath("0:/helicopter/hover", "1:/hover").
copypath("0:/helicopter/init", "1:/init").
copypath("0:/lib/stabilize_helicopter", "1:/lib/stabilize_helicopter").
copypath("0:/init/helicopter", "1:/init").
CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Open Terminal").
run "1:/init".

View File

@ -5,10 +5,10 @@
deletepath("/boot/rocket").
// Install software.
compile "0:/lib/navigation" to "1:/lib/navigation".
compile "0:/lib/throttle" to "1:/lib/throttle".
compile "0:/lib/stabilize_rocket" to "1:/lib/stabilize_rocket".
compile "0:/rocket/init" to "1:/init".
compile "0:/lib/navigation" to "1:/lib/".
compile "0:/lib/throttle" to "1:/lib/".
compile "0:/lib/stabilize_rocket" to "1:/lib/".
compile "0:/init/rocket" to "1:/init".
compile "0:/rocket/launch" to "1:/launch".
copypath("0:/rocket/execnode", "1:/execnode").

View File

@ -2,8 +2,9 @@
copypath("0:/lib/navigation", "1:/lib/navigation").
copypath("0:/lib/throttle", "1:/lib/throttle").
copypath("0:/lib/stabilize_rocket", "1:/lib/stabilize_rocket").
copypath("0:/rocket/init", "1:/init").
copypath("0:/init/rocket", "1:/init").
copypath("0:/rocket/launch", "1:/launch").
copypath("0:/rocket/execnode", "1:/execnode").
run "init".
CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Open Terminal").
run "1:/init".

View File

@ -1,4 +0,0 @@
// This script assumes you have bound collective (aka deploy angle) to main throttle.
runoncepath("lib/control").
PointStabilizeH().

View File

@ -3,9 +3,15 @@
// * AG9 is unmapped.
// * Main throttle controls collective.
runoncepath("lib/control").
runoncepath("lib/stabilize_helicopter").
global done is false.
on AG9 {
set done to true.
return true.
}
clearguis().
// Main UI.
local interface is gui(250, 300).
@ -32,12 +38,6 @@ set x:AddButton("LAND"):onClick to {
PointStabilizeH(-5).
}.
on AG9 {
set done to true.
return true.
}
interface:show().
wait until false.

View File

@ -1,14 +1,15 @@
// functions that execute comprehensive control schemes.
// Provides stabilization functions, including Hover.
//
// These typically assume a global variable 'done' that will be
// set externally when they should return.
// Must define a global variable 'done', which can be set to true to cancel
// control functions.
//
// Do not include both this and stabilize_rocket.ks in one program.
// Helicopter-style point stability control.
// Hover, ascend, or descend at a fixed rate.
// Adjusts the throttle to control ascent or descent.
// Adjusts pitch and roll to maintain zero lateral velocity.
function PointStabilizeH {
function Hover {
parameter vertSpeed is 0.0.
set done to false.

View File

@ -1,10 +1,12 @@
// Provides stabilization functions, including Hover.
// Control functions can be canceled by actuating Action Group 9.
//
// Must define a global variable 'done', which can be set to true to cancel
// control functions.
//
// Do not include both this and stabilize_helicopter.ks in one program.
// Stabilizes a rocket relative to the surface, with optional vertical
// velocity. Do not include both this and stabilize_helicopter.ks in one
// program.
// velocity.
function Hover {
parameter vertSpeed is 0.0.