MechJeb2

MechJeb2

4M Downloads

Advanced Transfer to another planet - Error when creating node.

hany opened this issue ยท 13 comments

commented

Mechjeb Version

2.10.0.0

KSP Version

Stock 1.10.1.2939 (WindowsPlayer x64) en-us
Making History 1.10.1
Breaking Ground 1.5.1

Description

I've recently updated KSP to 1.10.1 and the latest MechJeb, and I seem to be unable to use the "advanced transfer to another planet" maneuver of the Maneuver Planner. The Porkchop graphs render correctly, but when going to create a node, it errors out saying "An error occurred while creating the node."

This was using Eve as a target from Kerbin, but happens with other planets as well:
screenshot93

The KSP log shows the following (full log attached):

[EXC 13:27:18.064] NullReferenceException: Object reference not set to an instance of an object
	PatchedConics._CalculatePatch (Orbit p, Orbit nextPatch, System.Double startEpoch, PatchedConics+SolverParameters pars, CelestialBody targetBody) (at <c1858a3f77504bd1aaa946fdccf84670>:0)
	MuMech.OrbitalManeuverCalculator.PatchedConicInterceptBody (Orbit initial, CelestialBody target, Vector3d dV, System.Double burnUT, System.Double arrivalUT, Orbit& intercept) (at <b17e1da17deb4a87b0eab526a34d9b55>:0)
	MuMech.TransferCalculator.zeroMissObjectiveFunction (System.Double[] x, System.Double[] fi, System.Object obj, Orbit initial_orbit, CelestialBody target, System.Double UT_transfer, System.Double UT_arrival) (at <b17e1da17deb4a87b0eab526a34d9b55>:0)
	MuMech.TransferCalculator.OptimizeEjection (System.Double UT_transfer, Orbit initial_orbit, Orbit target, CelestialBody target_body, System.Double UT_arrival, System.Double earliest_UT, System.Double target_PeR, System.Boolean includeCaptureBurn) (at <b17e1da17deb4a87b0eab526a34d9b55>:0)
	MuMech.OperationAdvancedTransfer.MakeNodesImpl (Orbit o, System.Double UT, MuMech.MechJebModuleTargetController target) (at <b17e1da17deb4a87b0eab526a34d9b55>:0)
	MuMech.Operation.MakeNodes (Orbit o, System.Double universalTime, MuMech.MechJebModuleTargetController target) (at <b17e1da17deb4a87b0eab526a34d9b55>:0)
	UnityEngine.DebugLogHandler:LogException(Exception, Object)
	ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
	UnityEngine.Debug:LogException(Exception)
	MuMech.Operation:MakeNodes(Orbit, Double, MechJebModuleTargetController)
	MuMech.MechJebModuleManeuverPlanner:WindowGUI(Int32)
	MuMech.DisplayModule:ProfiledWindowGUI(Int32)
	UnityEngine.GUI:CallWindowDelegate(WindowFunction, Int32, Int32, GUISkin, Int32, Single, Single, GUIStyle)

This functionality was working with the same save on the previous version of KSP (1.9.1) and Mechjeb (2.9.2.0).

Replication case

While in LKO, select any planet as a target and use the Maneuver Planner to "advanced transfer to another planet". Click "Create node", and the error will be produced.

KSP.log

KSP.log

commented

I also have this issue in v2.12.3 trying to use pork chop to maneuver from mun orbit to minmus orbit. Lowest delta throws an "error when creating node", ASAP works about 60% of the time.

commented

I also have this issue in v2.12.3 trying to use pork chop to maneuver from mun orbit to minmus orbit. Lowest delta throws an "error when creating node", ASAP works about 60% of the time.

Same here, just tested again with KSP 1.12.3 and MJ dev #1124

I'm wondering, the change log for #1124 says "Additional transfer planner debugging". The relevant entries would be in KSP.log?

commented

can confirm as of build version 2.14.1 that advanced transfer to planet works 0% of the time for me from LKO. I'm playing the ESA missions. Normal transfer works , can also just use the data as a reference and do it manually, so I guess I can figure it out. I just wanted the point out it doesn't work for me either.

commented

The plotting needs to be redone with Sims-Flanaghan transcription of the transfer problem. I've managed to solve the problem in matlab and then manually setup the node correctly to prove the method works. Needs time to implement it, and I'm already too busy with the PVG 2.0 rewrite. I don't need any more confirmation that it is busted.

commented

OK, very strange. I was able to replicate the issue consistently before. However, when clicking on "ASAP" and then "Create node", it successfully created the maneuver node. Deleting it and going back to "Lowest Delta-V" then "Create node", it was able to create it successfully when before it would error our consistently. Even after restarting the game, I am unable to further replicate the issue.

Note that I encountered this issue after upgrading Mechjeb (from 2.9.2.0 to 2.10.0.0) and KSP (1.9.1 to 1.10.1). This was the first time using this tool since upgrading..

commented

Had a quite similar issue a couple of days ago (KSP 1.10, MJ#1000), slightly different error log though, when trying to catch a comet:

[LOG 12:35:42.630] [MechJeb] porkchop scanning found DVminsqr = 28293504.5198571 DVmaxsqr = 2.23409310460492E+15
[EXC 12:35:48.102] NullReferenceException: Object reference not set to an instance of an object
MuMech.OperationAdvancedTransfer.MakeNodesImpl (Orbit o, System.Double UT, MuMech.MechJebModuleTargetController target) (at :0)
MuMech.Operation.MakeNodes (Orbit o, System.Double universalTime, MuMech.MechJebModuleTargetController target) (at :0)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
MuMech.Operation:MakeNodes(Orbit, Double, MechJebModuleTargetController)
MuMech.MechJebModuleManeuverPlanner:WindowGUI(Int32)
MuMech.DisplayModule:ProfiledWindowGUI(Int32)
UnityEngine.GUI:CallWindowDelegate(WindowFunction, Int32, Int32, GUISkin, Int32, Single, Single, GUIStyle)

commented

Can you try build 2.10.0.0-1010 or later? Just to make sure that the issue still exists and has not been fixed in the meantime.

commented

I'm also experiencing this, with build 1014, in this case for a transfer from a 30km Munar orbit to Minmus.

Based on hany's comment, I tried several different combinations of clicking the "ASAP" and "Min โˆ†v" buttons, and got a node once or twice (I want to hit the 300-400 m/s departure window in 2 days) but most times I got an error. I've attached Player.log and the save, which contains only one vessel.

persistent.zip
Player.zip

commented

@lamont-granquist I've done some debugging:

from TransferCalculator.OptimizeEjection():

double E_h = Vsoi_mag * Vsoi_mag / 2 - initial_orbit.referenceBody.gravParameter / initial_orbit.referenceBody.sphereOfInfluence;
double Vinf_mag = Math.Sqrt(2 * E_h);

Sometimes E_h is a negative number. Because there is no the square root of a negative number, Vinf_mag is NaN.

I have no idea whats going on here. Maybe you do. ๐Ÿ™ˆ

commented

Can you try build 2.10.0.0-1010 or later? Just to make sure that the issue still exists and has not been fixed in the meantime.

Issue still persists with dev build #1016

commented

If E_h is negative then the target orbit is elliptical and not an ejection orbit. NaN is kind of appropriate in that case. Something has gone horribly wrong before then.

commented

@felixscheffer so one thing to try is to just revert back to using Vsoi as the guess and commenting out the whole Vinf calculation. That is just trying to seed a better initial guess into the optimizer, and is probably unnecessary premature optimization, if that calculation is generating elliptical orbits somehow then just toss it.

commented

As of today I'm still experiencing this issue. When I select a spot on the pork chop plot and create node, most of the time Mechjeb gives nonsense solutions. Occasionally it does give maneuver nodes close to the correct solutions though.