Jump to content

[1.8.x to 1.12.x] kRPC: Remote Procedure Call Server (v0.5.1, 2nd March 2023)


djungelorm

Recommended Posts

Oooo interesting, my guess is that it's because the classes and methods are dynamically created when the client connects to the server. I don't have experience with VS, so I don't know if there is an easy workaround for this.

Yeah, I'd guess that too since the interactive shell gets a lot more completions once I connect. I'll just go back to IDLE until someone figures out how to use it correctly.

Edited by funkey100
Link to comment
Share on other sites

  • 2 weeks later...
Found an issue with the latest version and CKAN's ZIP extraction: instead of extracting GameData/kRPC, it does src/java/krpc. CKAN is working fine for all other mods I have installed.

Thanks - confirmed on Windows using CKAN 1.6.6. Oddly, it works fine on Linux!

Link to comment
Share on other sites

Version 0.1.7 has been released!

Download link: [Moderator removed defunct website link]

The main changes are:

  • Support for Python 3
  • Setting SAS modes and navball speed mode
  • Clean up engine thrust methods
  • Fix orientation of docking port reference frames
  • Rename engine.activated to engine.active (to match other parts)
  • Fix CKAN install bug on Windows
Edited by James Kerman
link removed
Link to comment
Share on other sites

As far as I can tell it doesn't expose it, so you can't tell the SAS autopilot to point in an arbitrary direction. All I've managed is to instruct it to point in the directions that are available via the mode buttons next to the navball (which as of v0.1.7 you can set using vessel.auto_pilot.sas_mode = ...)

Link to comment
Share on other sites

Too bad.

Is there a way to determine the surface/orbital velocity vectors as displayed on the navball?

e.g. (0, 0, 1) would mean 1m/s to the east.

unfortunately, vessel.surface_reference_frame moves with the vessel.

edit: experiments have confirmed that the following hack does the trick:


# surface velocity
s.transform_direction(v.flight(v.orbit.body.reference_frame).velocity, v.orbit.body.reference_frame, v.surface_reference_frame)

# orbital velocity
s.transform_direction(v.flight(v.orbit.body.non_rotating_reference_frame).velocity, v.orbit.body.non_rotating_reference_frame, v.surface_reference_frame)

Edited by mic_e
Link to comment
Share on other sites

Is there a way to determine the (cumulative) stage mass, e.g. the mass of stages 0, 1 and 2?

I have a general-purpose launcher for which I'd like to auto-adjust the ascent profile depending on the payload mass, but I only see vessel.mass, which is not suitable for that purpose.

Link to comment
Share on other sites

You could iterate over the parts in the vessel that are in those stages, and sum their masses. For example:


parts = conn.space_center.active_vessel.parts
mass = 0
for stage in [0,1,2]:
for part in parts.in_decouple_stage(stage-1):
mass += part.mass

Edited by djungelorm
Link to comment
Share on other sites

I have a massive performance issue with my heavily modded (FAR, RemoteTech, kRPC, SCANSAT, RealFuels, ...) KSP install:

No matter what scene I'm in, my game freezes about once a second.

I've bisected the issue and identified kRPC as the culprit. Which is quite unfortunate, seeing how I spent at least 10 hours writing my awesome launcher script (+infrastructure).

How to reproduce:

Install my collection of mods, launch KSP, create new sandbox game, enter tracking station, activate timewarp, watch the mun lag around Kerbin. Removing kRPC instantly fixes the issue.

Installed Modules:

- 001ControlLock 1.2

- ActsEW 1.3b

- AdjustableLandingGear 1.0.4

- AGExt 1.31f

- BDAnimationModules v0.5.2

- BetterBuoyancy v1.1

- CoherentContracts 1.02

- CommunityResourcePack 0.3.3

^ ContractConfigurator 0.7.11

- ContractConfigurator-AdvancedProgression 3.0

- ContractConfigurator-AnomalySurveyor 1.0.5

- ContractConfigurator-ContractPack-SCANsat v0.5.0

- ContractConfigurator-GrandTours 0.1.1

- ContractConfigurator-InitialContracts 1.0.0

- ContractConfigurator-KerbinSpaceStation 1.1

- ContractConfigurator-RemoteTech 1.1.2

- ContractConfigurator-Tourism 1.0.1

- ContractConfigurator-UnmannedContracts 0.3.4

- CrossFeedEnabler v3.2

- CrowdSourcedScience v2.0

- DeadlyReentry v6.4.0

- DistantObject v1.5.2

- DistantObject-default v1.5.2

- EngineIgnitor-Unofficial-Repack 3.4.1.1-1

- ExtraPlanetaryLaunchpads 5.1.2

- ExtraPlanetaryLaunchpads-RegolithAdaptation 30

- FerramAerospaceResearch v0.14.7

- FirespitterCore 7.0.5463.30802

- Impact v1.0.1

- ImprovedChaseCamera 1.4.0

- InfernalRobotics 0.19.3

- InFlightWaypoints Deprecated

- Karbonite 0.5.5

- KarbonitePlus 0.3.0

- KAS 0.4.10

- KerbalEngineerRedux 1.0.15.2

- KerbalIspDifficultyScaler v1.4.2

- KerbalMass 0.9

- KerbalStats 1.1.1

- KerbalWeatherSystems 0.5.3-alpha

- kRPC 0.1.7

- KSPX v0.2.8.1

- ModOrientedTechTree-Unmanned 0.3.2

- ModuleManager 2.6.0

- ModuleRCSFX v3.5

- NavballDockingIndicator v5

- PersistentRotation 0.4.3

- PilotAssistant 1.5.4

- PreciseNode 1.1.2

- ProceduralAirships 1.3

- ProceduralDynamics v0.9.3

- ProceduralFairings v3.11

- ProceduralParts v1.0.2

- RealFuels rf-v9.0

- Regolith 0.1.7

- RemoteTech v1.6.3

- RFStockalike v2.1.3

- SCANsat v10.0

^ SpacetuxSA 0.3.2

- StripSymmetry v1.5

- TACLS v0.10.2b

- TACLS-Config-Stock v0.10.2b

- TechManager 1.5-compat

- Toolbar 1.7.8

- Trajectories 1.1.3

- TransferWindowPlanner v1.2.3.0

- TweakScale v1.52.1

- USITools 0.3.2

- WiderContractsApp 1.0.1

edit: upon further testing, it seems like for a sufficiently populated savegame, the issue happens even without kRPC installed :|

Edited by mic_e
Link to comment
Share on other sites

I have a massive performance issue with my heavily modded (FAR, RemoteTech, kRPC, SCANSAT, RealFuels, ...) KSP install:

No matter what scene I'm in, my game freezes about once a second.

I've bisected the issue and identified kRPC as the culprit. Which is quite unfortunate, seeing how I spent at least 10 hours writing my awesome launcher script (+infrastructure).

How to reproduce:

Install my collection of mods, launch KSP, create new sandbox game, enter tracking station, activate timewarp, watch the mun lag around Kerbin. Removing kRPC instantly fixes the issue.

The burden of installing all these mods might ensure that the issue never gets addressed. maybe try bringing the list down.

Link to comment
Share on other sites

Too bad.

Is there a way to determine the surface/orbital velocity vectors as displayed on the navball?

e.g. (0, 0, 1) would mean 1m/s to the east.

unfortunately, vessel.surface_reference_frame moves with the vessel.

edit: experiments have confirmed that the following hack does the trick:


# surface velocity
s.transform_direction(v.flight(v.orbit.body.reference_frame).velocity, v.orbit.body.reference_frame, v.surface_reference_frame)

# orbital velocity
s.transform_direction(v.flight(v.orbit.body.non_rotating_reference_frame).velocity, v.orbit.body.non_rotating_reference_frame, v.surface_reference_frame)

Unfortunately, looks like this "hack" is the best way to do it at the moment. I hadn't considered this use case, so will have a think about how to make this better. (Added it as an issue on github so I don't forget :Phttps://github.com/djungelorm/krpc/issues/108)

Link to comment
Share on other sites

Very nice mod! Thank you.

I have been foling around a bit trying to get a KRPC to run from Java. So far my code establishes the connection and does the initial handshake correctly. I also have the generated Protocoll Buffer code in place in Eclipse but have so far failed to get any answers on my Request messages.

Anyone gotten further and willing to share?

Link to comment
Share on other sites

  • 2 weeks later...

Version 0.1.8 has been released!

Download link: https://kerbalstuff.com/mod/636/kRPC...0Call%20Server

The main changes are:

  • KSP 1.0.2 support:
    • Updated engine thrust and ISP functionality
    • Updated aerodynamics functionality

    [*] Improved enum support in Python client. Uses Enum objects instead of plain ints.

PS. I made this release in a bit of a hurry as I'm going away on holiday all of this week, but wanted to get KSP 1.0 support out there. Hoping there aren't any major bugs!

Edited by djungelorm
Link to comment
Share on other sites

Was able to modify the Sub-Orbital Flight script to make a plot of the altitude with matplotlib, worked perfectly.

How difficult would it be to make it work with Infernal Robotics? How hard would it be to implement a web client a la Telemachus? Taking a look at the communication protocol...

btw, these python libraries are dependencies for compilation, might be worthy to note: yaml sphinx sphinxcontrib-spelling sphinx_rtd_theme pyenchant

Link to comment
Share on other sites

I'm experiencing a bug with your mod. occassionally windows don't show up anymore. wether it's stock windows like the science pop ups or even the menu when i press esc. or mod related windows like the server window of krpc. the only other mods i have installed are KER and Kerbal Alarm Clock but the bug never showed up when i only had those two installed. the only way to get rid of the bug is to restart the game.

Link to comment
Share on other sites

I'm experiencing a bug with your mod. occassionally windows don't show up anymore. wether it's stock windows like the science pop ups or even the menu when i press esc. or mod related windows like the server window of krpc. the only other mods i have installed are KER and Kerbal Alarm Clock but the bug never showed up when i only had those two installed. the only way to get rid of the bug is to restart the game.

Is there a way to reliably reproduce the bug? Are there any errors being reported in the KSP log file?

- - - Updated - - -

How difficult would it be to make it work with Infernal Robotics? How hard would it be to implement a web client a la Telemachus? Taking a look at the communication protocol...

Should be fairly easy to interface with InfernalRobotics' API - added to the TODO list. If you could get javascript to speak protocol buffers to the server then a web script should be achievable. I plan to add a choice of communication protocols in the future, allowing SOAP style requests which would make interfacing webapps a lot easier.

Link to comment
Share on other sites

Version 0.1.9 has been released!

[Moderator removed defunct website link]

The main changes are:

  • InfernalRobotics support (documentation)
  • KerbalAlarmClock support (documentation)
  • Refactored Resources class and associated methods
  • Added Engine.PropellantRatios
Edited by James Kerman
link removed
Link to comment
Share on other sites

Is there a way to reliably reproduce the bug? Are there any errors being reported in the KSP log file?

No there is no error being reported in the log file. And the bug happens really frequently for me. it happens when i revert to launch a few times. or at times even right when i go to the launch pad with a new craft.

Link to comment
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
Reply to this topic...

×   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.

×
×
  • Create New...