Jump to content

kOS Scriptable Autopilot System 0.9


KevinLaity

Recommended Posts

Can anyone explain the R(X,X,X) and V(X,X,X)? I'm not clear what the difference between V and R is or which direction each X refers to.

The first x is for the x-direction, the second is for the y-direction, and the third is for the z-direction. IF I'm not mistaken. It makes sense though.

ex: Pointing a craft to the sky and towards the east at an approximate 70 degree's would require "LOCK STEERING TO UP + R(0,0,180) + R(0,-30,0)"

again, that is if I'm not mistaken.

v(x,x,x) means Vector in a certain direction. Ex: v(0,90,0)

(I never use the v(x,x,x) so I don't know much about it.)

r(x,x,x) I guess means radians. I don't know though, it could just mean roll. Ex: r(0,0,180)

Link to comment
Share on other sites

ex: Pointing a craft to the sky and towards the east at an approximate 70 degree's would require "LOCK STEERING TO UP + R(0,0,180) + R(0,-30,0)"

Why not just

LOCK STEERING TO UP + R(0,-30,180).?

I'm seeing this a lot. Can someone please explain to me why we even have to have UP there in the first place? Why can't we just go ahead and do LOCK STEERING TO R(0,-30,180)?

Link to comment
Share on other sites

Why not just

LOCK STEERING TO UP + R(0,-30,180).?

I'm seeing this a lot. Can someone please explain to me why we even have to have UP there in the first place? Why can't we just go ahead and do LOCK STEERING TO R(0,-30,180)?

I... Don't even know... Meh, guess I got into the routine of adding all the separate rotations from his tutorials...

the word up in the language actually means directly away from the planet or object that has gravity. AKA, directly upwards from the center of the planet to and through the sky. It just makes it easier to modify your rotations. With out the UP you would have modify your steering every few seconds. If you just do LOCK STEERING TO R(0,0,90) while in orbit, then it will face it directly in that direction always. If you do LOCK STEERING TO UP + R(90,0,0) then You will face towards the north pole and will twist to face away from the planet at all times, it will rotate by itself... that type of thing... a better description is on the github page.

Link to comment
Share on other sites

Why not just

LOCK STEERING TO UP + R(0,-30,180).?

I'm seeing this a lot. Can someone please explain to me why we even have to have UP there in the first place? Why can't we just go ahead and do LOCK STEERING TO R(0,-30,180)?

Because you never know how the global(world) coordinate system is. So you need some reference axes, which the UP is providing.

Link to comment
Share on other sites

Because you never know how the global(world) coordinate system is. So you need some reference axes, which the UP is providing.

Am I right in saying, though, that UP is just another way of writing Radial(0,0,0)? And that 0 + X = X, every time, so it's more parsimonious to write just X.

Link to comment
Share on other sites

Would we be able to access other moveable parts with kOS?

Like programming Infernal Robotics parts to move?

If IR can work via action groups, then there is no reason it can't. If it can't then it adds a whole lot of complexity. Best ask sirkut about the ActionGroups.

Link to comment
Share on other sites

Thanks for verifying. I figured that's how it worked, so I've been doing mostly that. I saved my programs to v0, then copied them to v1 and made edits for the specific vehicle I'm using.

More than two volumes would be useful, though.

Guys you can force copy to the archive file!

copy program to Archive.

As a matter of fact. All of my scripts so far copy to the Archive automatically when they are run just by adding the line above first in the script. That way you can just edit it. Save it and then run it. If it doesn't work or you want to make changes you just need to revert flight and copy it over from the archive. copy program from Archive. It works great.

I really do want to be able to use an editor though. It would be so much faster and easier when I need to move blocks around or copy them.

Link to comment
Share on other sites

Am I right in saying, though, that UP is just another way of writing Radial(0,0,0)? And that 0 + X = X, every time, so it's more parsimonious to write just X.

I don't know. I have just been sticking with the up nomenclature for now. It certainly isn't initialized to R(0,0,0) though. I know that much. It's R(0,0,180) unless you flip the ship in the VAB to have the side that normally faces you in the VAB pointing North on the pad.

My current project is at the point were I need to use an external editor. I need to cut the fat and move direct figures out into variables so I can manipulate them. I have already removed 90% of the waits and wait until in favor of when then and until loops. Some small waits will be required for specific tasks but overall, I've gotten most of the CPU halts out. I have big plans for this baby and I can't have waits eating up my processing power. I suppose I could use a timer instead of the waits and cut even those out. But they are in time critical areas and none of them are in the main loop. The longest one is a half second I think anyway.

Link to comment
Share on other sites

I'll also need hardly external editing possibilitys.

PS: I need a negativ value of th variable, but "set pVal to pVal * -1." doesn't work. Any Ideas?

Edited by Jasmir
Link to comment
Share on other sites

Would we be able to access other moveable parts with kOS?

Like programming Infernal Robotics parts to move?

It will work as long as you assign it action groups as GavinZac said with one caveat. When you want it to move you must also toggle the action group for it to stop.

for example.

toggle AG1. WAIT 3.0. toggle AG1. - this will let you move an IR part for 3 seconds then stop it. hope this helps!

Link to comment
Share on other sites

I found a problem, when i open the terminal everything is blurry and i can barely see any letters. Can someone help me?

Your resolution is too low. Adjust it in the graphics menu of KSP or wait until someone figures out a way to circumvent it.

Link to comment
Share on other sites

It will work as long as you assign it action groups as GavinZac said with one caveat. When you want it to move you must also toggle the action group for it to stop.

for example.

toggle AG1. WAIT 3.0. toggle AG1. - this will let you move an IR part for 3 seconds then stop it. hope this helps!

Nice to know, but its not the best solution hm?

Because in this case, i can use only 5 parts maximum?!

10 AG = 5 Move+ and 5 Move-

And seconds as unit arent the best solution. Maybe i'm want too much, but degrees/steps like a stepper-motor are better ^^;

Sadly there are no visible unique IDs for parts..

Link to comment
Share on other sites

Nice to know, but its not the best solution hm?

Because in this case, i can use only 5 parts maximum?!

10 AG = 5 Move+ and 5 Move-

And seconds as unit arent the best solution. Maybe i'm want too much, but degrees/steps like a stepper-motor are better ^^;

Sadly there are no visible unique IDs for parts..

5 groups of as many parts you want per group. Slight distinction but it should be made for the benefit of the reading audience.

Link to comment
Share on other sites

I don't know. I have just been sticking with the up nomenclature for now. It certainly isn't initialized to R(0,0,0) though. I know that much. It's R(0,0,180) unless you flip the ship in the VAB to have the side that normally faces you in the VAB pointing North on the pad.

My current project is at the point were I need to use an external editor. I need to cut the fat and move direct figures out into variables so I can manipulate them. I have already removed 90% of the waits and wait until in favor of when then and until loops. Some small waits will be required for specific tasks but overall, I've gotten most of the CPU halts out. I have big plans for this baby and I can't have waits eating up my processing power. I suppose I could use a timer instead of the waits and cut even those out. But they are in time critical areas and none of them are in the main loop. The longest one is a half second I think anyway.

At the risk of being woefully wrong again, I'm going to jump in here.

I have been messing with the vectors quite a bit to try to get a handle on them, and I think it's more complicated than this in the background.

First, regarding UP. I believe this is a vector that runs from the center of the current gravity well to the active ship. This vector will change in direction based on where above the surface of the planet, the ship is. I believe that this is why we need to add the UP in to our steering commands.

Imagine that you're circumnavigating Kerbin. The UP vector is the vector that connects the center of the planet to your ship so as you circumnavigate, that UP vector is rotating around to match your ship location.

Now, imagine you want to set your ship to a +30 degree incline from the horizon. If you just set your steering to a static direction vector, you would slowly pull up out of the atmosphere as the surface of the planet pulled away from your static vector. Now, if instead, you used UP + some rotation, your angle is always relative to the UP vector, which changes direction based on your ship location. In this way, you can maintain a fixed angle relative to the surface.

This is all speculation on my part, so take it with a grain of salt.

Edited by Desrtfox
Link to comment
Share on other sites

Well, the programs are saved in a serialised text file, that's why editing the text file directly doesn't work. I am currently trying to put something together as an addon for this since the original project is GPL, but it would be a separate component not a replacer, so that there wouldn't be any question of it needing to 'keep up' with kOS development. It would be a no-frills, no warranty text area with a save button. I had initially wanted to merge something into the main program on github but to be honest, I can't understand his code or object structure and it isn't commented very much. It's a hell of a lot better than my 'make a scripter for KSP' halfway down my todo list though.

No promises though, I'm not new to C# but am new to Unity. So far I've managed to make an editable text box that reads in the first "FILE" from his ARC file. When it is possible to save, it will probably be better to code externally and just paste into the text box from Notepad++ or something. Eventually it may have an import/export button but as a web developer I hate parsing text files that are not XML. I want to keep this as simple as possible, as it's mostly a "necessity invention" of sorts as the 'official' editor makes my computer overheat and shut down.

Xhvkycw.jpg

Link to comment
Share on other sites

Eventually it may have an import/export button but as a web developer I hate parsing text files that are not XML.

Oh come on; for an import you just need to load the entire file to the textbox (textbox.Text = IO.File.ReadAllText(string path)) and to export everything is even simpler (File.WriteAllText(textbox.Text, filename)).

I don't see where any of these files are... Where are they?

Link to comment
Share on other sites

At the risk of being woefully wrong again, I'm going to jump in here.

I have been messing with the vectors quite a bit to try to get a handle on them, and I think it's more complicated than this in the background.

First, regarding UP. I believe this is a vector that runs from the center of the current gravity well to the active ship. This vector will change in direction based on where above the surface of the planet, the ship is. I believe that this is why we need to add the UP in to our steering commands.

Imagine that you're circumnavigating Kerbin. The UP vector is the vector that connects the center of the planet to your ship so as you circumnavigate, that UP vector is rotating around to match your ship location.

Now, imagine you want to set your ship to a +30 degree incline from the horizon. If you just set your steering to a static direction vector, you would slowly pull up out of the atmosphere as the surface of the planet pulled away from your static vector. Now, if instead, you used UP + some rotation, your angle is always relative to the UP vector, which changes direction based on your ship location. In this way, you can maintain a fixed angle relative to the surface.

This is all speculation on my part, so take it with a grain of salt.

This is correct. UP means "directly away from your current body of influence."

Link to comment
Share on other sites

Your resolution is too low. Adjust it in the graphics menu of KSP or wait until someone figures out a way to circumvent it.

I've tried replicating this problem and can't so far. The lowest resolution I can go down do is 1024x768, and the fonts appear fine. If anybody can offer help replicating this bug, it would be appreciated!

Link to comment
Share on other sites

Awesome. Ok, looking at that now. Everything has access to v0, and each part adds a numbered volume.

Are you planning to do more sizes of the kOS units, or a radially attached version that could work on any size vehicle?

Yes, I had envisioned different parts with different hard drive sizes, speed of CPU, tonnage, and cost. Even expansion parts that offer a volume and no CPU.

However I don't know yet if anybody needs or wants that.

Link to comment
Share on other sites

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