Lorentz
Members-
Posts
12 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by Lorentz
-
Hi there! This is the *best* addon, thank you! A couple questions: Is there a way to get a list of vessels that can be launched from VAB/SPH? Is there a way to recover a vessel once landed on Kerbin? I see clicking through the science collected pop-up window has been requested on this forum thread before. Is this not yet implemented? Thank you once again!
-
In principle this should be straightforward - you just need a sockets library and the protocol buffers library. Then its just a matter of building the message to send over TCP to the server and wait for a reply, or am I missing something? edit: by "this" I assumed you meant the krpc addon in general (not the krpc-toolkit).
-
Hey guys, I have been plugging away at a more complete toolkit for krpc. I put it all on github here https://github.com/theodoregoetz/wernher There is virtually no documentation as yet and it is only tested with python version 3. It will probably not work at all with python v2. It uses newton's method (scipy.optimize.newton) to solve for universal anomaly and calculates the Lagrange coefficients, but it can fall back to eccentric/mean anomaly calculations if you want. It makes heavy use of unicode. Here is a short example (let's say you put the python module directory under your PYTHONPATH): import numpy as np from matplotlib import pyplot import krpc, wernher def orbit_from_krpc_orbit(ksc,obt): body = wernher.CelestialBody( name = obt.body.name, gravitational_parameter = obt.body.gravitational_parameter, equatorial_radius = obt.body.equatorial_radius, rotational_speed = obt.body.rotational_speed) return wernher.Orbit( t0 = ksc.ut, i = obt.inclination, Ω = obt.longitude_of_ascending_node, É = obt.argument_of_periapsis, e = obt.eccentricity, a = obt.semi_major_axis, M0 = obt.mean_anomaly_at_epoch, body = body) conn = krpc.connect(name='laptop0', address='192.168.1.9') ksc = conn.space_center vessel = ksc.active_vessel obt = vessel.orbit o = orbit_from_krpc_orbit(ksc,obt) t0 = o.epoch t = np.linspace(t0,t0+1*60*60,200) lat = o.latitude_at_time(t) lon = o.longitude_at_time(t) pyplot.plot(lat,lon) pyplot.show() This should show you the latitude and longitude of the active vessel for the next hour. This includes accounting for the rotation of the orbited body. One problem I have is that I need the right ascension of the prime meridian for each of the planets - I've only just measured these quantities in-game, using kerbal engineer, for Kerbin (0 deg), Minmus (140 deg) and Dres (-65 deg). If anyone knows how I get this information from an outside source, please let me know!
-
Stay tuned on this. I have a working "proof-of-principal" python module which can be used with krpc. It is very much like pyKEP but geared for KSP - and much more "pythonic" in the sense that my only dependency is numpy/scipy (though I'm using python version 3 and have no time/desire to back-port it to 2.x). I have maps with ground tracks and I'm working on interstellar calculations. I recently went into the code and started a major clean-up so it has been delayed a bit. The main power of the module is in its predictions. You should be able to calculate/plot an orbit patch outside of KSP (i.e. in a separate thread). For example: this module can get the state vector (or orbital elements) using krpc and from there can tell you the latitude and longitude the vessel will be over at periapsis - very useful for landing in the right ocean on return from the Mun! When I do finally release it, I'll post in this thread. It will be available on github.
-
[1.3] kOS Scriptable Autopilot System v1.1.3.0
Lorentz replied to erendrake's topic in KSP1 Mod Releases
you could use the ON command in combination with action groups. This is perhaps the easiest way for now. [COLOR=#333333]ON[/COLOR] [COLOR=#333333]AG3[/COLOR] { [COLOR=#333333]PRINT[/COLOR] [COLOR=#DD1144]"Action Group 3 Activated!â€Â.[/COLOR] } -
[1.3] kOS Scriptable Autopilot System v1.1.3.0
Lorentz replied to erendrake's topic in KSP1 Mod Releases
Hi there, i am going to do a complete reorganization of the documentation site in the next couple weeks. This should solve the lost pages problem and hopefully make the site a better "reference" once you have gone through the tutorials. I was just waiting till the 0.15 bugs were settled which it looks like they are now. -
[1.3] kOS Scriptable Autopilot System v1.1.3.0
Lorentz replied to erendrake's topic in KSP1 Mod Releases
I prefer this (pythonic) way if possible: IF 4.9 < x < 5.1 { stuff. } However, its pretty easy just to do this: IF ABS(x - 5.0) < 0.1 { stuff. } -
[1.3] kOS Scriptable Autopilot System v1.1.3.0
Lorentz replied to erendrake's topic in KSP1 Mod Releases
I agree with Steven here. If you just want to use an autopilot, MechJeb is the way to go. If you want to *write* your own autopilot, kOS is the tool to use. I would even suggest that the internals of LOCK STEERING remain private. They should work for very simple craft to ease programmers into kOS, but complex and tuneable PID loops should be the meta-game of kOS. Just remember how hard it was to get your first rocket into orbit using stock KSP! To me, the challenge is most of the fun. As an aside, I have forked the docs on github and am writing a sequel to the quick-start tutorial. My goal is to provide non-programmers with a way to get from simple LOCK THROTTLE commands to a full PID implementation without giving too much away (like a whole auto-pilot system). -
[1.3] kOS Scriptable Autopilot System v1.1.3.0
Lorentz replied to erendrake's topic in KSP1 Mod Releases
The bodies are all available in the global scope as it were: print kerbin:atm:sealevelpressure. 1 EDIT: oops! I can confirm this: print eve:atm:sealevelpressure. 1 -
[1.3] kOS Scriptable Autopilot System v1.1.3.0
Lorentz replied to erendrake's topic in KSP1 Mod Releases
Is there a way to trigger on a staging event? Something like: ON STAGE { PRINT "Staging.". } Or perhaps a way to get the ship's current stage number? SET stage_number TO SHIP:STAGE. WHEN SHIP:STAGE < stage_number { PRINT "Staging.". SET stage_number TO SHIP:STAGE. } -
[1.3] kOS Scriptable Autopilot System v1.1.3.0
Lorentz replied to erendrake's topic in KSP1 Mod Releases
The problem is that the apses become degenerate (ambiguous) when the orbit is circular. I.e. your apoapsis moves when you are burning strictly prograde. The usual solution to this is to burn until the proper orbital speed is attained. This prevents pushing the apoapsis to the other side of the planet. It's easy to calculate: [FONT=courier new]SET target_speed TO SQRT(KERBIN:MU / (target_altitude + KERBIN:RADIUS)).[/FONT] Also, I found the best burn direction to be prograde at apoapsis, not your ship's current prograde: [FONT=courier new]LOCK velocity_at_apo TO VELOCITYAT(SHIP, TIME:SECONDS + ETA:APOAPSIS):ORBIT.[/FONT] [FONT=courier new]LOCK heading_at_apo TO velocity_at_apo:DIRECTION.[/FONT] Finally, if your TWR is high, I recommend to reduce your throttle in the last 5% of the burn to really get an accurate cut-off. Hope this helps! -
[1.3] kOS Scriptable Autopilot System v1.1.3.0
Lorentz replied to erendrake's topic in KSP1 Mod Releases
Is there a kOS "best practices" tutorial anywhere? If not, I am willing to (help) write it as I have learned a lot about what seems to work and what doesn't. I imagine it to be a "Part 2" after the Quick Start Tutorial. Or maybe the "game" is to figure these out yourself? What do you guys think? BTW, I love this mod! Easily the best among the large number I've tried.