Skip to content

PSG autopilot: the forward RCS goes through Drive - #2784

Merged
sarbian merged 1 commit into
devfrom
fix/psg-rcs-forward-drive
Nov 29, 2026
Merged

sarbian merged 1 commit into
devfrom
fix/psg-rcs-forward-drive

Conversation

@sarbian

@sarbian sarbian commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

RCSOn wrote Vessel.ctrlState.Z from OnFixedUpdate, which FlightInputHandler can overwrite with the player's input depending on the script order, so the coast's ullage and the TERMINAL_RCS trim may not fire. RCSOn now sets a flag and Drive writes s.Z. The old controller had the same issue.

Rebased on dev 92bfb8f.

Tested: full MechJebLibTest suite in Release (17982 passed, MainSailTinCan excluded as in CI).
Not tested: in game. No unit test covers Drive (KSP side).

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

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ Build Artifact 🚀

MechJeb2-8c04265.zip (built from 3c46c2a)


// Set by RCSOn for this tick: Drive writes the forward RCS command into the fly-by-wire state. Writing Vessel.ctrlState
// from OnFixedUpdate isn't enough: FlightInputHandler copies the player's input over it in its own FixedUpdate, so
// depending on the script order the coast's ullage and the TERMINAL_RCS trim would not fire.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is really odd that i've never seen that before, but it makes sense, and i know that i've fought with Drive / OnFixedUpdate ordering problems which is why VesselState had to fire in both of those.

This is starting to smell like there needs to be and RCSController to go with the ThrustController that other controllers can make requests to (of course that might still just have ordering problems?)

@lamont-granquist

Copy link
Copy Markdown
Collaborator

this is probably fine as it is for now

RCSOn wrote Vessel.ctrlState.Z from OnFixedUpdate. FlightInputHandler copies the player's input over ctrlState in its own FixedUpdate, so depending on the script order the coast's ullage and the TERMINAL_RCS trim could be overwritten every tick. RCSOn now sets a flag for the tick and Drive writes the command into the FlightCtrlState, as the old controller's fix did (c37cd791, private lows branch, never on dev).

Audit: HASC-21
@sarbian
sarbian force-pushed the fix/psg-rcs-forward-drive branch from b2ef76c to 3c46c2a Compare November 29, 2026 09:29
@sarbian
sarbian marked this pull request as ready for review November 29, 2026 11:41
@sarbian
sarbian merged commit 74cbe55 into dev Nov 29, 2026
3 checks passed
@sarbian
sarbian deleted the fix/psg-rcs-forward-drive branch November 29, 2026 11:41
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