Jump to content

kOS Scriptable Autopilot System 0.9


KevinLaity

Recommended Posts

...and we have not heard from Kevin about his plans yet.

Exactly. It's been almost two months. One member has made an effort to contact Kevin (and apparently reached him). Kevin has not made contact with the community in this thread, his blog, of github. If we continue to wait for him to make his plans known, we may be waiting a long time. Lack of communication with him should no longer be considered a roadblock to further development of a kOS fork.

Link to comment
Share on other sites

Exactly. It's been almost two months. One member has made an effort to contact Kevin (and apparently reached him). Kevin has not made contact with the community in this thread, his blog, of github. If we continue to wait for him to make his plans known, we may be waiting a long time. Lack of communication with him should no longer be considered a roadblock to further development of a kOS fork.

As I said on one of the previous pages, I am trying to contact Kevin to ask what his personal intentions are and as a general courtesy. With christmas I am not actively pursuing contact though, I feel that is time for people to be left alone with their families. After christmas I will try again.

Link to comment
Share on other sites

This is NOT a working version. It fixes one problem and introduces others.

The fix was applied against the master branch which had been updated after the 0.9.2 release; I firmly believe these regressions were added between 0.9.2 and my applying the hotfix to it.

In other words, if somebody goes back in the history and find the commit against which the 0.9.2 release was built, applies the hotfix against it, and builds it, the end result should be a working .23 with NO regressions.

In the kOS sphere, I'm too busy with my MunOS fork to start that search. If you recognize the pun, there's a good chance you'll know what I'm doing.

Edited by MaHuJa
Link to comment
Share on other sites

This is NOT a working version. It fixes one problem and introduces others. It broke the ability to make comparison tests against literal strings, requiring the addition of pointless extra lines of code to replace all such instances with comparisons against string variables. Since my code happened to be near the 10k limit already, and has a lot of comparisons to literals, this is a nontrivial change to make, and its a rather bad idea to make that change for a thing that is clearly a bug introduced by somebody's recent edit of the code.

Are there any other issues? You mention others, can you tell us what they are please so we can avoid them?

Also, you know you could change this in your persistence


harddisk
{
capacity = 10000
volumeName =
}

I imagine it would be a trivial change to up that limit

If you are tight on space but want to retain functionality, you could write ift.txt

which would be


declare parameter (tv,txt).
set tg to 0.
if tv=text {set tg to 1.}.

then you could use


run ift (encounter,"Mun").
if tg=1{STUFF}.

which would not add many bytes to your code per instance although I agree, if the bug is due to a recent change it would be prudent for that to be fixed rather than change your code.

I really am interested in knowing about any other issues though, if it is just literal comparison of strings then most people could find workarounds until a fork is made or the recent changes are fixed.

Myself I see as more of a problem the issue where if your savegame has a variable expressed with a power then that craft will not load which has been an issue since 0.22 and before the recent changes.

Is there anyone familiar with scripts who could write a script to delete any variables that have a power (^) from within the variable section of the kos unit inside the persistence file?

Link to comment
Share on other sites

Are there any other issues? You mention others, can you tell us what they are please so we can avoid them?

I am assuming there must be other changes I don't know about since I stopped when I hit that first problem and wasn't able to see what else may be wrong without changing my code which I'm not willing to do because it requires a re-write. There are a lot of pull requests on github that are still the matter of debate, and I didn't want to use a version that might have them in it.

Is there anyone familiar with scripts who could write a script to delete any variables that have a power (^) from within the variable section of the kos unit inside the persistence file?

What is missing that would be required to make this a generic solution is the ability to iterate over all the variable names. You can't do a thing like:

For each variable that exists do a thing with that variable.

You instead have to hardcode the name of each and every variable you want to check, at which point there is no point in checking them - you just hardcode to zero out the ones you know will hold big values or strings. I don't consider this a viable solution either because of the pointless extra lines of code it requries. Because you have to name each variable you're going to zero out individually there is no generic terse solution.

Link to comment
Share on other sites

I apologise that my post is rather off-topic, but I've been struggling to get this plugin to install properly for the past two hours. I'm able to access the CX-4181 module in the build menu, but when I launch and open the kOS terminal I'm greeted with a semi-transparent window in which I'm not able to enter any commands. It's like the graphic is opening, but not the kOS program itself.

Clearly I'm going about the installation the wrong way. I've not been able to find any step-by-step kOS installation instructions anywhere - the instructions in the KerbalSpacePort just say to merge the contents of the folder, which isn't very helpful to me! Could someone possibly explain where each of the files should be put after unzipping?

Link to comment
Share on other sites

I apologise that my post is rather off-topic, but I've been struggling to get this plugin to install properly for the past two hours. I'm able to access the CX-4181 module in the build menu, but when I launch and open the kOS terminal I'm greeted with a semi-transparent window in which I'm not able to enter any commands. It's like the graphic is opening, but not the kOS program itself.

This is an incompatibility problem between kOS and 0.23. There is an alternative version that was posted in this thread a couple of pages back that was compiled by a user, but that introduces its own set of problems. The current solutions are to use KSP 0.22 or bare the problems the 0.23 alternative version has.

Link to comment
Share on other sites

I have made an update that fixes the terminal focus issue, and also the string comparison issue.

The string comparison issue was introduced when Kevin fixed a problem with the SET commands.

Unfortunately the fix was also applied to IF, UNTIL, and WHEN commands which broke them.

Here's a link to the dll file only:

https://anonfiles.com/file/2ba2c4681f8d00e158bf83c637e197c3

Enjoy :)

Link to comment
Share on other sites

I am assuming there must be other changes I don't know about since I stopped when I hit that first problem and wasn't able to see what else may be wrong without changing my code which I'm not willing to do because it requires a re-write. There are a lot of pull requests on github that are still the matter of debate, and I didn't want to use a version that might have them in it.

What is missing that would be required to make this a generic solution is the ability to iterate over all the variable names. You can't do a thing like:

For each variable that exists do a thing with that variable.

You instead have to hardcode the name of each and every variable you want to check, at which point there is no point in checking them - you just hardcode to zero out the ones you know will hold big values or strings. I don't consider this a viable solution either because of the pointless extra lines of code it requires. Because you have to name each variable you're going to zero out individually there is no generic terse solution.

You have misunderstood me. I am looking for an external savegame parser/script which will look for lines that have `e+` between the brackets after the word `variables` (a number expressed as a power) and delete them as this would delete any saved variables with a power which would stop the bug where your craft is not loaded properly. Dirty but easy, quick and effective. Currently I have to manually do this with my saves. I also do not wish to write `weird code` to stop the game from producing errors when it should not. (Ideally the code that writes to and reads from persistence would be altered to avoid this bug)

Then I could just run the parser over all my saves and know they would load without this bug while I wait for the bugfix.

I have made an update that fixes the terminal focus issue, and also the string comparison issue.

The string comparison issue was introduced when Kevin fixed a problem with the SET commands.

Unfortunately the fix was also applied to IF, UNTIL, and WHEN commands which broke them.

Here's a link to the dll file only:

https://anonfiles.com/file/2ba2c4681f8d00e158bf83c637e197c3

Enjoy :)

Awesome job! Now we just need someone to rewrite the steering code to adjust roll AFTER pitch and yaw...

Edited by John FX
Link to comment
Share on other sites

I have installed RemoteTech and kOS, and I wrote a script file called file1:

//start test script

print "Turn off signal".

toggle AG1.

wait 2.

lock THROTTLE to 1.

set x to 1.

until x > 5

{

print "Push! " + x.

set x to x + 1.

wait 1.

}

lock THROTTLE to 0.

print "Stop! ".

print "Turn on signal".

toggle AG2.

//end test script

and then : run file1.

The problem is: it seems running correctly and print the words, but the engine didn't work at all.

Does scripts of kOS can't work without Signal?

Link to comment
Share on other sites

I have installed RemoteTech and kOS, and I wrote a script file called file1:

//start test script

print "Turn off signal".

toggle AG1.

wait 2.

lock THROTTLE to 1.

set x to 1.

until x > 5

{

print "Push! " + x.

set x to x + 1.

wait 1.

}

lock THROTTLE to 0.

print "Stop! ".

print "Turn on signal".

toggle AG2.

//end test script

and then : run file1.

The problem is: it seems running correctly and print the words, but the engine didn't work at all.

Does scripts of kOS can't work without Signal?

It depends on Remotetech and exactly what your action groups are set up to do. I would guess if you can activate the local control/mechjeb control button then KOS can control the craft and not otherwise (although it should be able to control it no matter)

Link to comment
Share on other sites

I have installed RemoteTech and kOS, and I wrote a script file called file1:

//start test script

print "Turn off signal".

toggle AG1.

wait 2.

lock THROTTLE to 1.

set x to 1.

until x > 5

{

print "Push! " + x.

set x to x + 1.

wait 1.

}

lock THROTTLE to 0.

print "Stop! ".

print "Turn on signal".

toggle AG2.

//end test script

and then : run file1.

The problem is: it seems running correctly and print the words, but the engine didn't work at all.

Does scripts of kOS can't work without Signal?

I don't see anywhere in there where you hit the first stage. So it has the same effect as throttling up on the launchpad but never hitting spacebar to turn on the engines.

Link to comment
Share on other sites

I don't see anywhere in there where you hit the first stage. So it has the same effect as throttling up on the launchpad but never hitting spacebar to turn on the engines.

I didn`t think of that. I assumed either the code worked without remotetech or the action groups turned on the required engines.

I suggest only having KOS (move the remotetech.dll temporarily) and then running the code again. Then you will know if your problem is KOS or remotetech.

EDIT : Did your throttle go up and down or did it remain at zero?

Edited by John FX
Link to comment
Share on other sites

I am running 0.9.3. and I have a problem...

set b to body.

if b = "Kerbin" { print "1".}.

Syntax Error.

Why? Seems like any "..." on the line with if cause syntax error.

btw... is there another forums just for K-OS?

I don't think you need the speech marks around Kerbin. In kOS the speech marks generally represent what you want to display using the print command and is not used for anything else (although I could be wrong about that).

Edited by Kass
Link to comment
Share on other sites

I am running 0.9.3. and I have a problem...

set b to body.

if b = "Kerbin" { print "1".}.

Syntax Error.

Why? Seems like any "..." on the line with if cause syntax error.

btw... is there another forums just for K-OS?

You need the fixed version (0.9.4) I made a couple of days ago:

I have made an update that fixes the terminal focus issue, and also the string comparison issue.

The string comparison issue was introduced when Kevin fixed a problem with the SET commands.

Unfortunately the fix was also applied to IF, UNTIL, and WHEN commands which broke them.

Here's a link to the dll file only:

https://anonfiles.com/file/2ba2c4681f8d00e158bf83c637e197c3

Enjoy :)

Link to comment
Share on other sites

I am running 0.9.3. and I have a problem...

set b to body.

if b = "Kerbin" { print "1".}.

Syntax Error.

Why? Seems like any "..." on the line with if cause syntax error.

btw... is there another forums just for K-OS?

Try removing the line terminating dot . At the end of the if line. Ive found in the 0.22 version this wasnt needed and is presumably a bug.

Link to comment
Share on other sites

Logris: Do you have the source available for your changes? I would love to merge it into my changes.

Also after a vacation to the great white north im back and working on arrays again. Currently i have a list object that can be created and used like :


SET LISTTEST TO LIST().

SET LISTTEST:ADD TO APOAPSIS.
SET LISTTEST:ADD TO 0.
SET LISTTEST:ADD TO PERIAPSIS.

SET LISTLOOP TO LISTTEST:ITERATOR.
UNTIL LISTLOOP:END {
PRINT LISTLOOP:VALUE AT (0,LISTLOOP:INDEX).
}.

Will output on the launchpad:


74.123
0
-545.123

you can also REMOVE an index and CLEAR the list along with other stuff.

This might not be the most useful so im currently working on adding indexing grammar to the language which is much more involved. I imagine an index GET would look something like these


SET FOO TO BAR#1.
SET FOO TO BAR#OTHER.
SET FOO TO BAR#OTHER#3.

And so on.

Also dealing with the iterator directly is a little clunky so i am going to add a FOR command that would be more terse.


FOR ITEM IN LIST {
PRINT ITEM.
}.

But that one doesnt expose the index for that loop so i was also thinking of something like:


FOR ITEM AT I IN LIST {
PRINT ITEM AT (0,i).
}.

Thoughts?

Edited by erendrake
Link to comment
Share on other sites

Hello! Im new to kOS. have few quetions.

1. Some plans to add return values from subroutines?

2. How to declare global variables and access them?

3. How to get absolete difference of two rotations?

for example KOS lock steering stability is bad. SAS works better. But if I turn on SAS kOS cant control ship. I want to fly on SAS until difference between "prograde" and "facing" will not raise too high. When I make math "set diff to prograde - facing. set diff to diff-R(0,0,diff:roll)." I get some vector with 3 dimensions. How to get absolete value, to allow me use command like "until diff > 15 {SAS ON}. SAS OFF.}

Edited by Dave_Scream
Link to comment
Share on other sites

I have a problem with kOS. Even though I opened the terminal, and toggled the power on for the kOS control unit, which is on the ship, I can't focus on the terminal window, which means I can't type anything. I tried clicking, double-clicking, right clicking, middle mouse button clicking, on both unmanned and manned spacecrafts, but nothing is happening. What's going on?

Link to comment
Share on other sites

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