kRPC: Control the game using C#, C++, Java, Lua, Python...

kRPC: Control the game using C#, C++, Java, Lua, Python...

7.8k Downloads

Infernal Robotics not available

pengowen123 opened this issue ยท 5 comments

commented

I installed kRPC and Infernal Robots (from here) on a fresh install of KSP 1.4.3. I downloaded the Python client (on Python 3.5) using pip, and made this simple script:

import krpc

conn = krpc.connect(
	name = 'foo',
	address = '192.168.1.4',
	rpc_port = 50000,
	stream_port = 50001,
	)

vessel = conn.space_center.active_vessel

group = conn.infernal_robotics.servo_group_with_name(vessel, 'test_group')

When I run it, it fails with this error:

RuntimeError: Infernal Robotics is not available

This is the printed server stack trace:

Server stack trace:
at KRPC.InfernalRobotics.InfernalRobotics.CheckAPI () [0x00000] in :0
at KRPC.InfernalRobotics.InfernalRobotics.ServoGroupWithName (KRPC.SpaceCenter.Services.Vessel vessel, System.String name) [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

commented

Looks like the error is reported when IR is either not installed, or the API is not ready, which could be the case if the vessel has no IR parts. So maybe that's the cause.

Also, I'm having trouble installing IR for KSP 1.4.3. The game crashes when loading. What steps did you use to install it?

commented

@djungelorm Downloading IR from the link to a fresh install of 1.4.3 worked for me. However, there are no parts available for that version of IR as far as I can tell. A working version of IR for 1.4.3 with parts is available here:

https://forum.kerbalspaceprogram.com/index.php?/topic/170898-wip-infernal-robotics-next/

However, I get the same error with that mod, which is reasonable because it is a different mod entirely. I don't think the version of IR linked in the kRPC documentation is maintained anymore, so it may be better to support IR-next instead.

commented

I just want to make a note that we have the same problem over in kOS. "IR-next" is a large refactor according to its author. Part of that is that the Assembly name changed so other mods trying to find it under the old name won't find it that way, but I get the impression that breakage was deliberate so that the fact that code trying to call the old API won't quite work gets highlighted.

commented

It looks like the IR wrapper code in IR Next hasn't changed much - but as you point out the assembly name (and some of the class names) are different. There is an example in the IR Next sequencer project here that is probably a good thing to follow, as it's maintained by the IR Next developers: https://github.com/meirumeiru/IR-Sequencer/blob/master/IRSequencer/IRSequencer/API/IRWrapper.cs

commented

I've made some changes to allow both original IR and IR Next to be used from kRPC. Will be included in the next release.

If you want to try it out now, a pre-release is available here:
https://krpc.s3.amazonaws.com/deploy/feature/ir-next/1213.1/krpc-0.4.8-15-g619d94a.zip