Clean up UI and add TWR-lock that continues to give control over navigation.
This commit is contained in:
parent
f4fb3909e3
commit
f6731b0ab0
|
@ -1,4 +1,5 @@
|
|||
runoncepath("/lib/navigation").
|
||||
runoncepath("/lib/throttle").
|
||||
|
||||
function launchButtonPressed {
|
||||
// adjust torque settings here...
|
||||
|
@ -54,14 +55,16 @@ set x:AddButton("NODE"):onClick to {
|
|||
run "/execnode".
|
||||
}.
|
||||
|
||||
set x:AddButton("TWR"):onClick to {
|
||||
stk:ShowOnly(twrMenu).
|
||||
}.
|
||||
|
||||
|
||||
local stk is interface:AddStack().
|
||||
|
||||
// Build launch menu
|
||||
local launchMenu is stk:AddVLayout().
|
||||
|
||||
set btn to launchMenu:AddButton("Execute").
|
||||
set btn:onClick to launchButtonPressed@.
|
||||
|
||||
local launchConfig is launchMenu:AddScrollBox().
|
||||
|
||||
set sbox to launchConfig:AddHLayout().
|
||||
|
@ -88,23 +91,52 @@ set sbox to launchConfig:AddHLayout().
|
|||
sbox:AddLabel("Gravity Turn Pitch").
|
||||
local gravPitch is sbox:AddTextField("75").
|
||||
|
||||
launchConfig:AddSpacing(5).
|
||||
|
||||
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").
|
||||
set btn to launchMenu:AddButton("Execute").
|
||||
set btn:onClick to launchButtonPressed@.
|
||||
|
||||
// End Launch 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
|
||||
|
||||
// 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().
|
||||
|
||||
wait until false.
|
||||
|
|
Loading…
Reference in New Issue
Block a user