Get full automation to orbit functioning.
This commit is contained in:
parent
2cceb5c0c1
commit
45cd517a2a
6 changed files with 55 additions and 31 deletions
38
execnode.ks
38
execnode.ks
|
@ -1,19 +1,35 @@
|
|||
runpathonce("lib/navigation").
|
||||
runpathonce("lib/throttle").
|
||||
runoncepath("lib/navigation").
|
||||
runoncepath("lib/throttle").
|
||||
|
||||
SAS off.
|
||||
local n is SHIP:NEXTNODE.
|
||||
local t is BurnTime(n:MAG)/2.
|
||||
local t is BurnTime(NEXTNODE:DELTAV:MAG)/2.
|
||||
|
||||
lock STEERING to n:DELTAV.
|
||||
wait until VectorAngle(SHIP:VELOCITY, STEERINGMANAGER:TARGET) <= 0.1.
|
||||
print "Adjusting heading".
|
||||
lock STEERING to NEXTNODE:DELTAV.
|
||||
wait until VectorAngle(SHIP:FACING:FOREVECTOR, STEERINGMANAGER:TARGET:FOREVECTOR) <= 0.1.
|
||||
|
||||
print "Warping to node".
|
||||
KUNIVERSE:WARP:WarpTo(n:TIME - t - 5).
|
||||
wait until n:ETA <= t.
|
||||
KUNIVERSE:TIMEWARP:WarpTo(NEXTNODE:TIME - t - 5).
|
||||
wait until NEXTNODE:ETA <= t.
|
||||
|
||||
// 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.
|
||||
}
|
||||
|
||||
lock THROTTLE to 1.0.
|
||||
wait until n:DELTAV:MAG <= 0.1. // todo: pid loop here or no?
|
||||
unlock THROTTLE.
|
||||
unlock STEERING.
|
||||
print "Node Executed. Have a nice day."
|
||||
SAS on.
|
||||
print "Node Executed. Have a nice day".
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue