49 lines
1.1 KiB
Plaintext
49 lines
1.1 KiB
Plaintext
runoncepath("lib/navigation").
|
|
runoncepath("lib/throttle").
|
|
|
|
SAS off.
|
|
local t is BurnTime(NEXTNODE:DELTAV:MAG).
|
|
|
|
print "Adjusting heading".
|
|
lock STEERING to NEXTNODE:DELTAV.
|
|
wait until VectorAngle(SHIP:FACING:FOREVECTOR, STEERINGMANAGER:TARGET:FOREVECTOR) <= 0.1.
|
|
|
|
print "Warping to node.".
|
|
KUNIVERSE:TIMEWARP:WarpTo(NEXTNODE:TIME - (t/2) - 5).
|
|
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.
|
|
|
|
// 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 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.
|
|
}
|
|
|
|
wait 0.001.
|
|
}
|
|
|
|
unlock THROTTLE.
|
|
unlock STEERING.
|
|
SAS on.
|
|
print "Node execution complete.".
|
|
|
|
// debug
|
|
print "Final dVMin = " + dvMin.
|
|
print "Final dV = " + NEXTNODE:DELTAV:MAG.
|
|
|