Jump to content

[1.3] kOS Scriptable Autopilot System v1.1.3.0


erendrake

Recommended Posts

I saw that in the source code ... should mention it in the docs?

While you're in the RUN command, could you document parameters to subprograms if those are still implemented - I saw you mention them while I was playing catch-up in this thread, but haven't yet tried to use them in the current version (my scripts could definitely do with some refactoring by such a feature though).

Link to comment
Share on other sites

These are some of the links I used while developing this: Intro, Advanced, Way too advanced (and math heavy)

Anyway most of real life complexities arise from errors in the measurements and in a bunch of others things that have to be compensated, and that we don't have to worry about :D.

Very cool. The more I dig into control logic, the more I realize I dig it. It turns out it is moderately useful for professional purposes too.

Link to comment
Share on other sites

Hey folks,

got some problems with steering. When I lock steering to retrograde the ship begins turning and gets into a uncontrollable spin. Am I missing something?

cheers

Others have had this happen too. I've got a ship design that when I use LOCK STEERING it see-saws madly on the roll-axis (the axis you rotate around when using the "Q" and "E" keys), to the point where it's swinging back and forth on an arc of about 270 degrees. As I understand it, and I haven't looked at it so this is word-of-mouth from erendrake, it's happening because the steering controller logic isn't using a good dampening algorithm. (i.e. nothing like a PID controller), and is instead completely reliant on the fast speed of execution to allow it to steer entirely by looking at the current position and ignoring the current rotational velocity. That can set up oscillations in craft that have a lag between control input and ship reaction. If there's a lot of parts that can twist when rotated, and the ship has a lot of powerful torque, the oscillations can get bad. My only advice for now is build ships as ridigly as possible. Making the steering algorithm better is on the list of future things to do, but there were bigger bugs to hit first.

Link to comment
Share on other sites

When using the realfuels mod, how do you use one of the fuel values as an input? (for example: "wait until fuel < 10.")

The mod *tries* to use the actual resource name from the game's database, rather than hardcoding it. (So for example, if you say "print ship:solidfuel.", the word "solidfuel" isn't hardcoded inside kOS. It's just saying "I don't have any special meaning set aside for the term 'solidfuel', so fallback on asking Kerbal Space Program if there's a resource by that name on the ship. Oh look there is. Okay I'll return that then.")

So if RealFuels works by adding the resource to the actual KSP data itself, then in principle kOS should be able to read it when you say "ship:SOMENAME" where "SOMENAME" is whatever the resource is called. Click on the resources popup in the upper-right corner of the screen in KSP and see if the fuel from RealFuels shows up there along with electriccharge, monoprop, and so on. If it does, then use the name as it appears on that popup window as the word you use in your kOS code.

Link to comment
Share on other sites

What does "out of sync" mean?

I was returning to KSC using my hover program and suddenly, about 200m from the VAB, I got the message "out of sync" and my craft crashed.

I'm getting this while I'm trying to launch the stock spaceplane Aeris 3A plus a kOS module. This is the script below is what I'm running. I get about 3km from KSC and then the program outputs "out of sync" and stops. I have no idea what's happening!

SET c TO 0.

SET vThrottle TO 1.0.

LOCK THROTTLE TO vThrottle.

LOCK STEERING TO HEADING(90, 10).

UNTIL c > 1000

{

WAIT 1.

SET c TO c + 1.

PRINT c.

}

Link to comment
Share on other sites

Is this the right place to seek advice?

Because, I can't steer my craft.


set t to 1.
lock throttle to t.
sas on.
stage.

when altitude > 1000 then {
print "pre".
lock steering to up + r(30,60,90).
print "post".
}.
[throttling shenanigans]

I tried "lock steering to up +r(3,4,5)" as well as +v(0,8,15) and heading (47,11). Neither of wich leads to any change in direction. However, it appears to silently deactivate SAS although the indicater remains on: an unbalanced rocket will start tipping over once the program went past the LOCK STEERING command. Besides, the controls aren't locked, the vessel will react to keyboard input even after I got "pre"/"post" on the screen.

What am I doing wrong?

Link to comment
Share on other sites

Because, I can't steer my craft.


...
sas on.
...

What am I doing wrong?

SAS should be *off*, not on - LOCK STEERING is doing the steering, so you don't want sas holding a heading.

Edited by Waz
Link to comment
Share on other sites

Ouch. Thank you.

Is there a good write-up regarding the steering gotchas? Like swaying wide before settling on new course?

Also, is it normal that "revert to launch" will render steering inoperable? Throttle & stuff still works then, but if I want steering to work, I need to come fresh from the VAB.

Link to comment
Share on other sites

Ouch. Thank you.

Is there a good write-up regarding the steering gotchas? Like swaying wide before settling on new course?

Also, is it normal that "revert to launch" will render steering inoperable? Throttle & stuff still works then, but if I want steering to work, I need to come fresh from the VAB.

which version are you using? I have not seen any revert to launch issues with the new version.

Link to comment
Share on other sites

I'm getting this while I'm trying to launch the stock spaceplane Aeris 3A plus a kOS module. This is the script below is what I'm running. I get about 3km from KSC and then the program outputs "out of sync" and stops. I have no idea what's happening!

SET c TO 0.

SET vThrottle TO 1.0.

LOCK THROTTLE TO vThrottle.

LOCK STEERING TO HEADING(90, 10).

UNTIL c > 1000

{

WAIT 1.

SET c TO c + 1.

PRINT c.

}

I tried to recreate this problem and I couldn't get it to happen. After the plane got to an altitude of about 10000 I figured it wasn't going to happen and I quit. You're not the only one to report 'out of sync', and I've seen it too once in a while but I just can't get it to happen when I'm looking for it.

Link to comment
Share on other sites

"out of sync" is the Mono error for when a collection is modified while being iterated, so it's probably some kind of race condition.

We would need the log files to track this problem down, so the next time it happens to someone, please, send them over :)

Link to comment
Share on other sites

Just a heads-up: I'm implementing a boot system. Basic idea is that in VAB you can select the boot file via a tweakable (any Archive file starting with "boot") and it will be copied to Volume 1 upon ship creation with the name "boot". At processor startup, if a file named "boot" exists, it will be executed.

I'll ship two super-trivial boot files, a "standard" one that just prints the standard startup message, and an "auto launch" one that merely turns on SAS and STAGEs - that should get users going with the idea of boot files.

The principle is to allow the player to develop a collection of "standard" file packages, launchers, etc., and select which of those to boot for each ship. Typically they'd in PRELAUNCH copy some files from the Archive and run one while in other boot states do nothing.

Work is mostly done, I'll send a patch soon, but also happy to here any input.

Link to comment
Share on other sites

Just a heads-up: I'm implementing a boot system. Basic idea is that in VAB you can select the boot file via a tweakable (any Archive file starting with "boot") and it will be copied to Volume 1 upon ship creation with the name "boot". At processor startup, if a file named "boot" exists, it will be executed.

I'll ship two super-trivial boot files, a "standard" one that just prints the standard startup message, and an "auto launch" one that merely turns on SAS and STAGEs - that should get users going with the idea of boot files.

The principle is to allow the player to develop a collection of "standard" file packages, launchers, etc., and select which of those to boot for each ship. Typically they'd in PRELAUNCH copy some files from the Archive and run one while in other boot states do nothing.

Work is mostly done, I'll send a patch soon, but also happy to here any input.

One word of warning: Make sure the location of the archive folder is an easy config option to change in your code. It may be changing soon.

Also, read this github entry: https://github.com/KSP-KOS/KOS/issues/110 if you plan to work on this area, to make sure you know what devs have been saying about it.

Link to comment
Share on other sites

One word of warning: Make sure the location of the archive folder is an easy config option to change in your code. It may be changing soon.

It uses the existing VolumeMgr's interface, so it shouldn't be a problem. As much as possible I want it to "fit" into the realistic processor model that kOS presents.

I realize now this should probably have been in the "Add-on Development" thread. Oops.

Link to comment
Share on other sites

The current RemoteTech/kOS integration is very beta right now. you can turn it on in the kOS config file and try it out. It should allow you to issue a command and the script will continue to run and function while you are out of range.

known issues include only having access to steering and throttle. No action groups or sas rcs toggles.

I'm guessing RT integration is not something that's toggelable on-the-fly and it needs to be set before KSP loads?

I ask because with it off, kOS can run action groups without a connection, and you're saying that with it on it has access to throttle and steering. So it could be nice to switch back and forth to get something simulating full control.

Maybe I should just wait until the full RT has it's path forward and RT integration is worked out...

Link to comment
Share on other sites

As I understand it the big hurdle to RemoteTech integration is that its impossible to raise issues with the development on the RemoteTech side of things, as there is currently nobody managing the RemoteTech github codebase. Therefore when something RemoteTech is doing is interfering with kOS, and is impossible to work around, but is easily fixed with a few tiny changes to the RT code, and these changes are even implemented and submitted entirely by kOS developers, it still can't be dealt with because there's nobody on the RT side of things currently paying attention to the requested changes to put them into the main RT code.

The only workaround would be if kOS developers Forked remoteTech, and offered their OWN variant of it to download with kOS. And that would mean taking on a lot of additional responsibilities.

Link to comment
Share on other sites

That's my understanding as well, which is why I thought it might be nice to have a workaround (albeit very crude) by just toggling the "remote tech integration" setting actively during a script so you can use action groups while it's off and throttle and steering while it's on

Link to comment
Share on other sites

I've got a few puzzling questions about this mod!

First of all, how would one calculate the *actual* maximum thrust of an engine inside the atmosphere, since atmosphere does have an effect on many engines? In some of the part cfg files, I found 'atmosphereCurve' entries, but don't know how to implement them into the script.

Secondly, why can't I use some variables? For example, when I type "print thrust." I just get back "variable thrust is not defined." This is the same for a lot of the structures, like atmosphere:* and direction:*, as well as many others. Am I missing a component of the mod?

Link to comment
Share on other sites

This is a continuation of the Excellent work by Nivekk. Without it, this mod would certainly not exist.
I've been gone from KSP since last August. When did Nivekk disappear? I just searched the Members list and Nivekk is not to be found.
Link to comment
Share on other sites

I've got a few puzzling questions about this mod!

Welcome, I hope i can answer your question.

First of all, how would one calculate the *actual* maximum thrust of an engine inside the atmosphere, since atmosphere does have an effect on many engines? In some of the part cfg files, I found 'atmosphereCurve' entries, but don't know how to implement them into the script.

I assume you are talking about Jet engines? Their thrust does vary on atmospheric density and speed. These are part of the eval for "THRUST" aka current thrust. Because we dont expose either the atrmocurve or velocitycurve and KSP doesnt use them for the "MAXTHRUST" calculation you would have to look at "THRUST" with throttle at 1.

Secondly, why can't I use some variables? For example, when I type "print thrust." I just get back "variable thrust is not defined." This is the same for a lot of the structures, like atmosphere:* and direction:*, as well as many others. Am I missing a component of the mod?

If you post a sample of your code we should be able to help more. I havent seen an issue like yours before.

I've been gone from KSP since last August. When did Nivekk disappear? I just searched the Members list and Nivekk is not to be found.

Around the first of the year.

Link to comment
Share on other sites

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