Jump to content

[1.3] kOS Scriptable Autopilot System v1.1.3.0


erendrake

Recommended Posts

Hi,

Is seems the old time struct constructor got removed, T(seconds). Is there a better solution than this

Set a to time+seconds-time.

Print time:clock.

to get a formatted output.

It used to be like this

Print T(seconds):clock.

Thx

Link to comment
Share on other sites

Am I the only one, who don't get any buttons an both kOS parts? I searched the internet many hours for my problem, but couldn't find anything!:confused:

You are not the only one! I don't get any buttons on the kOS parts too. I tried it with a vanilla KSP v0.24 in 32bit and 64bit - nothing. It doesn't work with v0.23.5 neither.

Link to comment
Share on other sites

Hi everyone,

I'm having an issue, i'm totally new to this mod and I can't find a way to get it to work.

I unzipped the file into the KSP folder, created my rocket with the computer parts, it has enough electricity to work, but when i get to the launchpad and right click to the computer part, i don't get any clickable button from it ( except lights on ).

What Did I do wrong ?

Link to comment
Share on other sites

Can you mention what the error messages actually are? Having to diagnose by guessing is hard.

I get:

Can't add ...

Can't add ...

Cannot cast from source type to destination type

Sometimes the program doesn't terminate, it just freezes the throttle in one position.

The problem I've found is to do with this statement:

lock steering to ship:velocity:surface + r(0,0,180).

If I get rid of the r(0,0,180) I get no errors, though the ship then rolls midflight due to how the ship is orientated on the launchpad, this function was working in the previous pre-release as well.

Edit:

For anyone suffering a similar issue, this is what I'm using to get round this problem instead of using "lock steering to ship:velocity:surface + r(0,0,180)."


set direction to ship:velocity:surface:direction.
lock steering to direction + r(0,0,180).

Another edit:

Or just use:

lock steering to ship:velocity:surface:direction + r(0,0,180).

Edited by Joe32320
Link to comment
Share on other sites

Am I the only one, who don't get any buttons an both kOS parts? I searched the internet many hours for my problem, but couldn't find anything!:confused:
You are not the only one! I don't get any buttons on the kOS parts too. I tried it with a vanilla KSP v0.24 in 32bit and 64bit - nothing. It doesn't work with v0.23.5 neither.
Hi everyone,

I'm having an issue, i'm totally new to this mod and I can't find a way to get it to work.

I unzipped the file into the KSP folder, created my rocket with the computer parts, it has enough electricity to work, but when i get to the launchpad and right click to the computer part, i don't get any clickable button from it ( except lights on ).

What Did I do wrong ?

This issue has been fixed in the pre-release version, you can download it from the link on the first page here. I don't believe it has been uploaded to Curse yet.

Edited by Kethevin
Link to comment
Share on other sites

Once kOS unlocks the throttle, it's put to where it was when kOS took over. Since the last update, that means at 50% thrust. Well, at least if you don't take the time to throttle down before you start your script, which is easy to forget. And you won't notice your mistake until after the script is done and the engines start firing.

I'm using action groups to shut down the engines, but that's a mere workaround. Is there any way to set the throttle to 0 in such a way that it stays there, even after kOS is done?

BTW: running programs at boot time is nice.

Link to comment
Share on other sites

Or just use:

lock steering to ship:velocity:surface:direction + r(0,0,180).

This must have been introduced when Vector+Rotation was changed to return a vector instead of a Direction.

What it used to do was translate the Vector into a Direction, then rotate it, and return the Direction - which loses magnitude information from the vector, and removes the ability of the script writer to use the built-in system to rotate a vector - an *extremely* important thing for lots of stuff people should be able to do. This was conceptually wrong because when you convert a vector into a direction you lose magnitude information but "gain" bogus manufactured information about which way is the "up" (i.e. the roll information). The "+R(0,0,180)" was a rotation from that false manufactured "roll" information to the one you wanted.

It still works, as you found, but now you have to explicitly say you wanted the vector turned into a direction.

The odd thing I don't understand, is that it shouldn't give an error. I wonder if it gave an error because the rotation was a rolll - the one thing that vectors can't store.

Link to comment
Share on other sites

This issue has been fixed in the pre-release version, you can download it from the link on the first page here. I don't believe it has been uploaded to Curse yet.

I feel so ashamed! :blush: Indeed I had the version 0.13 from Curse and didn't realize that that's not the newest version as mentioned in this thread.

After I manually downloaded and installed version 0.13.1 it finally shows its buttons. But it also needed several test starts of KSP until I got it that far. I think rebuilding my kOS test craft rather than using the old saved one was the essential point. Or maybe just a second right click on the SCS. I'm not sure.

Link to comment
Share on other sites

Hi, been trying to use this mod to automate my spaceplane orbiting, but not much luck so far.

Currently I uses MechJeb Smart ASS and set PIT(ch) to 30, Heading to 90 and start the engines.

It coasts down the runway and takes off.

I tried to replicate this with kOS, but no joy - it crashes and burns :(

Now it does stall a little at the start, but mechjeb handles this fine. kOS however does not keep pulling back on the stick enough and lets the nose gradually dip until it hits the ground.

Here is what I have so far:

lock throttle to 1.

toggle ag4.

lock steering to heading( 90, 30 ).

wait until altitude > 10000.

lock steering to heading( 90, 20 ).

wait until altitude > 20000.

lock steering to heading( 90, 10 ).

I did try setting a manual takeoff like so, but that just veered off the runway...

lock steering to heading( 90, 0 ).

wait until speed > 150.

Any ideas?

I guess kOS is not designed for spaceplanes, but any improvements you could make here would be much appreciated as SP orbits can take quite long...

Link to comment
Share on other sites

I don't believe it has been uploaded to Curse yet.

You're right. I downloaded the Curse version first. On GitHub is the newest version and that works. Except for me for the KR-2042 b. Here the button didn't show up but I was able to open the terminal by action groups.

But didn't I read in the changelog about a config button for a boot sequence accessable in VAB? I can't see or find that button anywhere.

Last thing: I found an older kOS script from the cruise missile example at kos.wikia.com containing this line of code:

lock steering to heading targheading by pitch.

This line isn't working anymore. Can someone explain what that line is doing and how to fix it to work with v0.13.1 again? Thanks.

Link to comment
Share on other sites

lock steering to heading targheading by pitch.

This line isn't working anymore. Can someone explain what that line is doing and how to fix it to work with v0.13.1 again? Thanks.

That syntax was removed deliberately for some reason. I'm not going to defend it because I don't understand why it was.

You can get the same effect with the alternate syntax:

lock steering to heading( compass, pitch ).

Link to comment
Share on other sites

Hi, been trying to use this mod to automate my spaceplane orbiting, but not much luck so far.

Currently I uses MechJeb Smart ASS and set PIT(ch) to 30, Heading to 90 and start the engines.

It coasts down the runway and takes off.

I tried to replicate this with kOS, but no joy - it crashes and burns :(

Now it does stall a little at the start, but mechjeb handles this fine. kOS however does not keep pulling back on the stick enough and lets the nose gradually dip until it hits the ground.

Here is what I have so far:

lock throttle to 1.

toggle ag4.

lock steering to heading( 90, 30 ).

wait until altitude > 10000.

lock steering to heading( 90, 20 ).

wait until altitude > 20000.

lock steering to heading( 90, 10 ).

I did try setting a manual takeoff like so, but that just veered off the runway...

lock steering to heading( 90, 0 ).

wait until speed > 150.

Any ideas?

I guess kOS is not designed for spaceplanes, but any improvements you could make here would be much appreciated as SP orbits can take quite long...

I suspect it's happening because the LOCK STEERING algorithm assumes that it should not use too much force if the deflection isn't very far. (i.e. if the deflection from the intended angle is only a few degrees off, it won't use full pitch, as that creates massive oscillations usually.)

The LOCK Steering isn't optimized for spaceplane flight where pitch behaves very differently from yaw because a neutral setting tends to pitch down. It's assuming all axes are relatively equal in how they behave.

However, you can try to write your own more sophisticated autopilot by controlling the controls directly in RAW mode and bypassing LOCK STEERING entirely.

http://ksp-kos.github.io/KOS_DOC/summary_topics/ship_control/index.html

Link to comment
Share on other sites

Ah! I had the same nothing working stuff. Now I see, the link on page 1 to Github is still 13 (.0) although it says 24.0 compatible.

https://github.com/KSP-KOS/KOS/releases/tag/v0.13 OLD!

https://github.com/KSP-KOS/KOS/releases/tag/v0.13.1 NEW!

:)

--

edit: alas still not working, even with 0.13.1

:(

--

double edit: only not working in career mode! working in sandbox

ps, that said I latest downloaded from:

https://github.com/KSP-KOS/KOS

Edited by Ricovandijk
Link to comment
Share on other sites

If any one is interested, I've used the new boot functionality to make a kind of bootloader. It initialises crafts on the launchpad based on a config file. You can copy scripts, presets variables, autorun a script,... on a per craft basis. Let's just say that it uses a lot of log "commands" to foo. run foo. delete foo. trickery.

kOSis: k-OS Initialistaion System

Here is a (non functional) exemple of what the config file looks like:


run PRESET("ksc", geoposition).
run INIT("toolkit").

run SHIP("My SSTO").
run AUTORUN("myssto", "takeoff").
run PRESET("sstospClimbPitch", 30).
run PRESET("sstospLevelAlt", 20000).
run PRESET("sstospLevelPitch", 15).
run PRESET("sstospRocketPitch", 45).
run VOLUME("myssto").
run INIT("plane_toolkit").
run INIT("space_toolkit").
run FILE("myssto_takeoff", "takeoff").

run SHIP("My Satellite").
run AUTORUN("launcher", "launch").
run PRESET("orbitAltitude", 500).
run PRESET("orbitInclination", 85).
run VOLUME("launcher").
run FILE("launcher_launch", "launch").
run INIT("space_toolkit").
run VOLUME("mysatellite").
run FILE("satellite_mainscript","boot").
run INIT("space_toolkit").
run INIT("toolkit").

Edited by Beheska
Link to comment
Share on other sites

edit: alas still not working, even with 0.13.1

:(

--

double edit: only not working in career mode! working in sandbox

ps, that said I latest downloaded from:

https://github.com/KSP-KOS/KOS

Did you try right clicking twice in a row (Not a double right click, just several normal slow right clicks in a row on the SCS)?

Or maybe remove the SCS part in VAB and put it back on the vessel?

One of these or both helped for me.

Link to comment
Share on other sites

If any one is interested, I've used the new boot functionality to make a kind of bootloader. It initialises crafts on the launchpad based on a config file. You can copy scripts, presets variables, autorun a script,... on a per craft basis. Let's just say that it uses a lot of log "commands" to foo. run foo. delete foo. trickery.

kOSis: k-OS Initialistaion System

Here is a (non functional) exemple of what the config file looks like:

    SNIP

Looking at the files, a few small tweaks are needed:

BOOT.TXT: typo: Line 18, SWITCH misspelled.

BOOT and KOS_BOOT both have odd formating, tab usage to align brackets, didn't use a new line for separate commands etc. (intentional to save space perhaps?)

Overall, Thank you for doing this, definitely going to give it a shot, as my boot loader is a simple "load and run" type of deal.

Link to comment
Share on other sites

I did try setting a manual takeoff like so, but that just veered off the runway...

I have found that the runway is oriented to the heading 90.399787902832. The difference is small, but it is visible if you need a long distance to takeoff.

I guess kOS is not designed for spaceplanes

My firsts serious scripts were for spaceplanes. As long as you are not trying some serious flying like turning or level flight (for that you will need to write a PID controller), it works well enough.

SWITCH misspelled.

That's what you get for committing without testing. Just corrected it.

BOOT and KOS_BOOT both have odd formating, tab usage to align brackets, didn't use a new line for separate commands etc. (intentional to save space perhaps?).

It's intentional: I try not to have too much of a overhead. I indented boot.txt because it's not really needed, and I removed even more spaces in kosis_boot.txt :P

Edited by Beheska
Link to comment
Share on other sites

Cool stuff. Reading in depth.

Basicly, going to try to convert my SSTO script to this system.

I'm a little confused, it SEEMS that kosis creates the PRESET file for variables, which is then populated from the kosis_cfg?

So instead using SET VAR to FOO, they are created by RUN PRESET ("Var", Foo).

Link to comment
Share on other sites

I'm a little confused, it SEEMS that kosis creates the PRESET file for variables, which is then populated from the kosis_cfg?

So instead using SET VAR to FOO, they are created by RUN PRESET ("Var", Foo).

Kosis creates ship, preset, ect. on the local drive and initialize tmp. Then kosis_cfg call them: ship just sets a flag, volume, file and init write in a file called tmp, and preset write presetS. Then kosis deletes them and runs tmp which deletes itself right at the beginning and do a bunch of copy and rename.

Link to comment
Share on other sites

Is there a way to get the real system time instead of KSP time? I'd like to use system time for some specific logging purposes.

Edited by spec10
Link to comment
Share on other sites

Hello,

I hope i'm not asking a dumb question : I play KSP 0.24 64bits on ubuntu and while the terminal opens and commands can be typed well, pressing enter only adds spaces after the typed command, is there a problem with my installation or am I pressing the wrong key ?

thanks

Link to comment
Share on other sites

planning a Duna mission that will include an atmospheric probe. Playing with signal delay so need a way to send experiment data and monitor battery usage, discharging capacitors as needed to recharge EC supply. Looking over the docs it seems this isn't yet possible to do directly? As in I can't access a part in code and tell it to run its experiment and then send the data. I can monitor the EC levels, but can't tell a specific capacitor to discharge? I know I can use Action Groups, however there aren't enough AGs to handle everything :/

Link to comment
Share on other sites

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