MechJeb2

MechJeb2

4M Downloads

Suggestion: Warp helper should have options for warping to gravitational encounter or escape points

cgapeart opened this issue ยท 1 comments

commented

I am working on a patch for this - looks straight forward. May be a day or two before I have the time to learn how to use GitHub to submit it. However, it's pretty trivia - see end of this comment for details.

When I do a launch and I am heading for the Mun, I get into orbit, then do the Hoffman transfer burn. In the past, I have been adding a maneuver node with no delta V attached so that I can use the warp helper to jump ahead to where I am in Mun's sphere of influence. At least once, I didn't zoom in enough and managed to add the maneuver to the next orbit around, after Mun escape. The warp helper worked properly, and I missed my opportunity to do an orbital insertion burn.

The Rendezvous planner seems to be really good at smashing me into a body - though I am sure I am using it wrong. another option that would also be nice would be to have the manouver planner include an option to calculate an orbital insertion burn node based timed on reaching PE of the orbit following encounter. I think that can be accomplished by doing an AP manouver plan at the next PE, but I haven't actually tried that yet.

Code Changes:
All changes made to MechJebModuleWarpHelper:

  • Add encounter and escape options to the enumerations and list of strings:
public enum WarpTarget { Periapsis, Apoapsis, Node, SoI, Encounter, Escape }
        static string[] warpTargetStrings = new string[] { "periapsis", "apoapsis", "maneuver node", "SoI transition", "Encounter", "Escape" };
  • Add case statements to the OnFixedUpdate for the new options:
                case WarpTarget.Encounter:
                    if (orbit.patchEndTransition == Orbit.PatchTransitionType.ENCOUNTER) targetUT = orbit.EndUT;
                    break;
                case WarpTarget.Escape:
                    if (orbit.patchEndTransition == Orbit.PatchTransitionType.ESCAPE) targetUT = orbit.EndUT;
                    break;

That should cover it. On my first attempt, I used != instead of ==, and in order to get it to stop at encounter, I had to select the escape option. I still need to test the ==, but the final code can't be too much different. The other option I considered was caching the current sphere of influence owner, and running until that changed -- I don't know the API enough yet to try that.

commented

In the warp helper, select Warp to SoI. That's "Sphere of Influence" change and will warp you to whatever the next SoI change is, with a setting to place you a specific time frame ahead of that SoI change.