Jump to content

baloan

Members
  • Posts

    74
  • Joined

  • Last visited

Everything posted by baloan

  1. From what I've learned from the current version of kOS let me run my idea of how to organize library code by you. A set of library files, like nodes.ks function aponode { parameter altitude. local myvar is 1. ... }. function perinode { parameter altitude. ... }. function exenode { ... }. and mission.ks run loadfuncs. run aponode(100). run exenode(). will require to preload the functions in loadfuncs.ks: run nodes. // more library files to be added Makes sense or are there better solutions recommended?
  2. When I have a file foo.ks with function aponode { }. function exenode { }. how do I access those functions from mission.ks? aponode(). exenode().
  3. There is a working example of getting the "Surveyor 1.craft" to orbit in the kRPC directory at https://github.com/baloan/mt-krpc
  4. I like the way reference frames are designed. It is so much more explicit and cleaner than in kOS. Fun to work with.
  5. Two more things: 1. Also I noted the connect() call has features - like using a different IP address - which are not documented. 2. the krpc namespace has functions - like get_status() - which are not documented. Please add to the github.io manual. NB: working on migrating my mission toolkit from http://kos.wikia.com/wiki/Mission_toolkit_v3
  6. The documentation tells about a streaming port. Some time there was a post about how to add_stream(getattr ... ). add_stream is nowhere documented, though. Is it still required?
  7. ANN: mission toolkit v3 published (together with a submission to the Kerbal Automated Mission Challenge) What makes the scripts stand out: 1. all maneuver nodes - including intraplanetary transfers - are _calculated_. No long running encounter finding, 2. super accurate node runner (usually gets orbit altitudes correct down to 0.1%), 3. inclination maneuvers calculated using vector calculus, 4. staging and trajectory code separated. The script and craft files are available here: http://kos.wikia.com/wiki/Mission_toolkit_v3 Videos available here
  8. I'd like to make two submissions: 1. Kerbin-Mun round-trip, and a 2. Kerbin-Minmus round-trip. What makes the scripts stand out: 1. all maneuver nodes - including intraplanetary transfers - are _calculated_. no long running encounter finding, 2. super accurate node runner, 3. inclination maneuvers calculated using vector calculus. The script and craft files are available here: http://kos.wikia.com/wiki/Mission_toolkit_v3 Kerbin - Mun round trip. Sorry, no commentary. Kerbin - Minmus round trip. Sorry, no commentary.
  9. What do you think about monthly releases? 12.2p1 has been published on May 21st and I see fixes and changes accumulating on github. In order to have some transparency and consistency with release naming I suggest: 1. only fix bugs between a 12.2* and the final 12.2 release. 2. put new features in the next release 12.3 branch. Does it make sense?
  10. I am looking for commands to end a program. The use case looks like this: declare parameter name. if ship:vesselname <> name { print "WARNING! This script maybe incompatible.". print "Designed to work with '" + name + "'". print " Current ship '" + ship:vesselname + "'". // end program } Is there an existing solution? Otherwise I want to open a ticket to add an "end" command.
  11. My mission toolkit here contains the exenode subprogram which does exactly what you are looking for.
  12. Anyone knows a way/mod to display a latitude/longitude grid on a planet or moon? Or to have an enhanced mouse cursor that displays latitude/longitude next to the mouse cursor? I am looking for a way to visually select latitude/longitude of a landing zone for my lander.
  13. That sounds like a good start. Sooner or later there will be breaking changes in the protocol. It is a wise move to add some kind of versioning when the connection is negotiated. That way client library migration can be done independently. It's not a cure but it lessens the pain.
  14. Anyone knows a way/mod to display a latitude/longitude grid on a planet or moon? Or to have an enhanced mouse cursor that displays latitude/longitude next to the mouse cursor? I am looking for a way to visually select latitude/longitude of a landing zone for my lander.
  15. I disagree. I am a pilot and I've never used the terms absolute and true altitude while flying. Altitudes are given in MSL and "above ground" or SFC/AGL. That's how it is referred to in aviation charts. Surface is not defined in the wiki page. I think it is confusing how surface_altitude and absolute_altitude is defined in kRPC.
  16. I mean I'm using two threads with one connection each. "Sending data over the (same) connection" will not happen in that setup.
  17. I've encountered a FlightControl class in the git repository which looks like having suffixes for controlling thrusters. Are those suffixes available from the terminal?
  18. I am trying to determine burn end time for arbitrary maneuver nodes. Node.delta_v is not updated during a burn while on the UI the remaining delta_v counts down. So it can't be used. Thinking about it I see potential alternative solutions: 1. pre-calculate burn time and thrust (difficult because neither thrust nor vessel mass are available) 2. cross check against the target speed in flight.velocity. I am wondering though whether flight in orbit reference frame will do? Probably you will have to use flight in maneuver reference frame. Can I simply add node.vector to flight.velocity in maneuver reference frame? Anyone knows? @nubnax: can reproduce vessel.target issue. Same here.
  19. During launch I observer time lag in the main while loop. My guess this is due to the many round-trips for RPC the code is doing. My code queries a few parameters in the while loop. Wouldn't it be nice if the KSP based code pushes all telemetry data every 100ms to the kRPC client? In the kRPC client a background thread receives the data and applies it to shadow variables in the Python space. Since the main idea is to reduce latency and round-trips it makes most sense to collect all telemetry data in one protobuf message and send this one buffer every 100ms. RPC calls will only be necessary for control type or auto_pilot requests to the vessel. Any data queries can be satisfied from the local cache. I thought about implementing this optimization but realized it involves KSP side changes. Any plans to implement something like this?
  20. I'm using a second thread for staging. It actually works! def stage_thread(name_): ksp = krpc.connect(name=name_) print 'Connected to server, version', ksp.krpc.get_status().version space_center = ksp.space_center vessel = space_center.active_vessel control = vessel.control resources = vessel.resources oxi0 = resources.amount('SolidFuel', stage=4, cumulative=False) time.sleep(1) oxi1 = resources.amount('SolidFuel', stage=4, cumulative=False) ops = oxi0 - oxi1 time_to_flameout = oxi1 / ops print "Booster flameout in {} sec".format(time_to_flameout) time.sleep(time_to_flameout - 1) print "Checking for flameout".format(time_to_flameout) while True: oxidizer = resources.amount('SolidFuel', stage=4, cumulative=False) if oxidizer < 0.1: control.activate_next_stage() break time.sleep(0.1) while True: lox = resources.amount('LiquidFuel', stage=3, cumulative=False) if lox < 0.1: control.activate_next_stage() time.sleep(1) control.activate_next_stage() break time.sleep(0.1) Called from the main program like this: def main(): stage = Thread(target=stage_thread, args=["Autostage",]) ...
  21. In Autopilot methods the description says: but I think it should read Vessel.direction. Vessel.direction in kOS corresponds to FACING which is the direction of the rocket or plane axis. UP in kOS always points away from the center of the celestial body through the ship. Another one: clear_heading() should be replaced with disengage()
  22. Documentation question: Sure it is at the surface (SFC)? I guess it is at mean sea level (MSL) or the mean radius (for planets and moons without oceans). Btw: How about: 1. SurfaceAltitude (above surface, either rock or sea) [now absolute_altitude] 2. MeanAltitude (above MSL, or mean) [now true_altitude] 3. BedrockAltitude (above hard surface) [now surface_altitude] 4. elevation is self explanatory.
  23. double Resources.max (string name, uint32 stage = 0) with stage = 0 returns the resource for the vessel. When stage > 0 it returns the value for the stage. I have stages 0 to 4. How does the stage argument map to my stages? IMHO stage should default to -1. Then values [0:] from the KSP UI can be used as argument without applying a shift.
  24. Two questions: 1. How do I instantiate a vector in Python? As an example I'd like to take import krpc p = krpc.space_center.active_vessel.flight().prograde pn = norm(p) [B]v = (1,0,0) # what is the correct type to use here? Geometry.Vector3?[/B] a = cross(pn,v) 2. Can I run multiple threads using a kRPC connection? I'd like to run a thread monitoring conditions for staging in a separate thread: def run_thread(): while liquid_fuel() > 0: time.sleep(1) control.activate_next_stage() If not: events might be an elegant alternative as they spare the effort of polling.
×
×
  • Create New...