Clean up UI and add TWR-lock that continues to give control over navigation.

This commit is contained in:
Anna Rose 2021-07-26 15:13:03 -04:00
parent f4fb3909e3
commit f6731b0ab0

View File

@ -1,4 +1,5 @@
runoncepath("/lib/navigation"). runoncepath("/lib/navigation").
runoncepath("/lib/throttle").
function launchButtonPressed { function launchButtonPressed {
// adjust torque settings here... // adjust torque settings here...
@ -54,14 +55,16 @@ set x:AddButton("NODE"):onClick to {
run "/execnode". run "/execnode".
}. }.
set x:AddButton("TWR"):onClick to {
stk:ShowOnly(twrMenu).
}.
local stk is interface:AddStack(). local stk is interface:AddStack().
// Build launch menu // Build launch menu
local launchMenu is stk:AddVLayout(). local launchMenu is stk:AddVLayout().
set btn to launchMenu:AddButton("Execute").
set btn:onClick to launchButtonPressed@.
local launchConfig is launchMenu:AddScrollBox(). local launchConfig is launchMenu:AddScrollBox().
set sbox to launchConfig:AddHLayout(). set sbox to launchConfig:AddHLayout().
@ -88,23 +91,52 @@ set sbox to launchConfig:AddHLayout().
sbox:AddLabel("Gravity Turn Pitch"). sbox:AddLabel("Gravity Turn Pitch").
local gravPitch is sbox:AddTextField("75"). local gravPitch is sbox:AddTextField("75").
launchConfig:AddSpacing(5). set btn to launchMenu:AddButton("Execute").
set btn:onClick to launchButtonPressed@.
set sbox to launchConfig:AddHLayout().
sbox:AddLabel("Torque Epsilon Max").
local maxEpsilon is sbox:AddTextField("0.001").
set sbox to launchConfig:AddHLayout().
sbox:AddLabel("Max Stopping Time").
local maxStopTime is sbox:AddTextField("2.0").
// End Launch Menu // End Launch Menu
// Build conf menu // Build conf menu
local confMenu is stk:AddVLayout().
local confBox is confMenu:AddScrollbox().
set sbox to confBox:AddHLayout().
sbox:AddLabel("Torque Epsilon Max").
local maxEpsilon is sbox:AddTextField("0.001").
set sbox to confBox:AddHLayout().
sbox:AddLabel("Max Stopping Time").
local maxStopTime is sbox:AddTextField("2.0").
set btn to confMenu:AddButton("Apply").
set btn:onClick to {
set STEERINGMANAGER:TORQUEEPSILONMAX to maxEpsilon:TEXT:ToNumber().
set STEERINGMANAGER:MAXSTOPPINGTIME to maxStopTime:TEXT:ToNumber().
}.
// end conf menu // end conf menu
// twr menu
local twrMenu is stk:AddVLayout().
set sbox to twrMenu:AddHLayout().
sbox:AddLabel("Target TWR").
local twrLock is sbox:AddTextField("1.6").
set twrMenu:AddButton("Lock TWR"):onClick to {
local done is false.
on AG9 {
set done to true.
}
local tgt is twrLock:TEXT:ToNumber().
lock THROTTLE to ThrottleToTWR(tgt).
wait until done.
}.
// end twr menu
interface:show(). interface:show().
wait until false. wait until false.