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

Exception raised in server when creating ascent autopilot object #1

Closed Ernesto-Alvarez closed 5 years ago

Ernesto-Alvarez commented 5 years ago

KRPC.Mechjeb fails its own basic example. When following the example, an exception is generated at the server when accessing conn.mech_jeb.ascent_autopilot. It is possible to instantiate AscentGT, but doing so does not work for controlling the rocket (but does not trigger an exception either).

KRPC.Mechjeb used is latest as indicated in the documentation in this project, KRPC version is 0.4.8 and KSP version is 1.6.1.2401. KRPC was tested and is running correctly.

Python 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import krpc conn = krpc.connect(name="Launch into orbit") sc = conn.space_center mj = conn.mech_jeb ascent = mj.ascent_autopilot Traceback (most recent call last): File "", line 1, in File "", line 1, in File "/home/ealvarez/.local/lib/python2.7/site-packages/krpc/client.py", line 163, in _invoke raise self._build_error(response.results[0].error) krpc.types.MJServiceException: Exception has been thrown by the target of an invocation.: Non-static field requires a target Server stack trace: at KRPC.MechJeb.ExtensionMethods.TypeExtensions.CreateInstance[AscentAutopilot] (System.Type type, System.Object[] args) [0x00000] in :0 at KRPC.MechJeb.MechJeb.GetComputerModule[AscentAutopilot] (System.Object[] modules, Int32 id, System.Object[] args) [0x00000] in :0 at KRPC.MechJeb.MechJeb.GetComputerModule[AscentAutopilot] (System.Object[] modules, Int32 id) [0x00000] in :0 at KRPC.MechJeb.MechJeb.get_AscentAutopilot () [0x00000] in :0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0

Genhis commented 5 years ago

Thank you for reporting the issue.

Examples were tested on KSP version 1.4, so things might have changed. I will look into it.

EDIT: Mechjeb has made some changes in classes which I access via reflection, so I need to fix it in my code.

Genhis commented 5 years ago

Fixed.

I will add more fixes this week and upload a new release soon.