Fix circularization code.
This commit is contained in:
parent
6ced7a2e25
commit
917d39d68d
|
@ -5,13 +5,13 @@
|
|||
deletepath("/boot/rocket").
|
||||
|
||||
// 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/throttle" to "1:/lib/throttle".
|
||||
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 core:bootfilename to "/ui/rocket".
|
||||
set core:bootfilename to "/init".
|
||||
|
||||
reboot.
|
||||
|
|
|
@ -17,13 +17,14 @@ function AddCircularizationNode {
|
|||
local n is Node(t, 0, 0, 0).
|
||||
add(n).
|
||||
|
||||
// move fast until we pass our target.
|
||||
until (usePeriapsis and n:ORBIT:APOAPSIS <= target) or n:ORBIT:PERIAPSIS >= target {
|
||||
set n:PROGRADE to n:PROGRADE + 1.
|
||||
}
|
||||
|
||||
// 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.
|
||||
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.
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user