Clean up some variable names.

This commit is contained in:
Anna Rose 2021-08-20 19:37:48 -04:00
parent bf31b4133d
commit aa59db4f82

View File

@ -5,6 +5,7 @@ RunOncePath("lib/navigation").
function getAscentDir {
parameter leadAngle is 5.
parameter minPitch is 5.
// face just beneath prograde, but hold a solid eastern heading and don't
// rotate the ship
local newHeading is lookdirup(SHIP:SRFPROGRADE:FOREVECTOR, heading(90, 0, 270):TOPVECTOR).
@ -22,13 +23,12 @@ function getPitch {
}
function Launch {
parameter APOAPSIS_TARGET is 80000.
parameter ATMO_TWR is 1.6.
parameter GRAVITY_TURN_START is 8000.
parameter LEAD_ANGLE is 5.
// parameter INITIAL_PITCH is 85.
parameter MINIMUM_PITCH is 5.
parameter AUTOSTAGE is true.
parameter apoapsisTarget is 80000.
parameter atmoTWR is 1.8.
parameter gravityTurnStart is 8000.
parameter leadAngle is 5.
parameter minPitch is 5.
parameter autoStage is true.
// Configure subsystems.
RCS off.
@ -43,9 +43,9 @@ function Launch {
// staging logic. Stage as many times as needed until we finish ascent.
// Once Apo target is attained just drop this trigger.
if AUTOSTAGE {
when FlameOut() or SHIP:ORBIT:APOAPSIS > APOAPSIS_TARGET then {
if SHIP:ORBIT:APOAPSIS > APOAPSIS_TARGET {
if autoStage {
when FlameOut() or SHIP:ORBIT:APOAPSIS > apoapsisTarget then {
if SHIP:ORBIT:APOAPSIS > apoapsisTarget {
return false.
}
stage.
@ -56,21 +56,21 @@ function Launch {
// Hold throttle to maintain target TWR.
// We do *not* use a PID Loop here because we can
// calculate the correct value discretely.
lock THROTTLE to ThrottleToTWR(ATMO_TWR).
print "Throttling to maintain a TWR of " + ATMO_TWR.
lock THROTTLE to ThrottleToTWR(atmoTWR).
print "Throttling to maintain a TWR of " + atmoTWR.
// Main ascent control.
lock STEERING to heading(90,90,270).
lock STEERING to Heading(90,90,270).
stage.
wait until SHIP:ALTITUDE > GRAVITY_TURN_START.
wait until SHIP:ALTITUDE > gravityTurnStart.
print "Turning gravity...".
lock STEERING to getAscentDir(LEAD_ANGLE, MINIMUM_PITCH).
lock STEERING to getAscentDir(leadAngle, minPitch).
wait until SHIP:ALTITUDE > 32000. // todo: if we have a pressure sensor we can use it to decide when to kick the throttle up instead, neat solution for e.g. Duna and Eve.
lock THROTTLE to 1.0.
wait until SHIP:ORBIT:APOAPSIS > APOAPSIS_TARGET.
wait until SHIP:ORBIT:APOAPSIS > apoapsisTarget.
lock THROTTLE to 0.0.
set SHIP:CONTROL:PILOTMAINTHROTTLE to 0.