Jump to content

kOS Scriptable Autopilot System 0.9


KevinLaity

Recommended Posts

Probes also try to save on transmitter power requirements by using directional antennae,

Correct. My post is about directional antennas (dish antennas).

Although I didn't mention it, non-directional antennas such as the communotron 16 don't have much use in interplanetary comms. Exception would be for sats in low Kerbin orbit, and short range rover comms.

Link to comment
Share on other sites

That's pretty cool, closest I got my circular orbit was 113,320 x 100,503. Tried it again and AP was around 136,000 I think, for the same rocket. As long as it's with in that range though I'm pretty happy. :)

Quick question though, do you have yours setup to handle asparagus staging? I use it in mine though I got part of the code to check the fuel I think from someone else, though I can't remember who now.

Nope! Honestly I am probably a very lousy rocket designer when it comes to KSP. Until recently, I thought making things aerodynamic made a difference... it doesnt haha. Most of my designs have completely seperate stages (like the saturn v) so there was no need to code anything crazy.

I also just looked up what asparagus staging was, thats pretty awesome! And your code is really neat, if I ever need it I am just going to check with yours haha. Thanks!

Link to comment
Share on other sites

Kerbal Space Program\Plugins\PluginData\Archive is where mine is and it works fine, so long as I am in range of KSC or at an orbit of about 100,000m with an antenna.

No good. I place my .txt file in that very same sub folder and I get "file not found" when trying to run it. Do you have kOS installed into gamedata or the old fashion way? Correct me if I'm wrong, but as of .61 it needs to be in gamedata. This is just a launch to orbit program so range is no issue.

Edited by Motokid600
Link to comment
Share on other sites

No good. I place my .txt file in that very same sub folder and I get "file not found" when trying to run it. Do you have kOS installed into gamedata or the old fashion way? Correct me if I'm wrong, but as of .61 it needs to be in gamedata. This is just a launch to orbit program so range is no issue.

KOS 0.61 is in a sort of inbetween state between being installed in GameData and being installed the old way.

The DLL's and parts go in GameData, but the scripts YOU write still have to be outside of GameData in the global location mentioned above.

Link to comment
Share on other sites

I kind of feel that kOS might be taking too many decisions on its own here. In my mind, the goal is to be able to write your own autopiloting system. If you shove too much decision making behind the scenes to keep it accessible, I feel one might just use MechJeb instead.

I'd love to be able to write a program that checks and rechecks attitude, instead of just ordering a vector and kOS - succesfully or not - working it all out by itself.

Kevin, would you like to comment on this? I would be quite interested in your views on this, from a game mechanics point of view (how it should work) and a practical technical point of view (how you/we can make it work).

Cheers.

Link to comment
Share on other sites

Nope! Honestly I am probably a very lousy rocket designer when it comes to KSP. Until recently, I thought making things aerodynamic made a difference... it doesnt haha. Most of my designs have completely seperate stages (like the saturn v) so there was no need to code anything crazy.

I also just looked up what asparagus staging was, thats pretty awesome! And your code is really neat, if I ever need it I am just going to check with yours haha. Thanks!

Well, you did manage to get your AP/PE rather close together using your program, so that's good, plus eventually aerodynamics will make a difference (I understand FAR has some form of aerodynamics). Have you tried your program with other rockets? It may or may not get as close. So far with my program I've been able to use the same code for two different rockets (only changing the aspCount) it usually gets with in what I consider close enough lol. Though it depends on how wild it gets between launch and 10,000m. Had a few launches where the entire rocket flipped end over end, still managed to get to orbit though with a lot less fuel and AP/PE were not close at all.

As for my neat code, thanks, though like I said I did get part of it from someone else, but I try to keep my code as clean and easy to read as possible (I come from a PHP/HTML/CSS background, with some ASP then further back VB 3 or 4...i think was the last time I used it, Qbasic and C64/Atari 2600).

No good. I place my .txt file in that very same sub folder and I get "file not found" when trying to run it. Do you have kOS installed into gamedata or the old fashion way? Correct me if I'm wrong, but as of .61 it needs to be in gamedata. This is just a launch to orbit program so range is no issue.

Thats where my program files that I write are. I am using .61 in the gamedata folder. I generally just use switch to archive. then run my programs from there, but you should also be able to, I've used, copy orbit2.9 from archive.

Edited by Sma
Link to comment
Share on other sites

KOS 0.61 is in a sort of inbetween state between being installed in GameData and being installed the old way.

The DLL's and parts go in GameData, but the scripts YOU write still have to be outside of GameData in the global location mentioned above.

The scripts I write are in that global location. Plugins/plugindata/archive. "File not found" Wtf...

Thats where my program files that I write are. I am using .61 in the gamedata folder. I generally just use switch to archive. then run my programs from there, but you should also be able to, I've used, copy orbit2.9 from archive.

"File not found"

I've gotten frustrated to the point where my .txt program is in every sub folder the game has. Surprisingly enough that didn't work.

Edited by Motokid600
Link to comment
Share on other sites

I'm having trouble staging SRBs.

I've written this:

Wait until <solidfuel> = 60.

stage.

The solidfuel will burn down to 60, but the wait won't complete. <stage:solidfuel> always reads 0.

try without " <" and ">".

 wait until stage:solidfuel <  60.
print stage:solidfuel.

I haven't had luck with the "=" but that could just be me. :)

Edited by Secret Squirrel
Link to comment
Share on other sites

try without " <" and ">".

 wait until stage:solidfuel <  60.
print stage:solidfuel.

I haven't had luck with the "=" but that could just be me. :)

Yeah... as a general rule, you shouldn't use "=" or the language equivalent to compare floating point numbers unless also accompanied by a "round" function with the level of precision you want specified. 60.0001 != 60, and values will happily move from above to below your target without ever being precisely equal to it. "x == 0.0" is a bit of an exception, but even that can be dodgy depending on the circumstances...

Link to comment
Share on other sites

Is there a way to interrupt a program, either on a specific input(an action group, for example),or through a key sequence?

To quote the first post in the thread:

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.
Link to comment
Share on other sites

Something like this?

ON AG9 RUN ABORTPROG.

I haven't tried it, but that ought to run ABORTPROG if you hit 9 (which will also kill the current program -- kOS doesn't multitask afaik).

Is ON ABORT ... an option? I'll have to try that...

Link to comment
Share on other sites

try without " <" and ">".

 wait until stage:solidfuel <  60.
print stage:solidfuel.

I haven't had luck with the "=" but that could just be me. :)

I haven't had problems with using = I use

if stage:LiquidFuel = 0 {stage.}.

and it works just fine, though it is delayed a bit but I think that's just because fuel level doesn't reach 0 until after the loop has gone through a few times. It's usually delayed by 2 or 3 seconds, depending on how many other if statements I have. Seems to take longer than it should to run through a few if statements.

BTW, I would imagine if you were using

if stage:solidfuel < 60 {stage.}.

there is a chance that the booster may still have thrust and collide with the rest of the rocket, unless you're doing that because of the "command lag", in which case I guess it could work, unless one time you have less command lag and it fires before it's completely empty :wink:

Is there a way to interrupt a program on a certain action group? For example, halting the current program and running the abort program upon the the abort action group?

Like Gaius said, maybe something like

on abort { [i]code here[/i] } 

could work. If not now maybe in the future. I could see it being "fun" to tie in accelerometer sensors to detect when a rocket is going too far off course and have it automatically trigger the abort command.

Edited by Sma
Link to comment
Share on other sites

I agree I would use 1 instead of 60 but his example was 60 so that's what I put in there. I like to use < 1 so there is no chance of them colliding, but still JUST enough to maybe help kick it out of the way. Probly doesn't even matter but thats how I like to do it. Honestly I rarely even use solid boosters, I like liquid fuel asparagus staging. :)

Edited by Secret Squirrel
Link to comment
Share on other sites

Something like this?

ON AG9 RUN ABORTPROG.

I haven't tried it, but that ought to run ABORTPROG if you hit 9 (which will also kill the current program -- kOS doesn't multitask afaik).

Is ON ABORT ... an option? I'll have to try that...

It's more like calling a subroutine. If program 1 runs program 2, then when program 2 finishes, program 1 continues from the point right after it said "run program2".

You're right that it won't run the programs simultaneously, but that's not the same thing as saying it will kill the first program. It doesn't kill it. It just suspends it until the second one is done and then it resumes.

Link to comment
Share on other sites

I agree I would use 1 instead of 60 but his example was 60 so that's what I put in there. I like to use < 1 so there is no chance of them colliding, but still JUST enough to maybe help kick it out of the way. Probly doesn't even matter but thats how I like to do it. Honestly I rarely even use solid boosters, I like liquid fuel asparagus staging. :)

Ahh I see :) and true, < 1 would work best I imagine. Though one one of my test rockets using rockomax parts when the lower stage burns out and separates, it's still close enough for the upper stage (with the skipper engine) to damage the lower tank with a nice bit of fire. I'm tempted to use sepratrons to try and push it out of the way, but somehow that doesn't seem very Kerbal so I haven't really done it yet. :)

And yeah I haven't used solids lately, but I may just modify my rockets to add solids so I can add it into my program. May just create a variable (numSolids for example or useSolids as a boolean...errr 1 or 0) and setup an if statement to check if solids are being used if so check the solid fuel level. The generally burn out in what? the first 20km or so? Guess I'll have to check.

I do have the phrase "air lit solids" stuck in my head, from watching Delta II launches, back when those were still a thing (maybe they still are, but it seems Atlas has taken over for the most part). Think I'll build a Delta replica of sorts and try out solidfuel staging...and..well air lit solids :)

Edited by Sma
Link to comment
Share on other sites

To the creator of the mod:

Please ditch one of those documentaries:

(my suggestion is: https://github.com/Nivekk/KOS/blob/master/README.md)

And link the continued one in the discontinued one.

Like in the README.md: "look at kos.wikia.com for the manual" ...

And Please!!! Update and Complete it!!! F*****g pretty pretty PLEASE!!!

It (the mod) is really awesome, but I hate it to only be able to drew out like 1% cause I don't know the commands to do more.

And its a f* wiki ... so one step after another is fine, too.

It even hasn't has to have descriptions. The people can like figure that out themselves, and most of your names are pretty much self explaining.

Just add every command there that there is in the mod. The rest (adding examples, the usage and descriptions) can even do someone else.

Hell, if I have to, I will even do that (adding the describing rest) myself.

See, see what you have done! ... I am so desperate ... I am even would do something that looks like work ... And my doctor says I have a serious allergy (against work)

Edited by Bizz Keryear
Link to comment
Share on other sites

To the creator of the mod:

Please ditch one of those documentaries:

(my suggestion is: https://github.com/Nivekk/KOS/blob/master/README.md)

And link the continued one in the discontinued one.

Like in the README.md: "look at kos.wikia.com for the manual" ...

And Please!!! Update and Complete it!!! F*****g pretty pretty PLEASE!!!

It (the mod) is really awesome, but I hate it to only be able to drew out like 1% cause I don't know the commands to do more.

And its a f* wiki ... so one step after another is fine, too.

It even hasn't has to have descriptions. The people can like figure that out themselves, and most of your names are pretty much self explaining.

Just add every command there that there is in the mod. The rest (adding examples, the usage and descriptions) can even do someone else.

Hell, if I have to, I will even do that myself.

See, see what you have done! ... I am so desperate ... I am even would do something that looks like work ... And my doctor says I have a serious allergy (against work)

The mod author didn't write the wiki. It's user-made If it became the only source of documentation then we'd all be guessing all the time.

Link to comment
Share on other sites

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