• 0
Sign in to follow this  
funkheld

KRPC.MechJeb not funktion.

Question

hello, good day.

all other programs with krpc 0.48 is ok.
I have ksp 1.6.1 and  python 2.7.

this not funktion:
LaunchIntoOrbit.py

- Mechjeb2 installiert
- Copy KRPC.MechJeb.dll to Kerbal Space 
   Program/GameData/kRPC directory.

errormeldung:
------------------------------------------------------
f:\python27>python.exe f:\python27\pebi-py\LaunchIntoOrbit.py
Traceback (most recent call last):
  File "f:\python27\pebi-py\LaunchIntoOrbit.py", line 9, in <module>
    ascent = mj.ascent_autopilot
  File "<string>", line 1, in <lambda>
  File "f:\python27\lib\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 <filename unknown>:0
  at KRPC.MechJeb.MechJeb.GetComputerModule[AscentAutopilot] (System.Object[] modules, Int32 id, System.Object[] args) [0x00000] in <filename unknown>:0
  at KRPC.MechJeb.MechJeb.GetComputerModule[AscentAutopilot] (System.Object[] modules, Int32 id) [0x00000] in <filename unknown>:0
  at KRPC.MechJeb.MechJeb.get_AscentAutopilot () [0x00000] in <filename unknown>: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 <filename unknown>:0
----------------------------------------------

	mport krpc
	conn = krpc.connect(name='test',
       address='127.0.0.1',
       rpc_port=1000, stream_port=1001)
       
sc = conn.space_center
mj = conn.mech_jeb
ascent = mj.ascent_autopilot
	#All of these options will be filled directly into Ascent Guidance window and can be modified manually during flight.
ascent.desired_orbit_altitude = 100000
ascent.desired_inclination = 6
	ascent.force_roll = True
ascent.vertical_roll = 90
ascent.turn_roll = 90
	ascent.autostage = True
ascent.enabled = True
sc.active_vessel.control.activate_next_stage() #launch the vessel
	with conn.stream(getattr, ascent, "enabled") as enabled:
    enabled.rate = 1 #we don't need a high throughput rate, 1 second is more than enough
    with enabled.condition:
        while enabled():
            enabled.wait()
	print("Launch complete!")
conn.close()
	

 

thanks

greeting.
 

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Did you use pip install krpc to install it? I recommend installing it that way to ensure all depencies are installed. On a side note, you really should switch to Python 3, as Python 2 will not be supported from Januari 1, 2020, onward.

Share this post


Link to post
Share on other sites
  • 0

yes i have  pip install.

-------------------------------
Did you use pip install krpc to install it? ?
_____________________

 

greetin g

 

 

Share this post


Link to post
Share on other sites
  • 0

Moved from KSP Discussion.

Share this post


Link to post
Share on other sites
  • 0

Hi funkheld,

The issue has been fixed, please download version 0.4.0 of kRPC.MechJeb.

Let me know if you have any more problems.

Share this post


Link to post
Share on other sites
This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this