MechJeb2

MechJeb2

4M Downloads

#685 "Launch into plane of Target" (wrong inclination)

hraban35 opened this issue · 16 comments

commented

With a "launch into plane of target" the inclinaton was calculated *-1 by reaching apoapsis.
On Launch the inclination is calculated to 52.1°, thats ok. If the rocket reach the apoasis the inclination swaps to -52.1°!

commented

Going to second this. I am seeing a lot of failed plane adjustments at launch. Even relaunching doesn't work (as it was suggested that MJ learns ascent profile and is better able to adjust rendezvous that way.)

commented

Yes in 50% of Launches with an significant greater inclination as 5° the circulation burn is angeled 90° out of the plane of target. Looks like a calculation misstake.
Example: Planed is a launch into the plane of my spacestation on an 52° inclination. By activation the "Lauch in plane of target" the inclination is set so 52° and all is good but ... when the calculation starts for the circulation burn the inclination swaps to -52°. The result is a 90° crossed inclination and that is definitly wrong calculated.
The problem is also in the last version present.

commented

I'm not quite understanding what you're describing. Is it launching into plane correctly, but the circularization burn is incorrect?

commented

Are you seeing this on positive inclination flights, negative inclination flights, or both?

commented

Let me clarify my question: What value are you seeing in the inclination textbox? Is it a positive value or a negative one?

commented

On both cases but not on every orbital burn calculation.
Edit: on every case if the Start and Launch inclination is set to negativ value.

commented

So I can make sure I get this bug fixed, are you 100% sure it's only when the launch inclination is set to a negative value?

commented

Actually I replicated it and I think its simpler than that. DeltaVToChangeInclination() already handles reflections, its in its API:

        //Computes the delta-V of the burn required to change an orbit's inclination to a given value
        //at a given UT. If the latitude at that time is too high, so that the desired inclination
        //cannot be attained, the burn returned will achieve as low an inclination as possible (namely, inclination = latitude).
        //The input inclination is in degrees.
        //Note that there are two orbits through each point with a given inclination. The convention used is:
        //   - first, clamp newInclination to the range -180, 180
        //   - if newInclination > 0, do the cheaper burn to set that inclination
        //   - if newInclination < 0, do the more expensive burn to set that inclination
        public static Vector3d DeltaVToChangeInclination(Orbit o, double UT, double newInclination)

So just rub some Math.Abs on it:

OrbitalManeuverCalculator.DeltaVToChangeInclination(orbit, UT, Math.Abs(desiredInclination));

It really is as simple as the sign being negative in the box in the Ascent Autopilot, I was making it more complicated in my head than it needed to be.

commented

I believed I'd noticed that in the past, which is why I asked the question long ago.

So I can make sure I get this bug fixed, are you 100% sure it's only when the launch inclination is set to a negative value?

If you agree with the decision, go ahead and make the change.

commented

This should probably have a better title: "Circularization burn after ascent gets orbital inclination wrong if the inclination flips sign while in flight" or something like that.

There's typically two launch windows to a plane one at +inc and one at -inc corresponding to where the latitude of the launch site slices through the great circle route of the target plane. If you launch at the +inc side but the circularization burn is on the -inc side of the great circle (for a +45 inclination launch you would have launched north, then hit 45N on your ground track and then started going south and it sounds like the circularization burn is for the +45 inc of when it launched and not the -45 inc of where the vessel is doing the burn.

commented

...That makes a lot more sense. I'll look into fixing this.

commented

Using the dev build I tried a 52.1 degree inclination launch. By 15km up it was in the high 40's according to the orbit info page. The circularization burn went as expected and the orbit info page reported 52.099 degrees inclination.

Same result when I did it again with the same rocket. Tried a couple of other rockets in sandbox. All came very close to the expected value. Nobody turned the wrong way. Jeb approves. :-)

commented

Looks like this issue has been resolved, is it okay to close?

commented

The fix that was put in looks good to me, and was merged into dev, from the developer side of things.

commented

What's a good way for me to test it? Can I download a dev build from somewhere? Still haven't figured out how to build MJ from source on Linux.

commented