Skip to content

PSG: JETTISON keeps dropping the burn it started on when a new Solution arrives - #2782

Closed
sarbian wants to merge 1 commit into
devfrom
fix/psg-jettison-latch
Closed

sarbian wants to merge 1 commit into
devfrom
fix/psg-jettison-latch

Conversation

@sarbian

@sarbian sarbian commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

A Solution solved before a jettison cut could land while JETTISON waited for KSP's staging cooldown. If its burn ended later, the state went back to BURNING and the cut engines were throttled up again. JETTISON now latches the burn it was entered for until its engines are gone.

Adds StaleSolutionInJettisonDoesNotRelightTheCutBooster (failed on dev ef54081).

Not tested: compiled only (MechJebLibTest Release, or MechJeb2.sln Debug). No unit test or flight was run on this branch.

From the review of #2776 and #2777: #2776 (comment)

A solve started before a jettison cut could land while JETTISON waited for KSP's staging cooldown. When its burn ended later than now, JettisonIndex went back to -1, the state returned to BURNING and the throttle came back up on the cut engines (a RealFuels engine with no relights is then lost). JETTISON now latches the flight plan index of the burn it was entered for until its engines are gone.

Test: StaleSolutionInJettisonDoesNotRelightTheCutBooster, failing on dev ef54081.
@github-actions

Copy link
Copy Markdown
Contributor

✅ Build Artifact 🚀

MechJeb2-d852294.zip (built from 1a5ed0f)

lamont-granquist added a commit that referenced this pull request Nov 21, 2026
A Solution solved before a jettison cut could land while JETTISON
waited for KSP's staging cooldown.  If it ended the burn later than
the one being cut, guidance went back to BURNING and throttled the cut
engines up again (#2782).  8b173b5a kept the PSG simulation from
handing such a Solution over, but the state machine still took one.

AscentStateMachine.TakesSolution is now the rule: PRELAUNCH, BURNING
and COASTING.  SetSolution refuses a Solution in any other state,
which extends its old refusal in terminal guidance and once finished.
The vertical ascent and the pitch program fly the pad Solution to
guidance, a jettison drops the burn its Solution cut, and terminal
guidance flies to the end of the Solution it started with.

The PSG autopilot passes TakesSolution through, and its SetSolution
returns whether the Solution was taken.  The simulation drops its own
copy of the rule: HandleDoneTask throws away a Solution SetSolution
refused, before any of its bookkeeping, and solves start only while
the autopilot TakesSolution.  The autopilot's IsTerminal, which
nothing used any more, is gone.

JettisonRefusesALateSolution is the scenario from #2782 (it lit the
cut booster twice before this).  ClimbRefusesALateSolution replaces
PitchProgramMeetsTheGuidanceOfANewSolutionAtOnce, which gave an ascent
engaged in flight its first Solution in the pitch program.  Ascents
engaged in flight aren't supported, and the pitch program now refuses
that Solution: the new test checks the refusal in the vertical ascent
and the pitch program of a pad launch, which keeps its pad Solution.
@lamont-granquist

Copy link
Copy Markdown
Collaborator

Fixed this instead by avoiding taking solutions in JETTISON: a348480

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants