Jump to content

kOS Autopilot


erendrake

Recommended Posts

How does that work with multiple engines?

What's the syntax?

I can't find any documentation.

Thrustlimit isn't a global thing. It's a per-engine thing. The only reason it exists is to allow multiple engines to be throttled differently from each other. If you want all engines throttled the same you'd just use the throttle for that.

To use it you LIST ENGINES IN someVariable.

Then someVariable is a LIST of objects of type ENGINE. You iterate over the items in the list and set some of their :THRUSTLIMIT suffixes to the value you want.

Link to comment
Share on other sites

ok so I DL and install this but I have a strange problem... I have installed the "stack part" and also modified a pod .cfg to include the module and both do the same thing.

I get the terminal screen up, and it reports the version information but then nothing. I can type in the terminal screen, but nothing happens. I cant get any reaction from the terminal.

Link to comment
Share on other sites

Yeah it causes severe understeering in vessels without reaction wheels, or ones with small wheels like in most of Realism Overhaul.

By forcing a minimum detected torque the system steers a LOT better.

That behavior can happen from the older 0.9 version. Are you using 0.11 or up?

Link to comment
Share on other sites

It looks as if adding the module to anything in any way results in that bug I described. Using the part is still ok-ish. At least I can kinda use the new additions now. Can I make a massless, radially attached part for this mod? I've seen requests for this several times. The existing part is just too clunky.

This keep getting spammed in the debug window.

[Exception]: UnityException: Input Key named: is unknown

EDIT

Actually would you like me to redo the models and textures completely? The textures at the moment use over 8Mb of memory. That is absolutely ridiculous for something that shouldn't even be that big in the first place. Even Kevin himself asked for some help with the models when he first made this.

EDIT

Where's the license for this mod...

EDIT

I've tested a hastily made radial kOS part and it seems to work fine.

Edited by Cpt. Kipard
Link to comment
Share on other sites

Marionapp: I was looking into trying to make contributions that might end up meaning adding some syntax, and I noticed that there appears to be a file in the source code that looks for all the world like input for a parser generator - kRISC.tpg - It seems to be a for a parser generator called "tinyPG".

Is there a good rundown of which of the C sharp source files are auto-generated by tinyPG and therefore I should NOT be trying to edit them directly?

I was going to try looking at the order of operations for AND versus comparators and it looks like to work in that area I'll need to install tinyPG and use it.

Link to comment
Share on other sites

You'll need to download TinyPG from here (that fork that has some improvements over the original).

The auto-generated files are "ParseTree.cs", "Parser.cs" and "Scanner.cs" all of which are in the Compilation/KS folder. Once you generate the new files you'll need to manually remove the "RegexOptions.Compiled" flag from "Scanner.cs" before compiling because it's not supported by mono.

As long as you don't add or remove expressions (in the "expressions" section) you shouldn't have to modify the compiler. I think that you can achieve this by just reordering some of the expressions so the "AND" and "OR" are processed after the comparators.

Link to comment
Share on other sites

You'll need to download TinyPG from here (that fork that has some improvements over the original).

The auto-generated files are "ParseTree.cs", "Parser.cs" and "Scanner.cs" all of which are in the Compilation/KS folder. Once you generate the new files you'll need to manually remove the "RegexOptions.Compiled" flag from "Scanner.cs" before compiling because it's not supported by mono.

As long as you don't add or remove expressions (in the "expressions" section) you shouldn't have to modify the compiler. I think that you can achieve this by just reordering some of the expressions so the "AND" and "OR" are processed after the comparators.

Yeah it seemed pretty clear how to change the file, which says you compare 'or/and' expressions together, rather than saying you 'or/and' the compare expressions together. I just was unclear on how to run the parser generator after that. Thanks. I'll probably get a chance to try this tomorrow.

Link to comment
Share on other sites

Here's my target retro burn script

Somewhere near the end of it the kOS window shows "cannot cast from source type to destination type" and a few lines of telemetry get stuck on the screen.

It looks like the very last two lines:

Print "Burn complete".
sas on.

...aren't executed at all

declare parameter distoffset.

sas off.

clearscreen.

lock relativevector to (target:velocity:orbit - ship:velocity:orbit).

lock steering to relativevector.

lock tdist to target:distance.

set stopdist to (relativevector:mag^2)/(2*(maxthrust/mass)).

until tdist <= (stopdist+distoffset*10)

{

print "Approaching" at (0,0).

print "Target Velocity:" at (0,1).

print target:velocity:orbit:mag at (20,1).

print "Ship Velocity:" at (0,2).

print ship:velocity:orbit:mag at (20,2).

print "Relative Velocity:" at (0,3).

print relativevector:mag at (20,3).

print "Target Distance:" at (0,4).

print target:distance at (20,4).

}

set warp to 0.

set startmass to mass.

set stopdist to (relativevector:mag^2)/(2*(maxthrust/mass)).

until tdist <= (stopdist+distoffset)

{

print "Approaching" at (0,0).

print "Target Velocity:" at (0,1).

print target:velocity:orbit:mag at (20,1).

print "Ship Velocity:" at (0,2).

print ship:velocity:orbit:mag at (20,2).

print "Relative Velocity:" at (0,3).

print relativevector:mag at (20,3).

print "Target Distance:" at (0,4).

print target:distance at (20,4).

}

set warp to 0.

lock throttle to mass/startmass.

until relativevector:mag <= distoffset/40

{

print "Burning" at (0,0).

print "Target Velocity:" at (0,1).

print target:velocity:orbit:mag at (20,1).

print "Ship Velocity:" at (0,2).

print ship:velocity:orbit:mag at (20,2).

print "Relative Velocity:" at (0,3).

print relativevector:mag at (20,3).

print "Target Distance:" at (0,4).

print target:distance at (20,4).

}

unlock all.

set throttle to 0.

Print "Burn complete".

sas on.

It used to work fine before the ARM update...or before I installed the pre-release, whatever the cause may be.

Edited by Cpt. Kipard
Link to comment
Share on other sites

What does everyone think about removing the antenna functionality completely, unless you use Remote Tech?

I actually want to encourage more use of the antenna's long term. I would like there to be the same requirements for sending science as sending code or messages back to the terminal, esp power usage. My ideal would be to have remote tech help with networks and speed of light propagation.

Link to comment
Share on other sites

I actually want to encourage more use of the antenna's long term. I would like there to be the same requirements for sending science as sending code or messages back to the terminal, esp power usage. My ideal would be to have remote tech help with networks and speed of light propagation.

Does it have the "ELSE"? It looks from the branch history like it would, but it's not mentioned in the release report.

Link to comment
Share on other sites

I actually want to encourage more use of the antenna's long term. I would like there to be the same requirements for sending science as sending code or messages back to the terminal, esp power usage. My ideal would be to have remote tech help with networks and speed of light propagation.

Don't get me wrong. I like the idea of having to connect somewhere. I used RT2 before it became unusable, it's just that the requirements for the number and type of antennas is a little silly and contrived to me.

I think if you just kept the requirement to 1 antenna of any type, that would be enough for stock players, who only use antennas for science. It's simpler that way.

An if someone wants RT2 then the RT2 rules would apply.

Link to comment
Share on other sites

Does it have the "ELSE"? It looks from the branch history like it would, but it's not mentioned in the release report.

My bad i missed it, Added! Would you like me to include a link to some docs? i can push the changes you made live if you like?

Link to comment
Share on other sites

New pre-release v0.12.P3

new part, and bug fixes.

And some bug implementations too.

My node script now for some reason burns way too long/too much dv. Why would that be?

edit:

It looks like the new set/lock behaviour broke my script.

Either:

a) unlock all. doesn't work

or

B) set throttle to 0. doesn't work because it was locked to a function previously

or

c) both. It's likely both.

I don't like this set/lock thing. What's the point of it?

Edited by Cpt. Kipard
Link to comment
Share on other sites

@Cpt. Kipard: You are right, UNLOCK ALL is not supported due to an oversight. I just added a new issue to the project tracker so we can fix it.

On the other hand I tested the "set throttle to 0." command and it unlocks the throttle as expected.

Link to comment
Share on other sites

@Cpt. Kipard: You are right, UNLOCK ALL is not supported due to an oversight. I just added a new issue to the project tracker so we can fix it.

On the other hand I tested the "set throttle to 0." command and it unlocks the throttle as expected.

Also, UNLOCK does work with specific named variables. It's just the "ALL" that's not working. UNLOCK THROTTLE and UNLOCK STEERING work.

Link to comment
Share on other sites

Is there a way to get the stage your ship is currently in?

Also how is the CONTAINS function of LIST used? I can't find any examples. While I'm asking can ITERATOR be used specifically somehow or is it just used behind the scenes in the FOR command or something?

Edited by Xty
Link to comment
Share on other sites

KOS no longer allows accessing uninitialized variables, however it was useful when it did because then you could use it for initialization of a program.

ex. my initialization code from 0.11, this now causes an error when toggling init (or if the toggle was commented out, in the IF)


TOGGLE init. //init variable. Because there is no NOT or !=, toggle it so that if its uninitialized it becomes true, and if it is initialized it becomes false.
IF init { //if initialization hasn't been done, initialize
print "Initializing".
//do initialization code.
}
init ON.

//do normal code

Edited by Xty
Link to comment
Share on other sites

Thanks for the awesome stuff!

Seems some kerbugs in the last release v0.11.1

This code does not work for me


set isp to 0.
set Tsum to 0.
set d to 0.
list engines in dummy.
for eng in dummy {
set engTmax to eng:maxthrust.
set engISP to eng:isp.
if engISP != 0 {
set Tsum to Tsum+engTmax.
set d to d+(engTmax/engISP).
}.
}.
if d > 0 { set isp to Tsum/d. }.

looks like the engine attributes no longer available


[LOG 11:41:53.964] System.NullReferenceException: Object reference not set to an instance of an object
at kOS.Suffixed.Part.EngineValue.GetEngineFxSuffix (System.String suffixName, .ModuleEnginesFX moduleEngines) [0x00000] in <filename unknown>:0
at kOS.Suffixed.Part.EngineValue.GetSuffix (System.String suffixName) [0x00000] in <filename unknown>:0
at kOS.Expression.Expression.TryProcessStructure (kOS.Expression.Term input) [0x00000] in <filename unknown>:0
at kOS.Expression.Expression.GetValueOfTerm (kOS.Expression.Term term) [0x00000] in <filename unknown>:0
at kOS.Expression.Expression.GetValue () [0x00000] in <filename unknown>:0
at kOS.Expression.Expression.IsNull () [0x00000] in <filename unknown>:0
at kOS.Command.BasicIO.CommandPrint.Evaluate () [0x00000] in <filename unknown>:0
at kOS.Command.FlowControl.CommandBlock.Update (Single time) [0x00000] in <filename unknown>:0
at kOS.Context.ExecutionContext.Update (Single time) [0x00000] in <filename unknown>:0
at kOS.Command.FlowControl.CommandForLoop.Update (Single time) [0x00000] in <filename unknown>:0
at kOS.Context.ExecutionContext.Update (Single time) [0x00000] in <filename unknown>:0
at kOS.Interpreter.ImmediateMode.Update (Single time) [0x00000] in <filename unknown>:0

any ideas?

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...