MechJeb2

MechJeb2

4M Downloads

Suggestion to alleviate Wobbly Rocket Syndrome

Felger opened this issue ยท 3 comments

commented

In general, rebuilding the ship with SelectRoot using a part near the center of mass solves the wobbly rocket syndrome (mostly).

This suggests that one of the controller problems experienced is a part experiencing large angular displacement due to the length and flexibility of the arm between it and the center of mass. If mechjeb were to either dynamically select a rootpart for attitude measurements that's nearest the center of mass, or create an imaginary part near the center of mass, it could alleviate the issue somewhat.

commented

Are you sure that MechJeb generates inputs based on orientation of Root Part, and not last clicked "control from here" probe core/pod?

commented

Very sure:
https://www.youtube.com/watch?v=cWXghLnilrY

Essentially, the game is always measuring your craft's velocity vector relative to the root part, which leads to the wobbly rocket syndrome.

commented

So, some additional information from my testing for that video (and a summary):

It seems the primary issue is that the game measures velocity from the root part, and attitude from the 'control from here' part. This can present problems when the 'control from here' part is distant from the center of mass (especially when separated by many weak joints).

For the velocity issue, @eggrobin has already suggested an excellent solution, finding the 'average' velocity vector of the vehicle.

For the attitude quaternion, I believe that solving the velocity issue should resolve most of the problem, however, there are untested scenarios, like vessels assembled in orbit with very weak joints (docking ports and the like). I suspect that producing a stable attitude quaternion would help significantly in those scenarios if not solved by the velocity fix.

Suggested attitude quaternion fixes:

  • Dynamically find the best part, and transform:
    • Survey all parts' orientation quaternions, find the least 'wobbly' quaternion (The quaternion with the lowest magnitude oscillation).
    • Find the transformation between that part and the control part in a neutral position
    • Replace the vessel's attitude quaternion with the attitude of the non-wobbly part (likely near one of the vibration nodes of the vessel) transformed to match the neutral orientation of the control part.
  • Statically determine best part:
    • At launch, and at each vessel reconfiguration event (staging, undocking, docking, etc) Check for near-zero torque and perform update.
    • Find the part nearest to the new CoM, calculate the transformation (translation + rotation) to the control part.
    • Save that transformation, use the attitude of the CoM part for control, apply the static transformation to the CoM part to replicate the control part's orientation.
    • If non-zero torque is applied during update, save torque and part attitude, re-run calculation when lower torque is experienced and save new value, eventually reaches a minimum value, closest to neutral position.

Those are just a couple of ideas on how to make it better, by no means the only ways.