node based orbit circularization
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
wait until ship:unpacked.
|
||||
clearscreen.
|
||||
copyPath("0:/defaults", "").
|
||||
run "defaults".
|
||||
|
||||
import("genericOrbit").
|
||||
@@ -0,0 +1,26 @@
|
||||
import("library/lib_ascent").
|
||||
runOncePath("0:/library/lib_input_terminal").
|
||||
|
||||
|
||||
CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Open Terminal").
|
||||
|
||||
print "Enter Launch Profile: ".
|
||||
set profile to terminal_input_number(22, 0, 4, 1.2).
|
||||
print "Verical Ascent: ".
|
||||
set turn_start to terminal_input_number(16, 1, 6, 1000).
|
||||
print "Target Orbit: ".
|
||||
set target_orbit to terminal_input_number(14, 2, 8, 120000).
|
||||
print "Inclination: ".
|
||||
set inclination to terminal_input_number(13, 3, 8, 0).
|
||||
|
||||
print "Waiting for Engine Start...".
|
||||
WaitForEngineStart().
|
||||
clearScreen.
|
||||
|
||||
sas off.
|
||||
Ascent(target_orbit:toscalar(0), turn_start:toscalar(0), profile:toscalar(0), 3, inclination:toscalar(0)).
|
||||
|
||||
|
||||
CORE:PART:GETMODULE("kOSProcessor"):DOEVENT("Close Terminal").
|
||||
sas on.
|
||||
SHUTDOWN.
|
||||
+15
-1
@@ -60,6 +60,9 @@ declare function Ascent{
|
||||
}else if circ = 3 {
|
||||
lock steering to heading(head, 0, 270).
|
||||
CreateCircularizationNode(apoapsis).
|
||||
// if periapsis < targetOrbit and eta:apoapsis < orbit:period / 2{
|
||||
// CreateCircularizationNode(apoapsis).
|
||||
// }
|
||||
}
|
||||
|
||||
set isDone to true.
|
||||
@@ -115,6 +118,17 @@ local function CreateCircularizationNode{
|
||||
|
||||
wait until altitude > 80000.
|
||||
local burnDv is CalculateCircularizationDV(tgt, orbit:semimajoraxis).
|
||||
set circNode to Node(eta:apoapsis, 0, 0, burnDv).
|
||||
set circNode to Node(time:seconds + eta:apoapsis, 0, 0, burnDv).
|
||||
add circNode.
|
||||
wait 0.01.
|
||||
lock steering to circNode:burnvector.
|
||||
local burnDuration is CalculateMultiStageBurnDuration(burnDv).
|
||||
wait until circNode:eta <= burnDuration /2.
|
||||
lock throttle to 1.
|
||||
wait until nextNode:deltav:mag <= 10.
|
||||
lock throttle to 0.5.
|
||||
wait until NEXTNODE:deltav:mag <= 1.
|
||||
remove nextNode.
|
||||
lock throttle to 0.
|
||||
wait until throttle = 0.
|
||||
}
|
||||
|
||||
+5
-20
@@ -7,26 +7,11 @@ declare function Lerp{
|
||||
|
||||
declare function Map{
|
||||
parameter value.
|
||||
parameter low1.
|
||||
parameter high1.
|
||||
parameter low2.
|
||||
parameter high2.
|
||||
return low2 + (high2 - low2) * ((value - low1) / (high1 - low1)).
|
||||
}
|
||||
|
||||
declare function ApproximateExp {
|
||||
parameter x.
|
||||
local result is 1.0.
|
||||
local xPower is 1.0.
|
||||
local nFact is 1.0.
|
||||
|
||||
// Loop 4 times (for terms 1 through 4, total 5 terms)
|
||||
from { local n is 1.} until n = 5 step {set n to n + 1.} do {
|
||||
SET xPower TO xPower * x.
|
||||
SET nFact TO nFact * n.
|
||||
SET result TO result + (xPower / nFact).
|
||||
}
|
||||
RETURN result.
|
||||
parameter a1.
|
||||
parameter a2.
|
||||
parameter b1.
|
||||
parameter b2.
|
||||
return b1 + (b2 - b1) * ((value - a1) / (a2 - a1)).
|
||||
}
|
||||
|
||||
declare function EaseOutExpo {
|
||||
|
||||
Reference in New Issue
Block a user