Jump to content

[1.4.x,1.3.x,1.2.2] kRPC: Remote Procedure Call Server (v0.4.7, 27th July 2018)


djungelorm
 Share

Recommended Posts

Also, looking for a way to call a specific part in kRPC.  

I have three tanks of LF/O attached in radial, and I want to know when they're empty.   I've tried several iterations of attempting to traverse the tree to either determine when a fuel tank is depleted of a specific resource, or to see if a specific engine has fuel available.   No technique I have found renders a solution that does not also factor in the central tank and engine, thereby necessitating hefty equations for fuel consumption, time elapsed, etc, in order to stage the fuel tanks.  These are not linked with hoses, but instead are liquid boosters.  

Is there any way I can refer to a specific fuel tank's resource amount of a specific resource?  

Cheers! 

Link to comment
Share on other sites

So I'm trying to install the python packages on OS X.  Getting the following error.  I assume it's supported on OSX and I can't find anything in the thread or online about installing it.  Any help would be appreciated.

 

 

Gree:Downloads anothergene$ sudo -H pip install krpc

Collecting krpc

  Downloading krpc-0.3.8.post1.zip (57kB)

    100% |████████████████████████████████| 61kB 1.1MB/s 

Collecting protobuf>=3 (from krpc)

  Downloading protobuf-3.3.0.tar.gz (271kB)

    100% |████████████████████████████████| 276kB 1.4MB/s 

Collecting enum34>=0.9 (from krpc)

  Downloading enum34-1.1.6-py2-none-any.whl

Collecting six>=1.9 (from protobuf>=3->krpc)

  Downloading six-1.10.0-py2.py3-none-any.whl

Requirement already satisfied: setuptools in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from protobuf>=3->krpc)

Building wheels for collected packages: krpc, protobuf

  Running setup.py bdist_wheel for krpc ... done

  Stored in directory: /var/root/Library/Caches/pip/wheels/cb/fc/48/bf4041bc439787df6aff8eb35630deffcfda1f590e8303463c

  Running setup.py bdist_wheel for protobuf ... done

  Stored in directory: /var/root/Library/Caches/pip/wheels/1b/42/a0/4c7343df5b629ec9c75655468dce7652b28026896b0209ba55

Successfully built krpc protobuf

Installing collected packages: six, protobuf, enum34, krpc

  Found existing installation: six 1.4.1

    DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.

    Uninstalling six-1.4.1:

Exception:

Traceback (most recent call last):

  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main

    status = self.run(options, args)

  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run

 

 
Link to comment
Share on other sites

On 4/28/2017 at 4:20 PM, Bosun said:

Is there functionality to add the Shell to RPM?  It would be the bee's knees to be able to see my print commands in IVA. :)

Not yet but this feature has been requested before and is on the todo list! :)

@Eugene Moreau looks like it's due to the protobuf library requiring a newer version of six than is installed on your system. I'm unfamiliar with MacOS, but is there a MacOS specific way to update python packages? You need six > 1.9, but have 1.4.1 installed.

Link to comment
Share on other sites

4 hours ago, djungelorm said:

Not yet but this feature has been requested before and is on the todo list! :)

@Eugene Moreau looks like it's due to the protobuf library requiring a newer version of six than is installed on your system. I'm unfamiliar with MacOS, but is there a MacOS specific way to update python packages? You need six > 1.9, but have 1.4.1 installed.

It's bundled with the OS so I'm not sure it's great idea to update the packages, but who knows, it may not care.  I could always install a separate version of python that I can maintain myself.  Have to look into it.

Link to comment
Share on other sites

25 minutes ago, Eugene Moreau said:

It's bundled with the OS so I'm not sure it's great idea to update the packages, but who knows, it may not care.  I could always install a separate version of python that I can maintain myself.  Have to look into it.

updated six to 1.10 manually and things appear to be "normal" and krpc installed.  Thanks for for the help.  I'll report back if things go south.

Link to comment
Share on other sites

  • 3 weeks later...

Hey, this mod is so awesome. I used to do a lot of kOS and kebal moding back in the day, and I'm dying to build some stuff with this library. I have a visual studio c# application that will connect to the server, and issue commands such as throttle, action keys, and most vessel functions.

 

However I cannot get  System.Console.WriteLine to print anything to the console, and things like SAS mode or the autopilot functions don't seem to work. Additionally I cant reference classes like UI. Am I targeting the wrong framework? Or could it be something else?

 

Any help would be greatly appreciated  

Link to comment
Share on other sites

@clown_babyI kept hoping that someone who's actually used the c# library client would jump in....  So forgive me for starting at the beginning with the dumb questions.  Have you tried the Launch  tutorial script without modification?   https://krpc.github.io/krpc/tutorials/launch-into-orbit.html      Using the autopilot on the  c# version looks like it should be as simple as it is in python - set a heading and pitch and call .engage().   And to diagnose if the whole problem is in the autopilot service or not...  have you tried setting the SAS via the vessel.control interface?  There are two ways to control the SAS, one under vessel.autopilot, and the other via vessel.control.   If you're having problems with everything in the .autopilot class but can access it via .control that will get us looking in a different direction for your problem.

Link to comment
Share on other sites

16 hours ago, artwhaley said:

@clown_babyI kept hoping that someone who's actually used the c# library client would jump in....  So forgive me for starting at the beginning with the dumb questions.  Have you tried the Launch  tutorial script without modification?   https://krpc.github.io/krpc/tutorials/launch-into-orbit.html      Using the autopilot on the  c# version looks like it should be as simple as it is in python - set a heading and pitch and call .engage().   And to diagnose if the whole problem is in the autopilot service or not...  have you tried setting the SAS via the vessel.control interface?  There are two ways to control the SAS, one under vessel.autopilot, and the other via vessel.control.   If you're having problems with everything in the .autopilot class but can access it via .control that will get us looking in a different direction for your problem.

So I actually got it all figured out. I wasnt turning the autopilot on and now I feel dumb. Also I figured out debugging by just running it as a console program in vs.  Either way I am trying to recreate this in stock c#.  I drew a vector on my ships transform but as the craft got up to speed the vector lagged about half a ship behind where it actually was. I assume this is because of a delay in the network communication despite being on the same PC. I've gone back to writing a native plugin, which unfortunately means restarting the game and building every time i change a line of code.

 

Link to comment
Share on other sites

That drone race is pretty incredible.   I could see how KRPC isn't updating fast enough to accomplish that.   There ARE some throttling settings in the server window in game that might help you, but I've never played with them and if you've moved on to a different way of doing it that you're also happy with, you may not want to fiddle with it!   There is some work underway to build IPC between KRPC and KOS so it might be possible to do some quick reaction stuff in KOS and some high level thinking/ user interface in KRPC.  

If you ARE building your own plugin for that - another use I've found for KRPC - DEBUGGING.  If you setup KRPCProperty wrapping for your plugin's variables - you can use KRPC and python to remotely poll or change them!  This could save you hours of reloading when you get down to the fine tuning of parameters part.  The "Extending KRPC" section of the website explains how to make your plugin work as a KRPC service.   It's WAY painless -  basically link in KRPC and put the attribute tags around things you want accessible from KRPC.

Also thank you so much for posting what you did wrong!  There's always that instinct to quietly edit or delete your post when you realize you were making a silly mistake...  but instead explaining it is helpful down the line to other people! 

Link to comment
Share on other sites

I'm happy to delete this and offer profuse apologies if @djungelorm gets mad at me, but I got KRPC to compile against 1.3.  It LOOKS like all that has to change is the addition of one extra string to the way popupdialog's are called.   This has NOT been subjected to all the automatic testing and general good practices that djungelorm's releases do, because I have realized he is just plain way smarter than me.  But it's working for me and so I don't have to choose between 1.3 and playing with KRPC, so here's a link in the hopes that, until an official release comes out, you won't have to choose either.

https://drive.google.com/open?id=0B3q8VwW68f8AdjZfRGlGZ3JVMjQ

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 months later...

Thanks @djungelorm for the awesome mod. Now I can fly my rockets with C++.

Have anyone try to install this on Mac?

I was trying to install the KRPC library on terminal and somehow the ASIO headers cant be found. 

this is the error I have after run the ./configure 

Quote

checking for protobuf... yes

checking asio.hpp usability... no

checking asio.hpp presence... no

checking for asio.hpp... no

configure: error: Couldn't find ASIO headers.

7

I installed ASIO 1.10.8 via homebrew

the location is /usr/local/include

 

Link to comment
Share on other sites

18 hours ago, KerbalX said:

Thanks @djungelorm for the awesome mod. Now I can fly my rockets with C++.

Have anyone try to install this on Mac?

I was trying to install the KRPC library on terminal and somehow the ASIO headers cant be found. 

this is the error I have after run the ./configure 

I installed ASIO 1.10.8 via homebrew

the location is /usr/local/include

 

The configure script looks for "asio.hpp" in the default C++ include paths. It might be that /usr/local/include is not in the list of paths. I'm not sure how it works on Mac OS, but on Linux you can set the environment variable CPLUS_INCLUDE_PATH.

Also, have you tried the cmake script? Does that report the same error?

Another option would be to copy asio.hpp from /usr/local/include into /usr/include. Bit of a hack though...

Link to comment
Share on other sites

I don't regularly use the C++ client, and I don't usually use krpc on my Macs at all, but I've just tried building the library on two Macs. Both Sierra (10.12.6), both with protobuf and ASIO installed through homebrew. One machine found the headers just fine out of the box. The other one couldn't, but running configure like

CPPFLAGS=-I/usr/local/include ./configure

ensures it configures successfully.

On both machines I then got errors about protobuf, it looks like homebrew's protobuf version is 3.4.0, and the build errors out with 

In file included from ../include/krpc/client.hpp:8:
../include/krpc/krpc.pb.hpp:17:2: error: This file was generated by an older
      version of protoc which is
#error This file was generated by an older version of protoc which is
 ^
../include/krpc/krpc.pb.hpp:18:2: error: incompatible with your Protocol Buffer
      headers. Please
#error incompatible with your Protocol Buffer headers.  Please
 ^
../include/krpc/krpc.pb.hpp:19:2: error: regenerate this file with a newer
      version of protoc.
#error regenerate this file with a newer version of protoc.

That's going to take a little longer to sort out - suspect I'd have to build protobuf myself. :/ 

Link to comment
Share on other sites

12 hours ago, stibbons said:

On both machines I then got errors about protobuf, it looks like homebrew's protobuf version is 3.4.0, and the build errors out with 

In file included from ../include/krpc/client.hpp:8:
../include/krpc/krpc.pb.hpp:17:2: error: This file was generated by an older
      version of protoc which is
#error This file was generated by an older version of protoc which is
 ^
../include/krpc/krpc.pb.hpp:18:2: error: incompatible with your Protocol Buffer
      headers. Please
#error incompatible with your Protocol Buffer headers.  Please
 ^
../include/krpc/krpc.pb.hpp:19:2: error: regenerate this file with a newer
      version of protoc.
#error regenerate this file with a newer version of protoc.

That's going to take a little longer to sort out - suspect I'd have to build protobuf myself. :/ 

That'll be because kRPC v0.3.9 was built with protobuf v3.3.0. I'll release an updated version soon as I can!

Link to comment
Share on other sites

@stibbons I really appreciate the help. I follow your instruction and still have the problem. 

I uninstall and re-install ASIO again with homebrew and found out it's installed at the location 

Quote

/usr/local/Cellar/asio/1.10.8_1 (622 files, 5.4MB) 

and then I ran this command on terminal 

Quote

KX: krpc-cpp-0.3.9 KX$ CPPFLAGS=-I/usr/local/Cellar/asio/1.10.8_1 ./configure

Still got this problems

Quote

checking for protobuf... yes

checking asio.hpp usability... no

checking asio.hpp presence... no

checking for asio.hpp... no

configure: error: Couldn't find ASIO headers.

7

I think Imma try CMAKE to see if I can make it work

 

Have just tried CMAKE and same error occured

 

Quote

CMake Error at CMakeLists.txt:20 (message):

  asio.hpp not found

 

 

Edited by KerbalX
Link to comment
Share on other sites

I've released v0.3.10 :D Here's what's new:

  • Added various new methods to the CelestialBody and Orbit class for converting lat/long to positions, getting asc/desc nodes with a target vessel
  • Added methods for doing closest approach calculations
  • Added Flight.SimulateAerodynamicForceAt that can be used to compute trajectories for atmospheric reentry
  • A .NET 3.5 compatible builds of the C# client is now available, which lets you run the client from within the game (which could then connect to a server running in the same game, or a difference one!)
  • Added support for building the C++ client with cygwin.
  • Updated all the clients to use protobuf version 3.4.0

A full changelog can be found here: https://github.com/krpc/krpc/releases/tag/v0.3.10

Link to comment
Share on other sites

  • 2 weeks later...

Question:

I've been looking all over and experimenting but couldn't find an answer. Anybody knows if there a way to send keystrokes? Currently I'd like to take screenshots, courtesy of the BOSS mod, which is a partless mod activated by a custom shortcut, so it would be a matter of sending the keys, but I can't find how.

Superb mod by the way!

Link to comment
Share on other sites

I'm currently working on a self landing first stage, programmed with Python, and one of the many hurdles is how to get the landing gear and the airbreaks deployed.

For the landing gear I thought this would do it, but I only hear a click and then nothing happens.

for landing_leg in vessel.parts.legs:
    landing_leg.deployed=True

 

I've put the airbreaks on the first action key, but I can't seem to find how to activate them.

As you can see, at this stage there is lots of programming to do :0.0:

I'll place the Python code online as soon as I get this working. The idea is to land automatically on one of the islands east of the KSC.

Edited by BaryonicMan
Link to comment
Share on other sites

17 hours ago, BaryonicMan said:

I'm currently working on a self landing first stage, programmed with Python, and one of the many hurdles is how to get the landing gear and the airbreaks deployed.

For the landing gear I thought this would do it, but I only hear a click and then nothing happens.

for landing_leg in vessel.parts.legs:
    landing_leg.deployed=True

Are you trying to lower landing gear or landing legs? Landing gear are accessed via vessel.parts.wheels. If you want to lower all the gear/legs on the vessel, its also easier to do this:

vessel.control.gear = True

(which is equivalent to pressing g, or clicking the gear button at the top of the UI)

17 hours ago, BaryonicMan said:

I've put the airbreaks on the first action key, but I can't seem to find how to activate them.

You can activate action groups using the control class: http://krpc.github.io/krpc/python/api/space-center/control.html#SpaceCenter.Control.set_action_group

For example:

vessel.control.set_action_group(0, True)

 

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...