Genhis / KRPC.MechJeb

kRPC service for MechJeb2 (Kerbal Space Program)
https://genhis.github.io/KRPC.MechJeb/
GNU General Public License v3.0
15 stars 8 forks source link

Unable to use any procedure of maneuver_planner #9

Closed Wozahru closed 4 years ago

Wozahru commented 4 years ago

Describe the bug

krpc.types.MJServiceException: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
  at KRPC.MechJeb.Maneuver.Operation..ctor (System.String operationType) [0x00054] in <80555fe871a148ce8f8a632019cf2177>:0 
  at KRPC.MechJeb.Maneuver.TimedOperation..ctor (System.String operationName) [0x00000] in <80555fe871a148ce8f8a632019cf2177>:0 
  at KRPC.MechJeb.Maneuver.OperationTransfer..ctor () [0x00000] in <80555fe871a148ce8f8a632019cf2177>:0 
  at (wrapper managed-to-native) System.Reflection.MonoCMethod.InternalInvoke(System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
   --- End of inner exception stack trace ---
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00014] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Reflection.MonoCMethod.DoInvoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0007a] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Reflection.MonoCMethod.Invoke (System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) [0x00000] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at KRPC.MechJeb.ExtensionMethods.TypeExtensions.CreateInstance[T] (System.Type type, System.Object[] args) [0x00043] in <80555fe871a148ce8f8a632019cf2177>:0 
Server stack trace:
  at KRPC.MechJeb.ExtensionMethods.TypeExtensions.CreateInstance[T] (System.Type type, System.Object[] args) [0x00080] in <80555fe871a148ce8f8a632019cf2177>:0 
  at KRPC.MechJeb.ManeuverPlanner.GetOperation[T] (System.Int32 id) [0x00010] in <80555fe871a148ce8f8a632019cf2177>:0 
  at KRPC.MechJeb.ManeuverPlanner.get_OperationTransfer () [0x00000] in <80555fe871a148ce8f8a632019cf2177>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0

Code snippet to reproduce it (ideally in Python)

sc = conn.space_center
mj = conn.mech_jeb

sc.target_body = sc.bodies['Mun']

planner = mj.maneuver_planner
hohmann = planner.operation_transfer
hohmann.make_node()

Version details kRPC.MechJeb: 0.5.1 Kerbal Space Program: 1.9.1 kRPC: 0.4.8 MechJeb2: 2.9.1.0 and 2.8.3.0

Wozahru commented 4 years ago

Clearing mods and reinstalling with CKAN instead of curse solve the issue

yjchun commented 4 years ago

I am having same problem. It was ok with Mechjeb2 2.8.4 but after updating to 2.9.1.0, this error occurs.

Genhis commented 4 years ago

@yjchun Could you please send me the log file?

  1. Open KSP, load a save and run your script
  2. If you got the same error, close KSP
  3. Attach Kerbal Space Program/KSP.log to your github comment
yjchun commented 4 years ago

Tested again. First two errors are testing of maneuver_planner.operation_transfer.make_node(), and last one error with maneuver_planner.operation_circularize.make_node().

Version details kRPC.MechJeb: 0.5.1 Kerbal Space Program: 1.9.1 kRPC: 0.4.8 MechJeb2: 2.9.2.0

sc = conn.space_center
mj = conn.mech_jeb
#
#sc.target_body = sc.bodies['Mun']

# planner = mj.maneuver_planner
# hohmann = planner.operation_transfer
# hohmann.make_node()

circularize = mj.maneuver_planner.operation_circularize
circularize.time_selector.time_reference = mj.TimeReference.apoapsis
circularize.make_node()

KSP.log

yjchun commented 4 years ago

Sorry for confusion but it seems this error is new with MechJeb2 2.9.2.0. Works ok with 2.9.1.0.