// Wait until we have rotated to (approximately) that pitch...
wait until vectorangle(
SHIP:FACING:FOREVECTOR,
STEERINGMANAGER:TARGET:FOREVECTOR)
< 0.5.
// then wait until Prograde catches up (or passes us).
local targetPitch is GetPitch(STEERINGMANAGER:TARGET:FOREVECTOR).
wait until GetPitch(SHIP:SRFPROGRADE:FOREVECTOR) <= targetPitch.
print "Locking to prograde, letting gravity do the hard work.".
lock STEERING to GetAscentVector(MINIMUM_PITCH).
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.
lock THROTTLE to 0.0.
set SHIP:CONTROL:PILOTMAINTHROTTLE to 0.
wait 0.001. // make sure these control updates get applied