Fix circularization code.
This commit is contained in:
parent
6ced7a2e25
commit
917d39d68d
|
@ -5,13 +5,13 @@
|
||||||
deletepath("/boot/rocket").
|
deletepath("/boot/rocket").
|
||||||
|
|
||||||
// Install software.
|
// Install software.
|
||||||
compile "0:/ui/rocket" to "1:/ui/rocket".
|
compile "0:/ui/rocket" to "1:/init".
|
||||||
compile "0:/lib/navigation" to "1:/lib/navigation".
|
compile "0:/lib/navigation" to "1:/lib/navigation".
|
||||||
compile "0:/lib/throttle" to "1:/lib/throttle".
|
compile "0:/lib/throttle" to "1:/lib/throttle".
|
||||||
compile "0:/launch" to "1:/launch".
|
compile "0:/launch" to "1:/launch".
|
||||||
copypath("0:/execnode", "1:/execnode"). // smaller when compiled
|
copypath("0:/execnode", "1:/execnode"). // larger when compiled
|
||||||
|
|
||||||
// Set OS to boot and restart.
|
// Set OS to boot and restart.
|
||||||
set core:bootfilename to "/ui/rocket".
|
set core:bootfilename to "/init".
|
||||||
|
|
||||||
reboot.
|
reboot.
|
||||||
|
|
|
@ -17,13 +17,14 @@ function AddCircularizationNode {
|
||||||
local n is Node(t, 0, 0, 0).
|
local n is Node(t, 0, 0, 0).
|
||||||
add(n).
|
add(n).
|
||||||
|
|
||||||
// move fast until we pass our target.
|
local delta is 1.
|
||||||
until (usePeriapsis and n:ORBIT:APOAPSIS <= target) or n:ORBIT:PERIAPSIS >= target {
|
local diff is n:ORBIT:APOAPSIS - n:ORBIT:PERIAPSIS.
|
||||||
set n:PROGRADE to n:PROGRADE + 1.
|
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.
|
||||||
// now bring it back in real slow until we come back.
|
|
||||||
until (usePeriapsis and n:ORBIT:APOAPSIS > target) or n:ORBIT:PERIAPSIS < target {
|
|
||||||
set n:PROGRADE to n:PROGRADE - 0.01.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user