Various improvements, oops.

This commit is contained in:
Anna Rose Wiggins 2021-07-21 05:24:46 -04:00
parent e2653db827
commit c7438fcfe7
4 changed files with 125 additions and 72 deletions

View file

@ -15,18 +15,25 @@ wait until NEXTNODE:ETA <= (t/2).
// todo: pid loop here or nah? overshoot would be tricky to deal with...
print "Executing burn.".
local dvMin is NEXTNODE:DELTAV:MAG.
local throt is 1.0.
lock THROTTLE to throt.
local dvLast is NEXTNODE:DELTAV:MAG.
// debug
print "dVMin = " + dvMin.
print "dV = " + NEXTNODE:DELTAV:MAG.
// Execute the burn, throttling down by half every time we're
// consuming more than 25% of our dV in one update.
until NEXTNODE:DELTAV:MAG <= 0.25 {
local dvRem is NEXTNODE:DELTAV:MAG.
if dvRem < dvLast * 0.75 {
set throt to throt / 2.
until NEXTNODE:DELTAV:MAG <= 0.25 or dVMin < NEXTNODE:DELTAV:MAG {
// debug
print "dVMin = " + dvMin.
print "dV = " + NEXTNODE:DELTAV:MAG.
if NEXTNODE:DELTAV:MAG < dVMin {
set dvMin to NEXTNODE:DELTAV:MAG.
}
set dvLast to dvRem.
wait 0.001.
}
@ -34,3 +41,8 @@ unlock THROTTLE.
unlock STEERING.
SAS on.
print "Node execution complete.".
// debug
print "Final dVMin = " + dvMin.
print "Final dV = " + NEXTNODE:DELTAV:MAG.