Jump to content

kOS Scriptable Autopilot System 0.9


KevinLaity

Recommended Posts

I had several issues with this plugin.

1. I always lost my script once I return to space center and then re-launch the rocket. If I first copy the script to the other volume, I can get it back by copying it back, but that's too tedious.

2. I cannot get my script to work.

1) e.g. I've been trying to call "LOCK THROTTLE TO 1.0." and it just doesn't adjust my throttle at all.

2) I wrote some codes in an "UNTIL ALT:APOAPSIS >= 80000 {}." block. It constantly reports that there're issues in my scripts.

I've checked my scripts over and over and they just don't work. Can the documentation be more complete? And can you provide some sample scripts that utilize as many features of your plug-in as possible? That way we can follow the samples.

Link to comment
Share on other sites

This is great. Finally an autopilot which will not get any hate from hardcores - mainly because it's hardcore itself. Not to mention that it gives 100% more possibilities than Mechjeb. I can write my own ascent autopilots for historical crafts.

Please change endings to ; as opposed to .

It'd be a lot more comfortable for anyone who's been programming before, and doesn't learn new people bad habits. To new programmers, and old programmers it is very annoying to use the period. I am used to programming C so I automatically am typing the semicolon instead. Also people who are interested in this mod will probably be interested in programming. They should start getting used to ; before it becomes a bad habit that is hard to correct in the future.

+1

I'm quite used to C++ syntax and since it's a very common programming language (in my country it's the first programming language you ever learn bc it's teached on IT in high schools)

Edited by m4ti140
Link to comment
Share on other sites

@Desertfox nice name by the way! (Appreciation for foxes right here <3) Anyways, <IntakeAir> isn't supported because it isn't in kOs' terms and definitions yet, it has to be added by the author of the mod as a recognizable term first.

Link to comment
Share on other sites

@Honeyfox (Again with the appreciation for foxes <3) You can only set throttle to 1 or 0, you're using a term in programming called "double" not "integer" meaning: that you can't have the decimal and zero just yet, it has only been set to allow decimal, or integer numbers for now, so either use 1 or 0.

Link to comment
Share on other sites

Oh, and the people complaining about the resolution the screen and serious lag of character entry is caused by your resolution setting not being set to "full resolution" you are instead at half or quarter, or eighth. And if you don't have a good amount of RAM for your computer, expect serious lag because using this makes my KSP use of 2 of my 3 GB of RAM, so yeah...

Link to comment
Share on other sites

@Honeyfox (Again with the appreciation for foxes <3) You can only set throttle to 1 or 0, you're using a term in programming called "double" not "integer" meaning: that you can't have the decimal and zero just yet, it has only been set to allow decimal, or integer numbers for now, so either use 1 or 0.

Thanks for the head-up... though i used to consider decimal as a type that accept floating point numbers...

Link to comment
Share on other sites

GOTO is considered harmful.

Well, they are Kerbals...

Does the RUN command mean that we can call a stored program as a subroutine? And is there any information on how this mod plays along with RemoteTech?

You can only set throttle to 1 or 0... it has only been set to allow decimal, or integer numbers for now, so either use 1 or 0.

I must question your definition of "decimal". Also, in the "Tips & Tricks" video, he demonstrates the throttle being set to "1 - Alttude/15000" or something like that, so it can take a non-integer value.

Edited by razark
Link to comment
Share on other sites

This is the German Layout ;-)

A Guy in the German Forum found out that we need to Press SHIFT + Ü for the -> : <- and the -> ; <- ;-)

Now everything works fine!

BUT: The Mod is incompatible with one or more of these:

-RemoteTech

-Chatterer

-ISA MapSat

-DeadlyReentry

Havn't testetd yet wich one makes the Problems ;-)

If you have installed these mods you don't get a complete focus on to the console. If you hit the Spacebar to write you'll Stage... You need to go to DockingMode first, that the Staging does not work. And the Modifier Key to Lock Staging does not work anymore with theses Mods installed....

Link to comment
Share on other sites

@Desertfox nice name by the way! (Appreciation for foxes right here <3) Anyways, <IntakeAir> isn't supported because it isn't in kOs' terms and definitions yet, it has to be added by the author of the mod as a recognizable term first.

I also tried <ElectricCharge> to no avail. The readme says anything that appears on the resourced drop down. Is there a list somewhere of resources that are supported?

Link to comment
Share on other sites

Well, they are Kerbals...

Does the RUN command mean that we can call a stored program as a subroutine? And is there any information on how this mod plays along with RemoteTech?

I must question your definition of "decimal". Also, in the "Tips & Tricks" video, he demonstrates the throttle being set to "1 - Alttude/15000" or something like that, so it can take a non-integer value.

Yes, but you can't explicitly use the . (dot) in a line of code due to the . (dot) being considered the End Of Line character.

Personally, I'd rather see the ; used for this purpose which would then, potentially, allow for the typing of floats.

Link to comment
Share on other sites

Yes, but you can't explicitly use the . (dot) in a line of code due to the . (dot) being considered the End Of Line character.

So, you can use a value between 0 an 1, as long as you don't use ".". Ouch.

Personally, I'd rather see the ; used for this purpose which would then, potentially, allow for the typing of floats.

Even if it wasn't for the entrenched use of semicolon, the above makes it necessary.

Edit:

Watching video 3 now, and I'm seeing decimal points used:

set tVal to tVal - 0.02.

Hrm...

Edited by razark
Link to comment
Share on other sites

If you look in the PluginData\kOS folder, there's a file called arc.

This looks to me to be a mostly text file. It has some sort of binary header, but it has all of the programs typed out in that file as plain text. With a little luck and effort, you could probably edit that file directly. I haven't tried this, but I'd like to know if you get it to work.

Link to comment
Share on other sites

I just realized that this same issue may be why my resources read isn't working. My code looks like this:

wait until <IntakeAir> < 0.02.

Clearly this isn't going to work because of the . even if the <IntakeAir> flag works.

I'm going to try:

wait until <IntakeAir> < 1/50. and see if that works.

Thanks for letting me see this razark.

Link to comment
Share on other sites

With a little luck and effort, you could probably edit that file directly.

You're talking about programming here. It's not a question of "if". It's only a matter of time before someone builds a GUI program editor and compiler for it.

Link to comment
Share on other sites

Sorry to spam up your thread, but I clearly am not understanding the resources thing. Here's my entire code:

print "initializing".

print <LiquidFuel>.

wait 1.

stage.

lock throttle to 1.

lock steering to up.

wait 1.

stage.

until altitude > 10000 {

lock steering to R(0,60,180).}.

until altitude > 100000 {

lock steering to R(0,0,180).}.

I get the error "unrecognized term ''" on line 1. That is the line with the print <LiquidFuel>. This appears to me to be exactly what's in the readme page, but clearly I'm doing it wrong.

Link to comment
Share on other sites

Sorry to spam up your thread, but I clearly am not understanding the resources thing. Here's my entire code:

print "initializing".

print <LiquidFuel>.

wait 1.

stage.

lock throttle to 1.

lock steering to up.

wait 1.

stage.

until altitude > 10000 {

lock steering to R(0,60,180).}.

until altitude > 100000 {

lock steering to R(0,0,180).}.

I get the error "unrecognized term ''" on line 1. That is the line with the print <LiquidFuel>. This appears to me to be exactly what's in the readme page, but clearly I'm doing it wrong.

I think you need to put the value in a variable first before you let it get displayed.

Link to comment
Share on other sites

I found a strange bug. When I try to open the terminal, I'm greeted with this

49Ths.png

I do have a lot of mods installed, so I'll see if I can figure out what is causing the problem.

Edit: Nope, nothing to do with mods. I'm playing on a Mac if that helps. Also, I got in contact with you via reddit while this was being approved so this edit doesn't really meant much :/

To fix this go to Plugin/PluginData and rename kOS into kos. I'm running Linux and had the same problem.

Edit: The windows works now, though the start up animation doesn't show in the terminal.

It just goes strait to the prompt. It's possible to type, but typing something like "edit test" doesn't bring up the editor.

Edited by Albert VDS
Link to comment
Share on other sites

xuy3.jpg

What's new

Current Version: 0.3

- Addition of loops and the break statement

- Addition of the if statement

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.211 or later.

Where to get it

Download kOS 0.2 from Kerbal SpacePort

Go to the GitHub Page

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.

For a detailed description of KerboScript and an overview of the types of commands you can use, see the readme page on GitHub.

Introductory videos

License

This software is released under the GNU GPL version 3, 29 July 2007. View complete license on GitHub.

Can you please add a readme.txt file that lists the updated changes you made.

Link to comment
Share on other sites

Can you please add a readme.txt file that lists the updated changes you made.

You really want a readme.txt file for this short Update???

New in 0.3:

- Addition of loops and the break statement

- Addition of the if statement

Link to comment
Share on other sites

I played around a bit last night and successfully programed the computer to autonomously orbit a simple rocket and a space plane.

It does work quite well. That is the good bits. Now for the over arching critique.

1. Can't write programs seamlessly using float values. There are reasons that certain conventions are used. Refrain from doing things "Your Way". As much as you might think it's cool, using full stop for EOL EOS is a tragedy.

2. No access to conventional statements and loops is another big issue. Again, just because you want to make an "Until" loop and not a "while" loop does not make your system cool or eclectic. It makes it hard to use.

3. No conventional ASCI text based editing. Forcing me to write code in a little window inside of a game is not what I would consider conducive to learning nor does it exude time frugality. It is also causing problems with data retention.

4. There is no such thing as -90 in a vector based world. It doesn't exist. I would like you to show me where on the navball it says -90. Values from 0-359 are what we should be using.

5. PID is terrible. No doubt about it. The PID drifts something fierce. When I tell it to lock a vector I want it to stay there. Not drift wildly away after some seconds. It needs to be checking if it is actually at the point on the navball you have set it too. Not just going there and locking the controls up.

Those are huge things. They have to be fixed for this to be usable by anyone without hardcore programming experience.

Finally, I have to ask for what reason have you considered writing your own scripting language in the first place? There are many examples of these like LUA that expose most of the useful environment and solves most, if not all, of these problems.

I understand doing things for your own educational betterment. I just don't want to be subjected to it. If you expect others to use it, it has to follow convention. As it is, I could write code in C faster that I can use this scripting language.

Link to comment
Share on other sites

Any chence to see some tutorials or the tips&tricks on a written page?

Imho it's becoming a growingly bad habit to put programming examples on Youtube.. thats like brushing your teeth with a single hair.. Its completely inefficient.

Aside from that: Sounds like a sweet mod.

Link to comment
Share on other sites

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