Arbitrary function name change seems to have fixed strange runtime bug.

This commit is contained in:
Anna Rose 2021-08-21 04:49:34 -04:00
parent 15c479cd18
commit 55af841aeb

View File

@ -2,14 +2,12 @@ RunOncePath("lib/throttle").
RunOncePath("lib/navigation"). RunOncePath("lib/navigation").
// Calculate the direction to lock during ascent. // Calculate the direction to lock during ascent.
function getAscentDir { function getClampedDir {
parameter leadAngle is 5.
parameter minPitch is 5. parameter minPitch is 5.
// face just beneath prograde, but hold a solid eastern heading and don't // face just beneath prograde, but hold a solid eastern heading and don't
// rotate the ship // rotate the ship
local newHeading is lookdirup(SHIP:SRFPROGRADE:FOREVECTOR, heading(90, 0, 270):TOPVECTOR). local newHeading is lookdirup(SHIP:SRFPROGRADE:FOREVECTOR, heading(90, 0, 270):TOPVECTOR).
set newHeading to angleaxis(leadAngle, newHeading:TOPVECTOR)*newHeading.
if getPitch(newHeading:FOREVECTOR) < minPitch { if getPitch(newHeading:FOREVECTOR) < minPitch {
set newHeading to heading(90, minPitch, 270). set newHeading to heading(90, minPitch, 270).
} }
@ -88,7 +86,7 @@ function Launch {
wait pitchTime. wait pitchTime.
print "Phase 3: Stable Prograde Boost.". print "Phase 3: Stable Prograde Boost.".
lock STEERING to getAscentDir(0, minPitch). lock STEERING to getClampedDir(minPitch).
wait until SHIP:ORBIT:APOAPSIS > apoapsisTarget. wait until SHIP:ORBIT:APOAPSIS > apoapsisTarget.
// TODO: A smoother approach based on target orbital velocity should be considered. // TODO: A smoother approach based on target orbital velocity should be considered.