erendrake

[1.2.2] kOS Scriptable Autopilot System v1.0.3 2016/12/07

5015 posts in this topic

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.0.3 - Released 2016/12/07

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.0.3
27 people like this

Share this post


Link to post
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.

2 people like this

Share this post


Link to post
Share on other sites

@erendrake How would you prefer I handle my Realism fork of kOS? In a separate thread, and just collaborate where it makes sense to do so, or do you want to offer both flavors from here?

Share this post


Link to post
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.

Share this post


Link to post
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?

Share this post


Link to post
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.

1 person likes this

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

Share this post


Link to post
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"

Share this post


Link to post
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.

Share this post


Link to post
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?

Share this post


Link to post
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

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Good informative posts about that issue. I figure there are ways around it like putting "when" statements inside each other, but I figured i'd point it out anyway to see how feasible an update it was.

Share this post


Link to post
Share on other sites

I'd love to see a way to have a terminal window outside of KSP, or even a server set-up, where you can telnet into it and operate the computer.

Share this post


Link to post
Share on other sites
I'd love to see a way to have a terminal window outside of KSP, or even a server set-up, where you can telnet into it and operate the computer.

Something like Telemachus mod ?

Share this post


Link to post
Share on other sites

Personally I think you should be able to go into the mission control building and type up code for the Archive :D

Share this post


Link to post
Share on other sites

Dont forget you can use an infinite loop... Than check for condition a and b.. Do what they need to do, and jump out of the loop to continue the program.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Razark can you post a tutorial of how to do that please?

Also can you guys speak to Cilph about proper integration of kOS into RT?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now