Jump to content

kOS Scriptable Autopilot System 0.9


KevinLaity

Recommended Posts

I assume this was meant to originally be formatted like so, but you had to join the lines to avoid the other bug?

Which it didn't avoid, since it still had a multi line brackets, so I'm assuming it was just a preferred way of formatting them, like what you did in your example with splitting one "when" into multiple lines but not the other.


when eta:apoapsis < (DV/(2*acc) + 30) then {
set warp to 1.
when eta:apoapsis < (DV/(2*acc) + 15) then {
set warp to 0.
}
}

:wink:

Is there a reason it doesn't work to have those as two separate conditions at the same level without nesting?


when eta:apoapsis < (DV/(2*acc) + 30) then { set warp to 1. }
when eta:apoapsis < (DV/(2*acc) + 15) then { set warp to 0. }

It should work provided that you know the first condition will always happen prior to the second condition.

It should, and that's the way I'd have done it, but it does work when nested as well, just need to have the whole nest on one line. Un-nested that does set up two when triggers, whereas nesting them has only one at a time, but I've no idea if it makes any difference (let alone a noticeable one) on performance. :huh: (probably not :P )

Link to comment
Share on other sites

I've found one thing that looks like a 0.22-specific bug: ALT:RADAR no longer works; it always gives the same value as ALTITUDE. I've tested the same scripts on 0.21 and 0.22 with both kOS 0.84 and kOS 0.85; kOS version does not matter; ALT:RADAR consistently works on pre-0.22, but does not work on 0.22.

Link to comment
Share on other sites

I have a problem with the latest version.

I don't achieve any results when running a simple script:

lock throttle to 1.

stage.

Staging works but throttle command doesn't. However if I run the same command directly (without editing and then loading a script but instead typing it into the console) it works just fine.

Any hints on the problem?

Edit: I forgot to write that I've ran the script multiple times without success and that I have the latest version of the mod. I even downloaded it from another source just to be sure that it wasn't a corrupted download.

Edited by gxs
Link to comment
Share on other sites

I've found one thing that looks like a 0.22-specific bug: ALT:RADAR no longer works; it always gives the same value as ALTITUDE. I've tested the same scripts on 0.21 and 0.22 with both kOS 0.84 and kOS 0.85; kOS version does not matter; ALT:RADAR consistently works on pre-0.22, but does not work on 0.22.

I have a script running in 0.85 on KSP 0.22 that most definitely gives a different result for alt:radar than for altitude. Can you show us the code?

Link to comment
Share on other sites

I've found one thing that looks like a 0.22-specific bug: ALT:RADAR no longer works; it always gives the same value as ALTITUDE. I've tested the same scripts on 0.21 and 0.22 with both kOS 0.84 and kOS 0.85; kOS version does not matter; ALT:RADAR consistently works on pre-0.22, but does not work on 0.22.

I actually did alot of testing with this. I was trying to add a "long range" radar function to kOS, using the same function that mapsat does to pull elevation data. The alt:radar function pulls data from the in-game radar altimeter function, which does work perfectly up until a certain height, maybe 15-18k for kerbin, after that altitude, the alt:radar function (the function kOS uses to get data from the game) returns the same altitude as the altitude function. I found this out, figuring I would get elevation data by altitude-alt:radar, only to find the values are identical after i got up so high.

From what i've been able to tell in the code, isa's mapsat, or atleast the older version of it, pulls elevation data via a seperate function, that takes lat/long as an input and returns the actual elevation, at least it does it like this for it's hi/lo elevation calculation.

I don't think it would be very difficult to either modify alt:radar to use this function, and always report radar altitude, or create a separate function.

That was actually an idea I had, kOS let's you extend functions with other parts/plugins, why not a *high altitude* radar altimeter part?

Link to comment
Share on other sites

From what i've been able to tell in the code, isa's mapsat, or atleast the older version of it, pulls elevation data via a seperate function, that takes lat/long as an input and returns the actual elevation, at least it does it like this for it's hi/lo elevation calculation.

I don't think it would be very difficult to either modify alt:radar to use this function, and always report radar altitude, or create a separate function.

That was actually an idea I had, kOS let's you extend functions with other parts/plugins, why not a *high altitude* radar altimeter part?

Actually, I'd find the ability to query the terrain height somewhere other than where you currently are, via a LATLONG, to be extremely handy for other reasons. It would let you work out slope of terrain by comparing several sample datapoints around you. It would let you work out the altitude of your projected landing site (rather than just underneath where you are now when you're not there yet).

Link to comment
Share on other sites

I have a problem with the latest version.

I don't achieve any results when running a simple script:

lock throttle to 1.

stage.

Staging works but throttle command doesn't. However if I run the same command directly (without editing and then loading a script but instead typing it into the console) it works just fine.

I have exactly the same problem. Very interesting because I started play first time with the KOS v0.85, and this script worked fine. Today I got a same "error", but when i run one of my older (yesterday) file it works properly.

Any idea?

Link to comment
Share on other sites

So I have a couple questions regarding targeting. I understand the need for antennas to extend your targeting range. Right now it seems all I can see are vessels. Are there plans to make planets show up in the target list? And for vessels, is there a plan to allow specific docking ports to be in the list?

Link to comment
Share on other sites

So I have a couple questions regarding targeting. I understand the need for antennas to extend your targeting range. Right now it seems all I can see are vessels. Are there plans to make planets show up in the target list? And for vessels, is there a plan to allow specific docking ports to be in the list?

1. Antennae have no effect on targeting vessels. They only affect your range to home base for the sake of getting to your archive files.

2. At the moment the ability to target planets isn't implemented.

3. I don't know about targeting docking ports. It would be a good idea, but I think it's a ways off because we still don't even have access to the ability to control translation via RCS, which is sort of a prerequisite for docking maneuvers.

Link to comment
Share on other sites

I have a problem with the latest version.

I don't achieve any results when running a simple script:

lock throttle to 1.

stage.

Staging works but throttle command doesn't. However if I run the same command directly (without editing and then loading a script but instead typing it into the console) it works just fine.

Any hints on the problem?

Is that the entire end of the program? (As in, the program finishes after executing "stage." and you're back at the interactive prompt).

If so, then that might be the problem. When a program exits and you're kicked back to the prompt, I've seen it sometimes return the throttle back to the state it was in before the program started (i.e. off.).

To test if this is the problem, add a simple "wait 1." at the end. If this was the problem, then you'll see the engine throttle up for 1 second then shut off again. (because the throttle lock was only staying on during the duration of the program, and without the wait there it was ending the program before the throttle had a chance to react.)

Link to comment
Share on other sites

To test if this is the problem, add a simple "wait 1." at the end. If this was the problem, then you'll see the engine throttle up for 1 second then shut off again. (because the throttle lock was only staying on during the duration of the program, and without the wait there it was ending the program before the throttle had a chance to react.)
That was indeed the problem. I have set it to wait for 30 seconds and it did a 30 second burn and then stopped. I guess I'll have to compile the program all the way to the end and not test it by stages like I wanted to.

Thanks for the help.

Link to comment
Share on other sites

That was indeed the problem. I have set it to wait for 30 seconds and it did a 30 second burn and then stopped. I guess I'll have to compile the program all the way to the end and not test it by stages like I wanted to.

Thanks for the help.

If you have a spare action group you're not using on the craft you can use that as the end trigger condition instead.

The syntax looks like this: assume you are using action group "7" in this example:

WAIT UNTIL AG7.

That line will make the program pause until you hit ALT-7.

(One odd thing about using action groups this way, is that you can't hit the key while the terminal window is focused. You have to click outside the terminal window first (making it turn a "faint" color) before hitting ALT-7 or else it won't pass through to the stock KSP keyboard handler.)

Link to comment
Share on other sites

Actually, I'd find the ability to query the terrain height somewhere other than where you currently are, via a LATLONG, to be extremely handy for other reasons. It would let you work out slope of terrain by comparing several sample datapoints around you. It would let you work out the altitude of your projected landing site (rather than just underneath where you are now when you're not there yet).

I'm going to give it a shot and try to create an extension to access that LATLONG function. Modeling isn't my thing, but I'll try to get something going.

Link to comment
Share on other sites

Actually, I'd find the ability to query the terrain height somewhere other than where you currently are, via a LATLONG, to be extremely handy for other reasons. It would let you work out slope of terrain by comparing several sample datapoints around you. It would let you work out the altitude of your projected landing site (rather than just underneath where you are now when you're not there yet).

Somehow I feel this should not be possible without first scanning the terrain via MapSat or something similar. There is no magic way to query terrain height.

Link to comment
Share on other sites

I have a problem with the latest version.

I don't achieve any results when running a simple script:

lock throttle to 1.

stage.[...]

That was indeed the problem. I have set it to wait for 30 seconds and it did a 30 second burn and then stopped. I guess I'll have to compile the program all the way to the end and not test it by stages like I wanted to.

Thanks for the help.

I think I might add a FAQ to the wiki, since this and some other mistakes are very common. I am a little short on time lately, though.

I have exactly the same problem. Very interesting because I started play first time with the KOS v0.85, and this script worked fine. Today I got a same "error", but when i run one of my older (yesterday) file it works properly.

Any idea?

You might have done the same mistake (very likely), but without code its hard to tell.

1. Antennae have no effect on targeting vessels. They only affect your range to home base for the sake of getting to your archive files.

[...]

3. I don't know about targeting docking ports. It would be a good idea, but I think it's a ways off because we still don't even have access to the ability to control translation via RCS, which is sort of a prerequisite for docking maneuvers.

1. Not entirely true the antennas where intended to have an impact on the targeting range.

(described in one of his videos)

However it might be dropped or bugged right now.

3. Kevin is still struggling with identifying //acessing parts. Which is a requirement for any actions like those.

Never mind, found out how at http://kos.wikia.com/wiki/Issues

Finally someone has read it

Link to comment
Share on other sites

Somehow I feel this should not be possible without first scanning the terrain via MapSat or something similar. There is no magic way to query terrain height.

But at the moment you can't even query the terrain under you except at that single datapoint of RIGHT under you. You can't see what the height is even just a few meters to the north, south, east, or west of directly below you.

Presumably if you have a radar altimeter it should be possible to use it to get data about a small arc under you rather than just a straight line under you.

Mapsat covers a swath of terrain when it passes over it, not just a single line of terrain.

So what you said applies to one half of the uses I was talking about (seeing height of a projected landing spot far away), but not for the other half (ability to read the slope of the ground under you by being able to see the ground through more than just a single data point).

Even without mapsat you should at least be able to see the ground heights within a small arc under you.

Link to comment
Share on other sites

I just downloaded this mod, and can't do anything with it:

I have a simple probe with kos computer on it, i have power and can see the terminal, but... Nothing happen when i type commands.

"clearscreen", "edit", "print" doesn't do anything on my terminal.

I must do something wrong, but can't understand what.

KSP 0.22, mods are KOS, CrewManifes, KAS, Magic Smoke, Mechjeb 2, kethane, chatterer, neverunload, and novapunch.

No parts except stock, Novapunch and kOS.

Link to comment
Share on other sites

ETA:NODE is not working for me.

The line of code is:

 Wait until ETA:NODE <61 

Am I doing something wrong?

Have you forgotten your terminator ? (the " . ")

If not, try Eta:Nextnode which should give you the ETA for your next maneuver node.

If that doesn't help I got no other solutions for you. Sadly many of the kOS variables are broken in a way, that you can't calculate with them without using inefficient workarounds. The best example may be eta:apoapsis which you can't really use to trigger actions ( "If eta:apoapsis >=< ... {...}").

Link to comment
Share on other sites

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