Jump to content

kOS Scriptable Autopilot System 0.9


KevinLaity

Recommended Posts

What would be super-awesome would be a list, possibly in the OP, of mods that support or add-on to kOS.

Aside from that, great work, keep it up! :)

Not a bad idea, maybe we should add them to the wiki. So far I only know of one thats written to be compatible with kOS http://kerbalspaceprogram.com/sensor-reporter-kos/ Oh, I see that has already been done, though maybe it should be renamed "kOS compatible mods" or something that makes it obvious that it's a mod with the ability to have kOS calls (similar to sensor reporter).

Ok, I'll give that a try. i'm guess that fix was the pull request that initializes the HardDisk before calling initCPU().

I really love this mod, but I hate the syntax sooooooooo much.

Edited by Sma
Link to comment
Share on other sites

Not a bad idea, maybe we should add them to the wiki. So far I only know of one thats written to be compatible with kOS http://kerbalspaceprogram.com/sensor-reporter-kos/ Oh, I see that has already been done, though maybe it should be renamed "kOS compatible mods" or something that makes it obvious that it's a mod with the ability to have kOS calls (similar to sensor reporter).

I think there's a categorical difference between a mod that exists for reasons other than KOS that happens to have some KOS hooks in it, versus a mod that exists entirely for the purpose of doing nothing but containing KOS hooks (like the sensor reporter mod).

Basically, the type that only exists to provide KOS hooks could in theory be merged in with KOS itself, if the authors are amenable to the idea. That's the key difference between them.

Link to comment
Share on other sites

I think there's a categorical difference between a mod that exists for reasons other than KOS that happens to have some KOS hooks in it, versus a mod that exists entirely for the purpose of doing nothing but containing KOS hooks (like the sensor reporter mod).

Basically, the type that only exists to provide KOS hooks could in theory be merged in with KOS itself, if the authors are amenable to the idea. That's the key difference between them.

Ahh yes, good point didn't think about that. :)

Link to comment
Share on other sites

I just noticed two things..

1) No logarithmic functions

2) Can't return anything from the RUN command.

The first is annoying because a few physics equations use them, but the second...

I die a little on the inside when I can't clean up my code... it's too long... need functions...

CODE SHOULD NOT LOOK LIKE THIS!

*tears*

Link to comment
Share on other sites

Guys!

Wait until you try 0.8 ... lots of cool new features, but UNTIL is broken! *tears*

Edit: Who else thinks that the next update should not contain any new feature, but making all given so far working ... And as intended!

Edited by Bizz Keryear
Link to comment
Share on other sites

I just noticed two things..

1) No logarithmic functions

2) Can't return anything from the RUN command.

The first is annoying because a few physics equations use them, but the second...

I die a little on the inside when I can't clean up my code... it's too long... need functions...

CODE SHOULD NOT LOOK LIKE THIS!

*tears*

I think the requirement to use global variables does make things a bit messy but it also is in keeping with the idea of ancient klunky programming practices. My only annoyance with that is that I can't make a library of re-usable routines to share if I have to constantly worry that I might be using a variable someone else used in their code that calls my code. For now I'm using namespaces to get around this, i..e "all the variables in this routine will begin with a prefix of 'tf'".

Link to comment
Share on other sites

Guys!

Wait until you try 0.8 ... lots of cool new features, but UNTIL is broken! *tears*

Define how its broken. I suspect if it's broken that badly it will likely get a quick patch fix. Hardly anyone can do anything if looping is impossible.

Link to comment
Share on other sites

Define how its broken. I suspect if it's broken that badly it will likely get a quick patch fix. Hardly anyone can do anything if looping is impossible.

Like you said. Totally broken. But he isn't here this weekend said the video.

any until something { }. I tried ended in a lineXX: mismatching delimiter. error

edit where variables in subprograms always been global?

Edited by Bizz Keryear
Link to comment
Share on other sites

Yeah the UNTIL syntax is broken and also IF.

It's actually not the UNTIL or the IF that's wrong. It's the curly brace block parsing that's wrong. ANY curly-braced section that spans more than one line isn't working.

So both of the following parse correctly:


if x < 2 { print "x is less than 2". }.


until x < 2 { print "x is sill not less than 2". }.

But both of the following fail:


if x < 2 {
print "x is less than 2".
}.


until x < 2 {
print "x is sill not less than 2".
}.

Link to comment
Share on other sites

Further testing shows: It works in INTERACTIVE mode but not in a file.

i.e. type at the console:


if 1 < 2 {
print "works".
}.

and it works.

Put the *exact* same thing in a file and run the file, and it doesn't.

Also, if you put a space between the ending curly brace "}" and the period, then it doesn't work even in interactive mode either.

Link to comment
Share on other sites

Yeah the UNTIL syntax is broken and also IF.

It's actually not the UNTIL or the IF that's wrong. It's the curly brace block parsing that's wrong. ANY curly-braced section that spans more than one line isn't working.

So both of the following parse correctly:


if x < 2 { print "x is less than 2". }.


until x < 2 { print "x is sill not less than 2". }.

But both of the following fail:


if x < 2 {
print "x is less than 2".
}.


until x < 2 {
print "x is sill not less than 2".
}.

ah thats it... at first I thought it where the multiple compare I had there... umm that means there is a workaround ... just don't use newlines.

Link to comment
Share on other sites

ah thats it... at first I thought it where the multiple compare I had there... umm that means there is a workaround ... just don't use newlines.

I suppose that since I edit my code outside KSP and run it through a comment stripper I could add the newline stripper to it just to get it to work...

But I don't know if the persistence save file will tolerate that. (Code stored on a vessel's drive instead of the archive becomes lines of text in the persistence file. I don't know how well it will like having one VERY long line in the file.

Link to comment
Share on other sites

I suppose that since I edit my code outside KSP and run it through a comment stripper I could add the newline stripper to it just to get it to work...

But I don't know if the persistence save file will tolerate that. (Code stored on a vessel's drive instead of the archive becomes lines of text in the persistence file. I don't know how well it will like having one VERY long line in the file.

As far as I know KSP usually don't use multiple lines in their serialized variables... so I thought having multiple lines in there might be troublesome. Never looked ... wait a moment


harddisk
{
capacity = 10000
volumeName =
file
{
filename = stage8
line = clearscreen.
line = set totalfuel to <liquidfuel>.
line = print "total fuel: " + totalfuel.
line = stage.
line = wait 1.
line = set booster to stage:liquidfuel.
line = print "booster fuel: " + booster.
line = wait 1.
line = set stagefuel to totalfuel - booster.
line = print "stage when fuel: " + stagefuel.
line = wait 1.
line = lock throttle to 1.
line = lock steering to up + R(0,0,180).
line = stage.
line = when altitude > 200 then { lock steering to heading 90 by 90. }.
line = set lq to <liquidfuel>.
line = when lq <= stagefuel then { stage. }
line = until lq <= stagefuel OR altitude > 10000 { set lq to <liquidfuel>. print <liquidfuel> at (0,5). print stage:liquidfuel at (0,5).}.
line = until altitude > 10000 { print <liquidfuel> at (0,5). }.
line = lock steering to heading 90 by 45.
line = set l to 0.
line = until l = 1 { set lq to <liquidfuel>. print <liquidfuel> at (0,5). if lq = 2880 {set l to 1.}. if stage:liquidfuel = 0 {stage.}. }.
}
}

is what it actually look like in a ksp save ... very crude program I know, I only set it up for a staging test ... and it was short so it was first choice for the 0.8 fix test.

ah crap. all whitespace are actually masked as & #32; but I cant get this board to write that....

Edited by Bizz Keryear
Link to comment
Share on other sites

Does anyone know how to get the value of your current inclination?

I've been intending to write a plane-changing script and was hoping to use the new node system to do that.

Link to comment
Share on other sites

Does anyone know how to get the value of your current inclination?

I've been intending to write a plane-changing script and was hoping to use the new node system to do that.

Inclination from SOI body, or inclination from target vessel? If it's from the SOI body I suspect it's possible to work it out based on your current latitude and your orbital velocity vector. If you want it based on the target vessel I think that might not be possible with the currently available data.

Edited by Steven Mading
Link to comment
Share on other sites

Another thing I just noticed:


switch to 1. // doesn't work
copy flight-params from archive. // doesn't work. kOS doesn't like the dash?
copy prelaunch from archive. // works, because there's no dash?

I'm going to have to switch back to kOS 0.7 until this is fixed.

Link to comment
Share on other sites

Inclination from SOI body, or inclination from target vessel? If it's from the SOI body I suspect it's possible to work it out based on your current latitude and your orbital velocity vector. If you want it based on the target vessel I think that might not be possible with the currently available data.

SOI body. I had assumed I'd have to use the latitude for determining whether I was ascending or descending, and also isolating where the burn will need to occur. I guess I was just hopeful that there was an undocumented inclination function!

Relative target inclination would be the next step.

Link to comment
Share on other sites

I have no idea what's wrong. This mod is a cool idea, although the english-ness of the thing puts me off.

This is going to be another applescript.

But anyway: I'm trying to run this program:


SET X to 1.
UNTIL X > 10 {
PRINT X.
SET X to X + 1.
}. // Prints the numbers 1-10.

from the wiki.

HOWEVER, it insists:

line1: mismatching delimiter.

I have no idea.

Link to comment
Share on other sites

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