Add autostage option, fix bugs, tune things.
This commit is contained in:
parent
0481123487
commit
bbf1d118e3
3 changed files with 32 additions and 13 deletions
|
@ -13,6 +13,10 @@ function Land {
|
|||
|
||||
assumeControl().
|
||||
alignForHover().
|
||||
if done {
|
||||
restoreControl().
|
||||
return.
|
||||
}
|
||||
local pid is PIDLoop(0.1, 0.01, 0.01, 0, 1).
|
||||
|
||||
lock THROTTLE to pid:Update(TIME:SECONDS, SHIP:VERTICALSPEED).
|
||||
|
@ -34,6 +38,10 @@ function Hover {
|
|||
|
||||
assumeControl().
|
||||
alignForHover().
|
||||
if done {
|
||||
restoreControl().
|
||||
return.
|
||||
}
|
||||
local throttlePID is PIDLoop(0.1, 0.1, 0.001, 0, 1).
|
||||
set throttlePID:SETPOINT to vertSpeed.
|
||||
lock THROTTLE to throttlePID:Update(TIME:SECONDS, SHIP:VERTICALSPEED).
|
||||
|
@ -43,24 +51,30 @@ function Hover {
|
|||
restoreControl().
|
||||
}
|
||||
|
||||
function hoverVectorVac {
|
||||
parameter top.
|
||||
if SHIP:VERTICALSPEED > 0 {
|
||||
return SHIP:UP.
|
||||
}
|
||||
return LookDirUp(SHIP:SRFRETROGRADE:FOREVECTOR, top).
|
||||
}
|
||||
|
||||
function alignForHover {
|
||||
set cRot to SHIP:FACING:FOREVECTOR.
|
||||
set top to SHIP:FACING:FOREVECTOR.
|
||||
if ReadSensor("PRES") = 0 {
|
||||
// if we're in a vacuum, align with retrograde for smoother horizontal control.
|
||||
lock STEERING to LookDirUp(SHIP:SRFRETROGRADE:FOREVECTOR, cRot).
|
||||
lock STEERING to hoverDirVac(top).
|
||||
print "Aligning with retrograde.".
|
||||
wait until done or VAng(SHIP:FACING:FOREVECTOR, SHIP:SRFRETROGRADE:FOREVECTOR) < 1.
|
||||
wait until done or VAng(SHIP:FACING:FOREVECTOR, hoverDirVac():FOREVECTOR) < 1.
|
||||
if done {
|
||||
restoreControl().
|
||||
return.
|
||||
}
|
||||
} else {
|
||||
// ... otherwise just align vertically.
|
||||
lock STEERING to LookDirUp(SHIP:UP:FOREVECTOR, cRot).
|
||||
lock STEERING to LookDirUp(SHIP:UP:FOREVECTOR, top).
|
||||
print "Aligning vertical.".
|
||||
wait until done or VAng(SHIP:FACING:FOREVECTOR, SHIP:UP:FOREVECTOR) < 1.
|
||||
if done {
|
||||
restoreControl().
|
||||
return.
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue