MuMech/MechJeb2 — pull request #500 by Starwaster (2014-12-18 18:47:48+00:00)
Title: Update MechJebModuleAscentAutopilot.cs

The change I propose will help fix a long standing bug where a rocket would pitch up/down suddenly at the beginning of its coast to apoapsis phase. The cause of this is that the autopilot wants to change orientation to prograde.

This action is seldom necessary and when performed at the beginning of coast, there is a high probability that the main engine will be firing/pulsing to maintain apoapsis. The end result can be an amount of momentum that no amount of reaction wheels or RCS will be able to counteract, ending in uncontrolled spinning.

The fix I propose here is to record its desiredVector as lastDesiredVector and then use that. (I chose AttitudeReference.INERTIAL because that was what was being used before but I'm not quite clear on usage here so maybe it needs .ORBIT? Or perhaps just not trying to change its current orientation at all would be better, but using lastDesiredVector seems to be working for me)