• 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

3 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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this