Search the Community
Showing results for tags 'krpc'.
The search index is currently processing. Current results may not be complete.
-
So I was messing around with kRPC and decided to try out its Java library by making a minecraft mod that lets you control your craft in KSP from within Minecraft. I then went to the Mun with it, because I'm insane. .Mod here if anyone is interested: https://minecraft.curseforge.com/projects/kerbal-craft Source code: https://github.com/williambl/kerbalcraft The add-on used in KSP is kRPC, which can be found here:
- 11 replies
-
- 25
-
Hi guys, for a school project wanted to to some BFS style landings and tried krpc with Infernal Robotics and a python script to build it. Unfortunatly, my script is not working at all. I can run it and krpc get a popup that a scripts want to connect, but if I run it it says "RESTART" and thats all. As if it never get over the initial connection with krpc. Can somebody please help me? My setup: KSP-Version: Steam, 1.4.2 CKAN 1.25.4 Kronal Vessel Viewer 0.0.9.6 with Click Through Block 0.1.6.7 and Toolbar Controller 0.1.6.16 (installed with CKAN) KRPC 0.4.8 Kerbal Engineer Redux 1.1.4.10 Infernal Robotics - Next 3.0.0.0 beta3 for KSP 1.4.2 # Import benötigter Module import krpc # Aufbau der Verbindung zu KRPC und Auswahl der aktiven Raumfähre verbindung = krpc.connect(name='Alpha ') faehre = verbindung.space_center.active_vessel # Anlegen von Variablen um die Servos zur Steuerung ansprechen zu können lb = verbindung.infernal_robotics.servo_with_name(faehre,"LinkerBug") rb = verbindung.infernal_robotics.servo_with_name(faehre,"RechterBug") lh = verbindung.infernal_robotics.servo_with_name(faehre,"LinkesHeck") rh = verbindung.infernal_robotics.servo_with_name(faehre,"RechtesHeck") # Ausgabe der aktuellen Position der Servos print lb.name + " " + str(lb.position) print rb.name + " " + str(rb.position) print lh.name + " " + str(lh.position) print rh.name + " " + str(rh.position) # Anlegen von Variablen für die Servopositionen, setzten auf 0 lbp = 0 rbp = 0 lhp = 0 rhp = 0 # Überprüfen ob die Bremse aktiviert wurde # Wurde die Bremse aktiviert, # wird der 'Servo-Modus' gestartet, der erlaubt, über die # Spielsteuerung die Seitenleitwerke mithilfe der Servos zu kontrollieren bremse = vessel.control.brakes servoModus = False while(1): if vessel.control.brakes: if bremse != vessel.control.brakes: rhp = -45 lhp = 45 rbp = -45 lbp = -45 rh.move_to(rhp,5) lh.move_to(lhp,5) rb.move_to(rbp,5) lb.move_to(lbp,5) bremse = vessel.control.brakes servoModus = True else: if bremse != vessel.control.brakes: rh.move_to(0,5) lh.move_to(0,5) rb.move_to(0,5) lb.move_to(0,5) bremse = vessel.control.brakes servoModus = False # Bewegungen entlang der Roll-Nick-Gier-Winkel if servoModus: neigen = vessel.control.up bewegung = False if(neigen != 0): bewegung = True if(neigen < 0): lbp = lbp + 0.5 rbp = rbp - 0.5 lhp = lhp - 0.5 rhp = rhp - 0.5 if(neigen > 0): lbp = lbp - 0.5 rbp = rbp + 0.5 lhp = lhp + 0.5 rhp = rhp + 0.5 gieren = vessel.control.right if(gieren != 0): bewegung = True if(gieren > 0): lbp = lbp + 0.1 rbp = rbp + 0.1 lhp = lhp - 0.1 rhp = rhp + 0.1 if(gieren > 0): lbp = lbp - 0.5 rbp = rbp - 0.5 lhp = lhp + 0.5 rhp = rhp - 0.5 rollen = vessel.control.forward if(rollen != 0): bewegung = True if(rollen > 0): lbp = -45 rbp = -45 lhp = 45 rhp = -45 if(rollen < 0): lbp = 0 rbp = 0 lhp = 0 rhp = 0 if bewegung: rh.move_to(rhp,1) lh.move_to(lhp,1) rb.move_to(rbp,1) lb.move_to(lbp,1) Thank you! HCF
-
Hello everyone! I want to share with you my project called 'New Kepard'. It was inspired by New Shepard rocket landing: My goal was to recreate it in KSP using the kRPC mod which allows you to write your own scripts to control the vessel. The developement of the project took me much longer than I had originally thought (more than 100 hours). Writing the program which controls the rocket was not the hardest thing. Bugfixing, tweaking, testing and ensuring that the code is prepared for every possible flight scenario was what I spent the most of the time (~75%) on. I am now very happy that I made it to the end and didn't give up. I created two films about my project: The first one was edited to be similar to the original Blue Origin's video The goal of the second film is to show what my project is and how to use it Code and the craft are avaliebe to download on GitHub. I hope you like what I've done
-
Hi! I've been working on a standalone mission editor (prebuilt windows download here) for KSP that uses the krpc mod to connect to KSP. I've been working on it on and off for a few months and just picked it back up for a university module so have made some decent progress recently. I've thrown together a quick video showing some basics off and I'm hoping some of you lovely people will give it a go and throw some feedback my way - either here or on the issues page. Even better I'd welcome code contributions with new functionality! Also, send me interesting missions and accompanying crafts that you've made - I'd love to try them out!
-
Time to fly rockets with kRPC and Python. I know very little Python and am hoping this will be a fun way of learning the basics. Like how when I was a kid at school and we'd write programs to make the turtle drive around, only with rockets. In future I will make this opening post prettier and more detailed and so on. I just want to get the thread started now My rules: All flight of unmanned vehicles, and most flight of manned vehicles, to be conducted using kRPC. Manual control inputs to be kept to a minimum. To focus on the Python coding, all rockets to be 'off the shelf' - the game's stock craft, craft from KerbalX or this forum, etc. Light non-structural modifications, for example changing science equipment, is allowed. Rossum Program The Rossum Program will be my first steps.
-
I am trying to build an interface to a control panel that uses joysticks to interface to KSP via the KRPC. I have everything working, reading the joystick values into a raspberry pi, and then having the pi connect to the KRPC server. I am trying to achieve a 10Hz or better rate for the controls. For my python code, I execute the calls on a loop. while(True): GetJoyStick() start = time.time() vessel.control.pitch = joystick_pitch vessel.control.yaw = joystick_yaw vessel.control.roll = joystick_roll vessel.control.thottle y= 1 vessel.control.forward = 0 vessel.control.right = 0 vessel.control.up = 0 end = time.time() print(end-start) I played around with some different settings in KRPC advanced settings in the KRPC interface, the best I could get was 45 RPC/sec. Here is a print statement of time for the update to occur as shown in the code above. Starting Controls/// 0.439182043076 0.435542106628 0.437279939651 0.441950798035 0.443905830383 0.400623083115 0.742579936981 0.438502073288 0.443440198898 0.435302972794 0.439296007156 0.623143196106 0.461045980453 0.442525863647 0.43900513649 0.439331054688 0.47675204277 0.439754962921 I am wondering if this is the best approach that I am taking. For a bank of switches, the rates are fine, but for joystick control, it can be a little laggy. Any help is appreciated. Thanks, Tom
-
Is there any way to semi-accurately predict where a craft would land? Mechjeb does this and gives a latitude and longitude, but I do not understand how it works. I'm trying to write a script that lands a sub-orbital rocket back on the launch pad in python using kRPC. Also, what would be a good way to steer the rocket onto the launch pad? The standard space plane control surfaces wouldn't work for a rocket in freefall.
-
I'm writing a python script using kRPC to propulsively land on Kerbin, but I can't find how to calculate the time to impact. Mechjeb and Kerbal Engineer do this, but I don't think kRPC can interact with them. With kRPC I know my current altitude, surface velocity, verticle velocity, horizontal velocity and terminal velocity. Is there an equation that I can use to get the time to impact?
-
Hi everybody! I've been playing with kRPC, and loving the fun of learning how to Python (which is how I justify playing more Kerbal) and have a question that's stumped me the last few days. I have a craft with a central LFO engine, surrounded by decoupler attached LFO booster stacks. I'm looking for a way to determine when the fuel tanks that are radially attached are empty. Currently, I can call resources in a specific stage, which includes the main engine, and I can call object instances of all engines. Neither of those, however, help me, because the total resource level will never equal zero before I need to jettison tanks, and I cannot seem to pinpoint a singular engine instance to test for whether the engine has_fuel. I can test if all the engines have fuel, returning true if any single one still does, which also doesn't get me a usable result. Finally, I've tried to mathematically calculate the usage of propellant based on the stats of the engines, but the central and radial engines are different rates, and I also have vernor engines that differ in consumption, so my attempt to compute a hard time limit on the burn without, of course, first just running the rocket on the stand (which kinda defeats the purpose I'm looking for) failed. Any help is appreciated! Thanks all for any insight, this has been a really good challenge, but I'm breaking down and asking for help. Cheers!
-
So, here we go. I had/have the idea of creating a mfd (MultiFunctionalDisplay, what raster prop monitor basically is) outside of KSP using the kRPC mod and python. Doing the readouts and whatnot isn't the problem but the UI is. Currently it looks like this (pic) and I'd be great to have somebody who knows python and QT/qtpy and could help me making the actual display (the switching screens, displaying the navball and so on) since I'm fairly new ot the whole thing and I'm currently a little out of ideas. To people who would like know why I want such a display: There would be soo many new things to implement like imagine all the graphs you could draw using matplot for example, it would also be awesome for the people who have the Thrustmaster Cougar MFD, you can also calculate a excrementston of things which may not be possible inside of KSP/RPM. ui.py is the .qt (xml) code from the UI, translated by pyqt4 and ksp.py are the readouts done through the kRPC plugin stored in dictionaries for the moment. ui.py ksp.py I hope somebody could help since once the way how to create the tabs is figured out, the other stuff becomes rather simple and should be rather easy to do. And if somebody wonders how to execute the following code: 1. downlaod python 2. pip install krpc 3. pyqt4 wheel (wheels = installer for binaries/packages) is available on http://www.lfd.uci.edu/~gohlke/pythonlibs/ 4. run the code.