Get full automation to orbit functioning.

This commit is contained in:
Anna Rose Wiggins 2021-07-20 02:38:29 -04:00
parent 2cceb5c0c1
commit 45cd517a2a
6 changed files with 55 additions and 31 deletions

View file

@ -28,15 +28,16 @@ function AddCircularizationNode {
}
local n is Node(t, 0, 0, 0).
add(n).
local delta is 1.
local diff is n:ORBIT:APOAPSIS - n:ORBIT:PERIAPSIS.
until (diff < 1000) {
set n:PROGRADE to n:PROGRADE + delta.
local newDiff is n:ORBIT:APOAPSIS - n:ORBIT:PERIAPSIS.
if newDiff > diff {
set delta to (delta * -1) / 10.
}
set diff to newDiff.
local epsilon is 100.
lock diff to n:ORBIT:APOAPSIS - n:ORBIT:PERIAPSIS.
local pid is PIDLoop(0.05, 0.006, 0.006).
set pid:EPSILON to epsilon.
set pid:SETPOINT to n:ORBIT:APOAPSIS.
until abs(diff) < epsilon {
print diff.
set n:PROGRADE to pid:Update(TIME:SECONDS, n:ORBIT:PERIAPSIS).
wait 0.001.
}
}