Jump to content

[1.3] kOS Scriptable Autopilot System v1.1.3.0


erendrake

Recommended Posts

forumSplash.jpg

This is a continuation of the Excellent work by Nivekk. Without it, this mod would certainly not exist.

What's new CHANGELOG

Current Version: 1.1.3.0 - Released 2017/9/18

What is it

kOS is a scriptable autopilot Mod for Kerbal Space Program. It allows you write small programs that automate specific tasks.

With kOS, you can issue commands to your ships via a command line, or write programs to automate tasks. kOS can interact with other parts on your craft via action groups, it can also be set to run programs in response to action groups being fired.

kOS requires Kerbal Space Program 0.90 or later.

Where to get it

Download the latest version from Curse

Download the latest version from Spacedock

Releases and Pre-Release Builds are posted on Github

Installation

Simply merge the contents of the zip file into your Kerbal Space Program folder.

Usage

Add the Compotronix SCS part to your vessel; it's under the "Control" category in the Vehicle Assembly Building or Space Plane Hanger. After hitting launch, you can right-click on the part and select the "Open Terminal" option. This will give you access to the KerboScript interface where you can begin issuing commands and writing programs.

The SCS module requires some electric charge to operate. You can shut it off to save power by right-clicking it and using the "Toggle Power" option.

Some commands can be aborted, including programs that you have run. Simply open the terminal and hit control-c to break. This is useful if you accidentally write something that runs forever.

Documentation

Reference Documentation

Other Resources

kOS Subreddit - Regular conversation with devs and a lot of code sharing

Bug Report / Feature Requests

Issue Tracker

Changelog

License

This software is released under the GNU GPL version 3, 29 July 2007. View complete license on GitHub.

Edited by erendrake
Updated to v1.1.3.0
Link to comment
Share on other sites

What about including a mention of the original kOS thread and his author?

Being this a derivative work, even taking the same parts of the original mod and the same graphical feel of the original thread, I would strongly consider doing so.

Apart from the above, congrats and thanks for your contribution in keeping kOS alive these days.

Link to comment
Share on other sites

What about including a mention of the original kOS thread and his author?

Being this a derivative work, even taking the same parts of the original mod and the same graphical feel of the original thread, I would strongly consider doing so.

Apart from the above, congrats and thanks for your contribution in keeping kOS alive these days.

I agree. After all, we are building on his work.

Link to comment
Share on other sites

What about including a mention of the original kOS thread and his author?

Being this a derivative work, even taking the same parts of the original mod and the same graphical feel of the original thread, I would strongly consider doing so.

Apart from the above, congrats and thanks for your contribution in keeping kOS alive these days.

I agree completely, I have added a mention of his work. I was considering linking to some of his resources (devblog, github) but i dont want to confuse people.

Link to comment
Share on other sites

Will you add the ability to execute "if" or "when" statements at any time rather than in a linear fashion as it used to be?

If you could be a little more specific about what you would like to run and cannot I will try remove artificial limits to the language.

Link to comment
Share on other sites

If you could be a little more specific about what you would like to run and cannot I will try remove artificial limits to the language.

Sure, here's an example of two "when" statements I would like running at the same time: (language not exact)

-When TWR > 1.5 Then reduce thrust

-When ALT > 5000 Then turn right

Right now with KOS, it's tough to have both of those "When" statements running at the same time. From what I've seen, you can only have one "when" statement" be executed before it'll even consider the second "when" statement. Similarly for "If" statements.

Link to comment
Share on other sites

Is there any thought or development into combining the input screen of this with the rastaerpropmonitor mod?

Not until now! I hadn't really considered the use of KOS with manned missions very much, but something like a space shuttle re-entry is done mostly by computer so i dont see why not.

Link to comment
Share on other sites

Sure, here's an example of two "when" statements I would like running at the same time: (language not exact)

-When TWR > 1.5 Then reduce thrust

-When ALT > 5000 Then turn right

Right now with KOS, it's tough to have both of those "When" statements running at the same time. From what I've seen, you can only have one "when" statement" be executed before it'll even consider the second "when" statement. Similarly for "If" statements.

Basically, your problem is that When acts like a "Wait until this condition is met, Then proceed"

Link to comment
Share on other sites

Not until now! I hadn't really considered the use of KOS with manned missions very much, but something like a space shuttle re-entry is done mostly by computer so i dont see why not.

HURRAY!!!!

As well as space shuttles, I've started playing only through IVA, so I was using KOS for setting up maneuver nodes as well as launching probes, and was hoping that at some point I would be able to save on screen real estate by integrating the code window into one of the screens present in the cockpit.

Link to comment
Share on other sites

Sure, here's an example of two "when" statements I would like running at the same time: (language not exact)

-When TWR > 1.5 Then reduce thrust

-When ALT > 5000 Then turn right

Right now with KOS, it's tough to have both of those "When" statements running at the same time. From what I've seen, you can only have one "when" statement" be executed before it'll even consider the second "when" statement. Similarly for "If" statements.

So some kind of callback that will do something the first time a condition is met?

Link to comment
Share on other sites

Sure, here's an example of two "when" statements I would like running at the same time: (language not exact)

-When TWR > 1.5 Then reduce thrust

-When ALT > 5000 Then turn right

Right now with KOS, it's tough to have both of those "When" statements running at the same time. From what I've seen, you can only have one "when" statement" be executed before it'll even consider the second "when" statement. Similarly for "If" statements.

So some kind of callback that will do something the first time a condition is met?

This is actually a much more complicated issue than it sounds on the surface.

The reason it works like it does is mostly due to "typical" language constructs. While kerbalscript is unlike any other language i've seen, it still under the hood follows the way most normal programming and scripting languages work.

When you say "when TWR > 1.5 then reduce thrust", what you are actually saying is akin to "wait until TWR > 1.5", which blocks program execution, and since kOS isn't multi-threaded, you can't spawn that off in a separate thread.


set done to 0.
until done = 2
{
if TWR > 1.5
{
lock throttle to 0.5.
set done to done + 1.
}
if altitude > 5000
{
lock steering to heading 90 by 45.
set done to done + 1.
}
}

is more akin to what you are saying, in kerbalscript.

To make it work like you want above really goes against standard paradigms. It could be done, like erendrake says, by introducing the concept of events or callbacks, or it could be achieved by allowing you to spawn subprograms into a sperate execution thread. The problem with the former is its a pretty big overhaul of the language. The problem with the former is that multi-threaded concepts get complicated quickly for the uninitiated, and then you start having to deal with locking, race conditions, etc, though some of the issues could be reduced by strict limitations placed on kOS code, then people might get frustrated at the limits.

Edited by Agathorn
Added code in code block for clarity
Link to comment
Share on other sites

Not until now! I hadn't really considered the use of KOS with manned missions very much, but something like a space shuttle re-entry is done mostly by computer so i dont see why not.

To be fair, what manned space flight *didn't* have a computer assisted something?

Link to comment
Share on other sites

Something like Telemachus mod ?

Unless Telemachus has added a command line interface, no.

I want to be able to open a connection and run commands the same way I currently do in the kOS terminal window. Telnet to IP and port, and interact as usual.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...