Jump to content

Release KontrolSystem2 (0.4.2)


Untoldwind

Recommended Posts

This is supposed to be a scripting system (like kOS) to control kontrol everything.

Obviously this quiet the task, so right now I'm looking for some very brave Kerbonauts to give an initial spin (i.e. see if it works anywhere else but on my machine)

Links

SpaceDock: https://spacedock.info/mod/3316/Kontrol System 2

Releases:https://github.com/untoldwind/KontrolSystem2/releases

Documentation: https://kontrolsystem2.readthedocs.io/

Reddit:  http://www.reddit.com/r/kontrolsystem2

Source: https://github.com/untoldwind/KontrolSystem2

 

 

Features

At the moment the mod is just shipped with 3 demo scripts:

  • hello_world - the obvious one
  • circularize - creates a maneuvering node to circularize the orbit
  • intercept - creates a maneuvering node to intercept the target (only work in the same SOI for now)
  • exec_node - executes the next navigation node (very basic)

... but whole idea is that you create your own.

Missing features

  • Lots of documentation - again, the obvious one
  • A lot of bindings are missing to actually write an autopilot, I was focusing on the orbital math so far

Installation

Requires SpaceWarp 1.3.0 (or later), which in turn also requires UitkForKsp2

Unpack where game executable is located

Licence

MIT

Edited by Untoldwind
Link to comment
Share on other sites

Hello Untoldwind,|

brave I am :) and thank you so much - I love kOS.

Installed: https://spacedock.info/mod/3277/BepInEx Space Warp Plugin
And: https://github.com/untoldwind/KontrolSystem2/releases/tag/v0.1.0

Works like charm - it did create a proper maneuver node.

Issues I currently have:

- The Main Window (KontrolSystem 0.0.0.0) cannot be moved and will keep it's position until restart of ksp.
If you resize from Ultrawide to FullHD you cannot use or move the window. Expected: You still can access the window.

- I would love to see what vehicle I am operating on xD

Cheers :)
 

pUQMmLi.png

Link to comment
Share on other sites

12 hours ago, sym said:

Works like charm - it did create a proper maneuver node.

Issues I currently have:

- The Main Window (KontrolSystem 0.0.0.0) cannot be moved and will keep it's position until restart of ksp.
If you resize from Ultrawide to FullHD you cannot use or move the window. Expected: You still can access the window.

Whee ... that is good news :) 

The UI is kind of a quick and dirty port from the one I had in KSP 1 where the main window was supposed to be attached to the toolbar. Does not make much sense any more I guess, so I'll fix that.

11 hours ago, sym said:

Added that just yesterday, it is ok-ish with some minor issues.
On that note: I should probably work a bit more on the documentation of the language itself first ;) 

4 hours ago, Elox said:

Man... I was thinking of doing one myself. Hope I can help with the project.

Sure, any form of contribution and help is welcome

Link to comment
Share on other sites

Is it going to be like KOS or a different mod that also can do scripting/programming? i dont know about licensing and stuff but i hope @dunbaratu would love that and you can easily attach to the existing KOS wiki with all the documentation 

 

Link to comment
Share on other sites

I'didgot a trouble to open it using the app bar. like many other mods the app is not present in the bar.  after a save-load the app button was visible. Got the same trouble with lazy orbit mod, sot it's not this mod fault.. despite a key shortcut would be a good workaround.

But then the result was excellent. I'm really impatient to have some little guideline for how to create new script in it. I've found the to2 files but I've never met such a language. no plugin to colorize them in vscode for instance. 

thanks  for this great work. 

 

Link to comment
Share on other sites

Created an initial patch (0.1.1)

https://github.com/untoldwind/KontrolSystem2/releases

Fixes

  • Main window is now dragable ;) 
    • ... and shows the correct version number
  • Made unit tests running on visual studio on windows
  • Added a (rough) estimation for the burntime so that maneuvering nodes match better now (though still not exact)
  • ... and lots of internal stuff I stumbled over

Added features

  • Made time-wrap available to scripting
  • Made SAS available to scripting
  • Made vessel delta-V information available to scripting
  • ... and last but not least a very simple script to execute a maneuvering node
    • This is just using SAS and throttles to 100% for the estimated burn time and is therefore not very good
    • ... but we actually are in kontrol now ;)

Anyway what is (roughly) possible now:

  • target the Mun
  • Create an "intercept" maneuver to it
  • Execute that maneuver
Link to comment
Share on other sites

10 hours ago, mr.gvozd said:

Is it going to be like KOS or a different mod that also can do scripting/programming? i dont know about licensing and stuff but i hope @dunbaratu would love that and you can easily attach to the existing KOS wiki with all the documentation 

Well, the TO2 language I invented is quite different from the KOS language. Some of the key selling points:

  • It's strickly typed (i.e. there is actually a compiler before you can run it and stumple over a silly typo in mid-flight)
  • Internally it is converted to IL-code and (almost) runs with the same speed as C#
    • ... so you can do some numerics in there.
    • E.g. there already is a Lambert-solver, an amoeba-optimizer (aka Nelder-Mead, but amoeba sound cooler) and an simulated anealing optimizer. Which is all put together in the "intercept" example

 

6 hours ago, cfloutier said:

I'didgot a trouble to open it using the app bar. like many other mods the app is not present in the bar.  after a save-load the app button was visible. Got the same trouble with lazy orbit mod, sot it's not this mod fault.. despite a key shortcut would be a good workaround.

But then the result was excellent. I'm really impatient to have some little guideline for how to create new script in it. I've found the to2 files but I've never met such a language. no plugin to colorize them in vscode for instance.  

  • The app-bar is somewhat surprising, I think I'm using the SpaceWarp-API correctly. But I'll take a look into it and see who other mods have dealt with it. A temporary hotkey should be easy to implement
  • Concerning the TO2 language:
    • You can just edit the files in the plugin-folder ( BepInEx/plugins/KontrolSystem2/to2) or add new ones using the "main_flight" entry point. After each change you can press the "Reboot" button in the game an everything gets recompiled (or there is an error in the manager)
    • ... but yes, I'm working on the documentation.
    • And there actually is a vscode plugin: https://github.com/untoldwind/KontrolSystem2/tree/master/Tools/vscode/to2-syntax;)
      • ... ok it something I just threw together on the spot and you have to manually copy it to you extensions folder
Link to comment
Share on other sites

Just tested 0.1.1 - thanks a lot for the update.

- Movement of Main Window works fine now
- Scripts circularize and exec_node perform well
- Main Window responds well to ship selections
- Reboot loads newly created to2 scripts well

Untoldwind, it would be lovely if you could answer these two questions:

I copied to2-syntax to \users\[name]\.vscode\extensions but the extension does not show up in vscode. Any hint? Do you plan to add it to the marketplace?

What is the point of the Window "KontrolSystem: ModuleManager"?  Future work or legacy xD?

Cheers :)

Link to comment
Share on other sites

9 hours ago, sym said:

I copied to2-syntax to \users\[name]\.vscode\extensions but the extension does not show up in vscode. Any hint? Do you plan to add it to the marketplace?

What is the point of the Window "KontrolSystem: ModuleManager"?  Future work or legacy xD?
 

  • Obviously I'm very new to the vscode extension business ;) ... maybe there is a difference to the OSS version I am using.
    Anyway: I just packed the the extension as VSIX (https://github.com/untoldwind/KontrolSystem2/releases/download/v0.1.1/to2-syntax-0.0.1.vsix) which seems to work both on linux and windows (using the three-dots button on the Extensions-Sidebar)
  • Currently the only use of the ModuleManager windows is to show error messages when the Reboot fails (e.g. there is a compilation error somewhere).
    But I agree that this is very rudimentary at the moment and could need a lot of improvement.
    ... I think my original idea was to have a list of all the modules (i.e. script files) there, including the "library" scripts that do not appear in the main window, and maybe even something of an in-game editor for quick-and-dirty fixes
    Any suggestions/ideas are very welcome here, I'm pretty useless when it comes to UI/UX 

 

8 hours ago, sym said:

When increasing the window size of the console, previously hidden text is not displayed.
Expected: I can read console output that was hidden / truncated by a small window size.

Probably because I pre-fill the lines with spaces to easily support "print_at". I will look into it.

On that note: Do you think the console-window should have scrollbars?

Link to comment
Share on other sites

Console Navigation
- Scrollbars would require focus bc scrollbars without scroll wheel are underwhelming
- Scrollbars using mouse track and up down buttons do not conform with expectations bc. playing point and shoot is not fun (except when playing Moorhuhn)
- If there would be or is a general proper focus management in ksp ui, then scrollbars would work - but I don't see that right now!
- Buttons (next to "Clear") "PgUp", "PgDown", "Home", "End" would make sense and are immersive
- I think buttons would be "cool" but not required, although a little disappointing not being able to access logs since start

Link to comment
Share on other sites

Hello Untoldwind,

thanks for your openness regarding UX/UX ModuleManager Window.

A simplification would be:
1. "No error" and "Status: OK" reflects the same information.
2. Reboot info and app status can be added to "Main Window" Status Bar like "Status: OK", "Status: Rebooting...", "Status: Error - Foo went wrong!"
3. Reboot time can be removed
4. This would reduce "Main Window" Button-Bar to "Console, Reboot - Close" - No additional labels like "Control" or "Global VALUES" are required.

That way you could get rid of the window "Module Manager".
As a result we just have "Main Window" and "Console".

Cheers :)
 

N6IzTut.png

Link to comment
Share on other sites

Created another patch release: 0.1.2

  • Added a hotkey as suggested (Alt-K).
    • This can be toggled of in the BeInEx/SpaceWarp configuration manager if it interferes with something important
  • Added additional bindings to the vessel (thanks Elox btw)
  • Improved the resizing of the console window (stuff should not just vanish any more)
  • Slightly improved the Manager window, though still very basic
    • ... I think I'll eventually merge this with the main window as additional tabs after some refactoring

@Elox

The CelestrialBodyComponent has a GetAltitudeFromTerrain method, which takes an arbitrary position as argument. I'm not sure if that is what you are looking for.

Speaking about "Position": Obviously they have wrapped the coordinate transformations (which as quite messing in the old API). Probably there should be a binding for this so that one can choose the preferred reference frame in the scripts

Link to comment
Share on other sites

Somewhat smaller patch: 0.1.3

  • Close all windows if main menu (ESC) is opened
    • Thanks @sym for pointing that out. I played around with `GUI.depth` but that seems to have no effect at all. Look like all IMGUI elements are always on top of the Kerbal UI (which is based on Unity.UI as far as I can tell). So closing all windows is probably the best compromise for now
  • Fix the `vessel.staging.next()` method to actually work :) 
  • Added a `launch_rocket` script to launch a rocket into orbit
    • ... at least for one rocket ... probably should have taken video evidence
    • Will most likely not work on every creation, but that is the actual fun of it

 

1 hour ago, ColKlonk2 said:

Having the ability to move the console onto a second monitor/screen would be nice.

I'm not sure if this is possible with in-game objects at all.

The original kOS had a build-in telnet-server that you could connect to from an external console window, but this requires opening a listening port, which is most likely not covered by the guidelines for mods.

Maybe the other way around is acceptable, i.e. have the mod connect to some external process?

Link to comment
Share on other sites

I guess it is no longer a pre-release now: 0.1.4

  • Combined the toolbar window and the modulemanager window
    • Thanks @sym for the feedback and suggestions
  • Added some really helpful bindings, like "expected_orbit" on maneuvering nodes or "parts_in_stage" on vessel.staging
  • Improved the "exec_node" script
    • It is now much more precise and also detects when staging is necessary
Link to comment
Share on other sites

It's wonderful that someone is doing this.  As the person maintaining kOS for KSP1, I felt bad that my computer is not up to being able to do KSP2 so I'm not part of the KSP2 hype so kOS for KSP2 isn't really a thing I can be working on.

(Also, I am in a job search where until I land a job it would be irresponsible for me to be shelling out the cash and free time it would take to be doing a kOS for KSP2 right now.)

There's things I'd want to do differently if I did do a kOS for KSP2 and it looks like some of those things are in the mind of the person doing this.  For one thing I didn't start the kerboscript language so when I enhanced it with lots more stuff like scoping, function calls, and delegates, it was always piecemeal one new feature at a time and therefore I sided with "keep it looking similar" rather than "do it like normal languages would do it" a lot of the time.  That led to, well, the weirdness that is kerboscript.

Link to comment
Share on other sites

This is great news!  That said, I'm at a loss.  My programming "skills" are some basic Python and kOS.

I'm pretty much at a loss.  I've been trying to figure out how to display latitude and longitude.

From the Hello World example, I see how you get fields (and methods) under vessel.orbit
Using that, I tried with other fields under orbit, such as radius, and apoapsis.  I saw in vessel, in addition to orbit, there's also geocoordinates.  So I figure, I can substitute orbit with geocoordinates, and use the fields under that. 

        let pos = vessel.orbit.relative_position(ut)
        let vel = vessel.orbit.orbital_velocity(ut)
        let rad = vessel.orbit.radius(ut)
        let ap = vessel.orbit.apoapsis
        let lat = vessel.geocoordinates.latitude

I get an error with the last line: "Type vessel does not have a field "geocoordinates"

 

Link to comment
Share on other sites

6 hours ago, Dunbaratu said:

It's wonderful that someone is doing this.  As the person maintaining kOS for KSP1, I felt bad that my computer is not up to being able to do KSP2 so I'm not part of the KSP2 hype so kOS for KSP2 isn't really a thing I can be working on.

(Also, I am in a job search where until I land a job it would be irresponsible for me to be shelling out the cash and free time it would take to be doing a kOS for KSP2 right now.)

There's things I'd want to do differently if I did do a kOS for KSP2 and it looks like some of those things are in the mind of the person doing this.  For one thing I didn't start the kerboscript language so when I enhanced it with lots more stuff like scoping, function calls, and delegates, it was always piecemeal one new feature at a time and therefore I sided with "keep it looking similar" rather than "do it like normal languages would do it" a lot of the time.  That led to, well, the weirdness that is kerboscript.

:o ... I'm lost for words here. Feels like I should print and frame this post.

It's an honor. O7

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.

×
×
  • Create New...