37 lines
926 B
Plaintext
37 lines
926 B
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 throt is 1.0.
|
|
lock THROTTLE to throt.
|
|
local dvLast is 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.
|
|
}
|
|
set dvLast to dvRem.
|
|
wait 0.001.
|
|
}
|
|
|
|
unlock THROTTLE.
|
|
unlock STEERING.
|
|
SAS on.
|
|
print "Node execution complete.".
|