Jump to content

[1.3] kOS Scriptable Autopilot System v1.1.3.0


erendrake

Recommended Posts

1 minute ago, Red Iron Crown said:

plz read the thread

I don't see anything implying that the mod works in 1.1.3 other than the words: "requires Kerbal Space Program 0.90 or later," and that doesn't mean that it'll work properly.

Link to comment
Share on other sites

1 minute ago, Linventor said:

I don't see anything implying that the mod works in 1.1.3 other than the words: "requires Kerbal Space Program 0.90 or later," and that doesn't mean that it'll work properly.

The previous page contains a release candidate that was posted Monday. The thread title says it supports 1.1. 

Link to comment
Share on other sites

3 minutes ago, Linventor said:

So?

So it's obvious that updates are being worked on, and pretty obvious that the current version works in 1.1 (which afaik includes 1.1.3).

I can see you're new here, but it is common courtesy to read at least the OP and the last few pages of the thread before asking for an update or other question, and a lazy post like "plz update" is never welcome as it wastes everyone's time.

Link to comment
Share on other sites

4 minutes ago, Red Iron Crown said:

So it's obvious that updates are being worked on, and pretty obvious that the current version works in 1.1 (which afaik includes 1.1.3).

I can see you're new here, but it is common courtesy to read at least the OP and the last few pages of the thread before asking for an update or other question, and a lazy post like "plz update" is never welcome as it wastes everyone's time.

I've been considering 1.1 and 1.1.3 as completely different updates. You are correct in me being new on the forum. I have read the OP. And the last statement is a valid request. Thanks for your help.

Link to comment
Share on other sites

I'm not getting any science when I run do_science from my code, what's wrong here?

 

FUNCTION do_science_module {
  PARAMETER mod.

  IF (mod.HASDATA = FALSE) {
    mod:DEPLOY.
    WAIT UNTIL mod:HASDATA.
    PRINT "New data, transmitting now.".
    mod.TRANSMIT.
  }
}

FUNCTION do_science {
  LIST Parts IN lp.
  FOR p IN lp {
    IF p:MODULES:CONTAINS("ModuleScienceExperiment") {
      SET m TO p:GETMODULE("ModuleScienceExperiment").
      do_science_module(m).
    }
  }
}

Oh yeah, I don't like IF (mod.HASDATA = FALSE) but I don't know how to express a negative boolean in kerboscript.

EDIT: in fact, I believe the error may be in exactly the above line. But I don't know how to express it correctly.

Edited by Amedee
Link to comment
Share on other sites

1 hour ago, Amedee said:

 


FUNCTION do_science_module {
  PARAMETER mod.

  IF (mod.HASDATA = FALSE) {
    mod:DEPLOY.
    WAIT UNTIL mod:HASDATA.
    PRINT "New data, transmitting now.".
    mod.TRANSMIT.
  }
}
[...]

Oh yeah, I don't like IF (mod.HASDATA = FALSE) but I don't know how to express a negative boolean in kerboscript.

You're using . (dot) instead of : (colon).  Common mistake, I do the same thing all the time.

You can also just do IF NOT mod:HASDATA {

Link to comment
Share on other sites

okay I am pulling my damn hair out.

It has been a while since I used kos.  I am looking at the docs page. I created a very simple hello, world! test program.

PRINT "Hello, World!".

and saved it to file game-root-folder/ships/script/kos1.ks

then I put a ship on the pad and open the terminal and type:

LIST VOLUMES.

and I see - 0 archives -1 and 1* 5000.  I am using the small kos computer.

Then I type:

SWITCH TO 0. 

and I keep getting an error: Volume is out of range?????

So I cannot even get to step one of running a script!!!!  

It is cut off but I am in .../1.1.3.1289-070916/Ships/Script/

the program is saved as kos1.ks

So why can't I switch to volume 0????  Both switch to 0. and switch to archive. fail!!!!

518wYrx.jpg

Edited by ctbram
Link to comment
Share on other sites

29 minutes ago, ctbram said:

okay I am pulling my damn hair out.

It has been a while since I used kos.  I am looking at the docs page. I created a very simple hello, world! test program.

PRINT "Hello, World!".

and saved it to file game-root-folder/ships/script/kos1.ks

then I put a ship on the pad and open the terminal and type:

LIST VOLUMES.

and I see - 0 archives -1 and 1* 5000.  I am using the small kos computer.

Then I type:

SWITCH TO 0. 

and I keep getting an error: Volume is out of range?????

So I cannot even get to step one of running a script!!!!  

It is cut off but I am in .../1.1.3.1289-070916/Ships/Script/

the program is saved as kos1.ks

So why can't I switch to volume 0????  Both switch to 0. and switch to archive. fail!!!!

518wYrx.jpg

Archive is disabled with that error message if you're using RemoteTech and don't have a connection to KSC.

Link to comment
Share on other sites

3 hours ago, undercoveryankee said:

Archive is disabled with that error message if you're using RemoteTech and don't have a connection to KSC.

doh!  I am guessing that is spelled out some place that I just did not bother to read.  Thank you for the response.  I will stick a dipole on the thing. Of course it would be nice if there was a more intuitive error message like no comm link or something.  This message reminds me of the old joke about just replacing all the gauges in my car with a single red led and when it comes on the "experienced" driver would just know what is broken! Although as I think about it "out of range might infer a communications link issue".

 

cheers,
RM

Edited by ctbram
Link to comment
Share on other sites

5 hours ago, ctbram said:

Of course it would be nice if there was a more intuitive error message like no comm link or something.  This message reminds me of the old joke about just replacing all the gauges in my car with a single red led and when it comes on the "experienced" driver would just know what is broken! Although as I think about it "out of range might infer a communications link issue".

You're not the only one to be confused by the message: https://www.reddit.com/r/Kos/comments/4s6l66/switch_to_error/

It sounds like the devs are amenable to changing it to be clearer.

Link to comment
Share on other sites

I have a question.

How come this statement works: 

when mass <= 78 and mass >= 76 then {
    set ag42 to true.
    print "Starboard and Port Engine Cutoff".
}.

 

But this one doesn't:


when mass <= 105 and mass >= 101 then {
    set ag40 to true.
    print "Inboard Cutoff".
}.
 

I'm using action groups extended, and the two I have there shut down engines to limit G force. I have both in the launch script and only the former one works. I tried deleting the former to see if the latter would work on it's own, and it still didn't work. 

Thank you for any help!
 

Edited by dafidge9898
Added Information
Link to comment
Share on other sites

24 minutes ago, dafidge9898 said:

But this one doesn't:


when mass <= 105 and mass >= 101 then {
    set ag40 to true.
    print "Inboard Cutoff".
}.

 

Does it not fire at all? One of the possible reasons for that may jumping over these margins in a single frame between 2 checks of the trigger - it may take multiple frames to go through all of them if you have a big bunch. Do you really need the mass>=101 condition?

Also consider the fact that for actions that don't care about the way the action group has been changed (turning engines on or off and even toggling them behave this way) it's safer to use toggle ag40. than set ag40 to true. or ag40 on.

Link to comment
Share on other sites

10 minutes ago, Alchemist said:

Does it not fire at all? One of the possible reasons for that may jumping over these margins in a single frame between 2 checks of the trigger - it may take multiple frames to go through all of them if you have a big bunch. Do you really need the mass>=101 condition?

I changed it so it reads this:

when mass <= 105 then {
    toggle ag40.
    print "Inboard Cutoff".
}.

when mass <= 78 then {
    toggle ag42.
    print "Starboard and Port Engine Cutoff".
}.
 

AG40 fires now, but it fires at the same time as AG42, which is too late. 

Link to comment
Share on other sites

It really takes too long to go through all of this. How many triggers do you have there at once?! And what kind of mess is the steering lock?

You don't usually have to activate all of the triggers simultaneously and have huge branching steering and throttle expressions - as long as you have some kind of main sequence, you are better with having it as the main sequence with wait commands and throwing the triggers in a minimal amount at a time as well as switching steering between simple expressions.

Link to comment
Share on other sites

21 hours ago, dewin said:

You're using . (dot) instead of : (colon).  Common mistake, I do the same thing all the time.

You can also just do IF NOT mod:HASDATA {

Crikey! I really need a KerboScript IDE with syntax highlighting and autocompletion. Eclipse and IntelliJ spoil me too much when I write Java so I feel so dumb when I'm back in plain old vi. :)

 

Thank you!

Link to comment
Share on other sites

Just now, Amedee said:

Crikey! I really need a KerboScript IDE with syntax highlighting and autocompletion. Eclipse and IntelliJ spoil me too much when I write Java so I feel so dumb when I'm back in plain old vi. :)

There's an IntelliJ kOS syntax plugin out there somewhere, among others -- see https://github.com/KSP-KOS/EditorTools

Link to comment
Share on other sites

As this is killing me, i shall ask here aswell.

Im using body:position * north:vector to obtain my distance to the equator.

The return, however is a useless number(too small, not realy changing).

Where is my fault?

Link to comment
Share on other sites

11 hours ago, angrybold said:

As this is killing me, i shall ask here aswell.

Im using body:position * north:vector to obtain my distance to the equator.

The return, however is a useless number(too small, not realy changing).

Where is my fault?

Since you asked on reddit as well, I'm just going to link to that thread for anyone who sees this question and wonders if you ever found an answer: https://www.reddit.com/r/Kos/comments/4tcvay/vectordot_not_working_like_i_want_it_to/

Link to comment
Share on other sites

2 hours ago, hvacengi said:

Since you asked on reddit as well, I'm just going to link to that thread for anyone who sees this question and wonders if you ever found an answer: https://www.reddit.com/r/Kos/comments/4tcvay/vectordot_not_working_like_i_want_it_to/

ahh well yes. to anyone wondering: ElWanderer_KSP pointed me to the idea of compensating a heading vector---> *heading(0,latitude):vector.

Tried that and it works nicely for what is needed even tho its not the direct approach yet.

Now back to the code :)

Link to comment
Share on other sites

Is it possible to lock the steering to x degrees above the prograde vector? The tutorial page showed something:

lock steering to prograde + r(x,y,z).

however, I can't figure out what coordinates to put in. I could get around it by somehow finding the heading (in degrees from north) of the prograde vector, but I didn't know how to find the information to figure that out. I looked it up, and someone said ship:bearing is the heading of the prograde vector, but it's not. 

Link to comment
Share on other sites

9 hours ago, RS25forlife said:

Is it possible to lock the steering to x degrees above the prograde vector?

Someone said ship:bearing is the heading of the prograde vector, but it's not. 

The following is a modification of my constant altitude burn (lander) steering. I've not tested this version:

LOCK STEERING TO LOOKDIRUP(ANGLEAXIS(pitchAngle(),VCRS(VELOCITY:SURFACE,BODY:POSITION))*VELOCITY:SURFACE,FACING:TOPVECTOR).

The vector cross of the surface velocity and body position gives an axis to rotate the prograde vector around (it returns a vector that is at 90° to both input vectors). I get easily confused by rotations, but I quite like ANGLEAXIS(rotation angle, axis vector) * vector to rotate.

The pitchAngle() function you can replace/get to return whatever number of degrees you like. Note that as the KSP coordinate system is confusing and left-handed, you may find that you need to supply a negative number to pitch up. My own version points to retrograde amongst other differences.

Edit: The bearing suffix gives you a compass bearing to that vessel from your own vessel. That implies that ship:bearing is a bearing from your vessel... to your vessel. As such it's undefined and will return gibberish. It's a relic of the original development.

Edited by ElWanderer
Mention ship:bearing, reduce quotation size
Link to comment
Share on other sites

8 hours ago, ElWanderer said:

LOCK STEERING TO LOOKDIRUP(ANGLEAXIS(pitchAngle(),VCRS(VELOCITY:SURFACE,BODY:POSITION))*VELOCITY:SURFACE,FACING:TOPVECTOR).

Thank you! Do you also happen to know how to get KOS to print orbital velocity in m/s? print orbit:velocity does not print it in m/s. This is for the sake of an equation that needs the orbital velocity in m/s.

Link to comment
Share on other sites

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