Jump to content

[1.3] kOS Scriptable Autopilot System v1.1.3.0


erendrake

Recommended Posts

Well what were you typing at the terminal then, is what I mean. Was it just this:

LOCK THROTTLE TO 1.

and that's all, or was there more to it?

I hadn't even opened the terminal yet. I just tried to launch a rocket manually, with no intention of using kOS. Throttle didn't work.

Link to comment
Share on other sites

Same thing happening to me. No need to open a kOS terminal at all. Just go to the launch pad. When the ship has a CPU unit, then for some reason you can't control the engine. kOS console's "list engines" command shows 0 engines on the ship, too.

KSP.logs show nothing. Are there any other logs to look at?

For those of you who are having this problem. Would you mind listing out the mods you have installed? I cant reproduce the problem and it is bumming me out :(

Link to comment
Share on other sites

I can't seem to make it happen either. We do know that there's some sort of issue with "Revert flight" where if you revert to the launchpad instead of all the way back to the VAB, KSP doesn't quite notify kOS that things have been reset, and not everything is cleaned up. But the lockout of the controls is not something we've been able to make happen. (I haven't been in the habit of using "revert to launchpad" lately because I'm running the Mission Controller Extended mod, which doesn't refund your money if you revert to just the launchpad but will if you revert all the way to the VAB.)

Edited by Steven Mading
Link to comment
Share on other sites

For those of you who are having this problem. Would you mind listing out the mods you have installed? I cant reproduce the problem and it is bumming me out :(

Oh boy this'll be a long list...

Toolbar

Action Group Manager

Active Texture Management

Aviation Lights

B9 Aerospace

Environmental Visual Enhancements

CactEye

Chatterer

Distant Object Enhancement

Engineer

EnhancedNavBall

Firespitter (included with B9 0.23.5 fix I think)

Greenhouse

Habitat Pack

Hull Camera VDS

Kerbal Attachment System

Procedural Fairings

Kerbal GPS

HyperEdit

kOS (duh)

Docking Port Alignment Indicator

Part Catalog

Precise Node

Protractor

ResGen (not sure where this came from or what it is, probably was bundled with one of the other mods)

SCANsat

KSP Alternate Resource Panel

Kerbal Alarm Clock

Hopefully between me and the other guy we can see which of our mods intersect, and narrow down the list of possible offenders by seeing what we have in common.

Link to comment
Share on other sites

Oh boy this'll be a long list...

So no RemoteTech? that is the one i am most worried about. Thank you very much for the list.

if you open the game does it lock the throttle on the first launch or only after you "Revert to Launch"?

Link to comment
Share on other sites

Oh boy this'll be a long list...

Toolbar

Action Group Manager

Active Texture Management

Aviation Lights

B9 Aerospace

Environmental Visual Enhancements

CactEye

Chatterer

Distant Object Enhancement

Engineer

EnhancedNavBall

Firespitter (included with B9 0.23.5 fix I think)

Greenhouse

Habitat Pack

Hull Camera VDS

Kerbal Attachment System

Procedural Fairings

Kerbal GPS

HyperEdit

kOS (duh)

Docking Port Alignment Indicator

Part Catalog

Precise Node

Protractor

ResGen (not sure where this came from or what it is, probably was bundled with one of the other mods)

SCANsat

KSP Alternate Resource Panel

Kerbal Alarm Clock

Hopefully between me and the other guy we can see which of our mods intersect, and narrow down the list of possible offenders by seeing what we have in common.

Just what I was thinking - because trying to narrow it down with that long list will be a pain otherwise. But an intersection of two sets of mods will narrow it down a lot.

Link to comment
Share on other sites

I tested with no mods installed but same problem. And yes, it locks ups the first time. Here's what I'm doing:

- Open KSP.

- Select the save.

- Go to VAB.

- Select rocket with kOS (simple command pod, kOS unit, tank, engine and a RTG).

- Launch.

EDIT: Here's something strange. I follow those steps, keys not working. Hit revet to launch, everything is working normally...

Edited by Rosco P. Coltrane
Link to comment
Share on other sites

I tested with no mods installed but same problem. And yes, it locks ups the first time. Here's what I'm doing:

- Open KSP.

- Select the save.

- Go to VAB.

- Select rocket with kOS (simple command pod, kOS unit, tank, engine and a RTG).

- Launch.

EDIT: Here's something strange. I follow those steps, keys not working. Hit revet to launch, everything is working normally...

What OS are you using? Sorry if you mentioned it before. Or maybe you are on 64-bit?

Edit: I was able to reproduce it finally. Thank you Rosco and Entropius for helping isolate the issue. Now to figure out what the hell is going on.

Edited by erendrake
Link to comment
Share on other sites

Running into an odd problem, hoping someone might have help for me.

Every time I run my (admittedly still unfinished) shuttle launch program, I'm getting

Syntax error at line 78

}

^

The weird thing is not that I'm getting a syntax error, but that k-os seems to be trying to run code that it shouldn't be trying to run until several seconds after the first few commands.

Here's my code:


clearscreen.
lock steering to up + r(0,0,-180).
print "Five seconds to launch.".
set Booster to 1.
set Circletime to 0.
set Earlytank to 0.

wait 1.
print "Four.".

wait 1.
print "Three.".

wait 1.
print "Two.".

wait 1.
print "One.".

wait 1.
lock throttle to 1.
stage.
lock steering to up + r(10,0,-180).
print "Ignition!".

wait 5.
lock steering to up + r(0,-10,90).
print "Tower clear. Starting roll program.".

if stage:solidfuel <1 and Booster = 1
{
print "Booster separation.".
stage.
set Booster to 0.
}

if altitude > 10000 and eta:apoapsis < 60
{
lock steering to up + r(0,-45,90).
print "Go at throttle up.".
}

if eta:apoapsis > 60
{
lock steering to prograde + r(0,-15,180).
print "Turning to prograde marker.".
}

if stage:liquidfuel < 2400
{
toggle ag3.
print "Engine 3 shutdown.".
}

if stage:liquidfuel < 1900
{
toggle ag1.
print "Engine 1 shutdown.".
}

if apoapsis > 80500
{
lock throttle to 0.
print "Orbital insertion 75% complete.".
}

if apoapsis > 80000 and eta:apoapsis < 5
{
lock throttle to 1.
print "circularization burn start.".
set circletime to 1.
}

if apoapsis > 80000 and periapsis > 80000
{
lock throttle to 0.
print "Orbital insertion complete. Good luck!"
}

if circletime = 1 and eta:apoapsis >10
{
lock throttle to 0.
print "Coasting to new apoapsis."
}

if apoapsis >80000 and periapsis >30000
{
lock throttle to 0.
lock steering to prograde.
print "Jettisoning external tank on suborbital trajectory. Give a hoot, don't pollute!".
rcs on.

wait 10.
stage.
print "External tank and payload fairing jettisoned. SSMEs 2 and 4 shutdown.".
set Earlytank to 1.
toggle ag2.
rcs off.
}

if stage:liquidfuel <721 and EarlyTank = 0
{
print "External tank empty. Switching to orbital manuevering system.".
lock throttle to 0.
lock steering to prograde.
rcs on.

wait 10.
stage.
print "External tank and payload fairing jettisoned. SSMEs 2 and 4 shutdown."
toggle ag2.
rcs off.
}

On an related note, i tried deleting all of the IF statements and just running the first part and what would happen is the shuttle would stage and lock the throttle, but it wouldn't lock the steering or start the gravity turn when it was supposed to - and I know those bits of code should work because they worked on the previous version of k-OS with the same craft.

Would appreciate the help of someone with more experience on this mod.

Link to comment
Share on other sites

I have the same problem but I don't think that it's from any mods, as I tried removing them methodically and the problem still persists.

I even tried doing a complete fresh install of KSP without any mods whatsoever except kOS and I still couldn't do anything other than stage when a CPU part was attached.

Link to comment
Share on other sites


if apoapsis > 80000 and periapsis > 80000
{
lock throttle to 0.
print "Orbital insertion complete. Good luck!"
}

That's the syntax error. The reason the "}" is a syntax error is because it was still looking for a period (.) to end the previous statement. Your print statement doesn't end with a period after the final quote mark. I think I saw the same thing in a few other places in what you posted.

Link to comment
Share on other sites

Short explanation:

The text editor feature went away...

...Save it to: {KSP_HOME}/PluginsPluginData/Archive/

Ah, that's where I save it. I had it inside gamedata as well.

Also thanks for the explanation why I couldn't get the editor to work.

I have another small question: Can the wait function work with decimals? Will there be a 0.2 second difference between wait 1 and wait 0.8?

Thanks!

Link to comment
Share on other sites

Ah, that's where I save it. I had it inside gamedata as well.

Also thanks for the explanation why I couldn't get the editor to work.

I was speaking with (technically typing with) @erendrake about this he seems to agree that it's confusing and it would be nice to move it, as it breaks the rules slightly for a mod to be putting things outside its GameData location, but the other problems take a higher priority, so we're stuck with it like that for a while yet.

I have another small question: Can the wait function work with decimals? Will there be a 0.2 second difference between wait 1 and wait 0.8?

Thanks!

Yes it can. I've often put short "wait 0.2." statements in my scripts to prevent them from unnecessarily spinning in a loop faster than need be.

Link to comment
Share on other sites

I'd recently been given permission by @erendrake to do editing on the kOS documentation located here:

http://ksp-kos.github.io/KOS_DOC/

And I'd already done a little bit of editing on it (mostly just adding new features that were created after the documentation was first written).

But I'd like people to reply with honest appraisals about which parts of understanding the mod are, or were, the hardest for them to deal with, so I know where to concentrate effort on first in documenting things.

This is in regards to missing documentation, that is. Obviously if a bug was causing a problem, that's not what I mean. What I mean is those forehead-slapping moments where you think "Oh THAT's What I'm doing wrong! If only someone had told me THAT, then this would have been a lot easier to understand!".

And of course, there's two different categories of documentation:

1 - Reference docs - dry, lists, boring but fast and to the point - like reading a dictionary.

2 - Explanatory docs - walk you through things, more like reading an encyclopedia.

I'd be interested in suggestions for either type of documentation.

Link to comment
Share on other sites

Alright everyone, there is a hotfix up on spaceport. It fixes some of the worst bugs that have been brought up here on the forums. This is not 12.1, just a hotfix to keep people from having a horrible time.


* Fixes flight control being busted on launch
* TIME now respects the new KERBIN_TIME setting introduced in 23.5
* Division and Multiplication operator precedence is less surprising
* Vectors give a much clearer error if you abuse them

It should be up now so everyone let us know if your life is any better with the new version. Good hunting.

Link to comment
Share on other sites

And of course, there's two different categories of documentation:

1 - Reference docs - dry, lists, boring but fast and to the point - like reading a dictionary.

2 - Explanatory docs - walk you through things, more like reading an encyclopedia.

I'd be interested in suggestions for either type of documentation.

Any kind of explanatory docs would be cool. I read the relevant reference docs for what I need, but failed to understand how to use it properly.

For example, I want to have a loop that starts on ag5 and stops on ag6.

I thought that should be easy enough:

set x to 1.

on ag5 {

set x to 1.

until x>1 {

print "loop is running".

wait 1. }

}

on ag6 {

set x to 2.

}

It didn't work. Why? I don't know, I couldn't find any info that tells me if that even makes any sense.

I've not given up on the idea, I'm sure I'll find the correct way to make it work, but more sample scripts and tutorials would be wonderful.

Link to comment
Share on other sites

is it possible with this to control how long it takes to change orientation, heading or anything else? for instance if I wanted to initiate pitch over at a given time but control pitch change rate such that it finishes pitch changes at a given altitude or by a certain time?

Edited by Starwaster
Link to comment
Share on other sites

Alright everyone, there is a hotfix up on spaceport. It fixes some of the worst bugs that have been brought up here on the forums. This is not 12.1, just a hotfix to keep people from having a horrible time.


* Fixes flight control being busted on launch
* TIME now respects the new KERBIN_TIME setting introduced in 23.5
* Division and Multiplication operator precedence is less surprising
* Vectors give a much clearer error if you abuse them

It should be up now so everyone let us know if your life is any better with the new version. Good hunting.

I grabbed the hotfix of the Spaceport and I tried to run a simple ascent script:


Clearscreen.
print "Launch!".
stage.


set TargetH to 240000.
lock throttle to 1.
set v to up + r(0,0,-180).
set pitch to 0.
lock steering to v.
set DeFlag to 0.
on AG8 set DeFlag to 1.


until Alt:Apoapsis > TargetH OR DeFlag = 1 {
set pitch to -90*sqrt(Alt:Apoapsis/TargetH).
set v to up + r(0,pitch,-180).
run stager.
print "I am looping!".
}.


print "Thanks for flying!".

However, it seems that the program cannot access the throttle and flight control:

Javascript is disabled. View full album

Do note that I use RemoteTech. So that might influence things.

Link to comment
Share on other sites

set x to 1.
on ag5 {
set x to 1.
until x>1 {
print "loop is running".
wait 1. }
}
on ag6 {
set x to 2.
}

Sometimes the documentation is there, but it's just not prominent enough. The problem is that every trigger hook a program sets up gets removed when the program ends (when you think about it, this is desirable - otherwise you could trigger a hook much later that you forgot was there).

So the problem is simply that the program hits the bottom and exits before you do anything. To test if this is the problem, add a long wait to the bottom of the script and see if you can do it then.

And thanks for the feedback - this does tend to come up a lot in people's questions so it clearly needs better documenting.

Link to comment
Share on other sites

is it possible with this to control how long it takes to change orientation, heading or anything else? for instance if I wanted to initiate pitch over at a given time but control pitch change rate such that it finishes pitch changes at a given altitude or by a certain time?

You can keep changing what you LOCK STEERING to. Or you can take direct control with the new SHIP:CONTROL features.

So the short answer is yes you can.

Link to comment
Share on other sites

...To test if this is the problem, add a long wait to the bottom of the script and see if you can do it then.

That seems to trow me into an infinite loop that gets KSP locked. Not the first time I managed to do that :)

Speaking of infinite loop, is there a way to stop it? Like in the good old DOS days when a quick whack on Ctrl+C or Ctrl+Break would kill your app?

Anyway, I'm running out of ideas to try, so I'll just ask:

How do I create a script that starts a loop on ag5 and never stops unless you press ag6?

Link to comment
Share on other sites

That seems to trow me into an infinite loop that gets KSP locked. Not the first time I managed to do that :)

Speaking of infinite loop, is there a way to stop it? Like in the good old DOS days when a quick whack on Ctrl+C or Ctrl+Break would kill your app?

Anyway, I'm running out of ideas to try, so I'll just ask:

How do I create a script that starts a loop on ag5 and never stops unless you press ag6?

CTRL+C is supposed to work, but if it doesn't then that could be a bug. Have you tried it and it didn't work?

It just occurred to me what the problem might be - are you aware of the keyboard focus issue with using action groups as a means of input?

When you say "ON AG5 ... " What you are saying is

not this -> "respond to somebody pressing ALT+5".

What you are saying

is this -> "respond to Action Group 5 happening.".

The difference is subtle but very important. In order for Action Group 5 to happen, Kerbal Space Program needs to see your ALT+5 keypress. Note, that's Kerbal Space Program, NOT kOS. In other words, you have to make sure that kOS's terminal window is *NOT* focussed. It needs to be greyed out and un-highlighted (click outside the window on the screen) in order for ALT+5 to be seen by KSP and turned into an action group.

Is that the problem? This also needs better documenting.

Link to comment
Share on other sites

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