Jump to content

kOS Autopilot


erendrake

Recommended Posts

So, I have hatched a scheme. This would be the part where you tremble and run for cover.

I have considering a couple of approaches for doing new models, and feel that a modular approach would probably be best. It will take a little more doing, but it is closest to what KSP tries to do and would add more depth to the kOS experience (even though you added quite a bit of that by enabling career limitations in the last update). I was thinking of having something along the lines of three kOS units, small, medium and large, with various properties and mounting options. Those could all be scattered nicely across the career tree and the combinations would amount to a nice set of parts.

What I am not too sure of though, is how modular this needs to be. As this might result in some work on the plugin front, I though that I might consult you guys. It could be as simple as a computer part and mounting part (no extra coding required), or you could expand this and actually have people pick a certain CPU (speed) along with a hard drive (disk size) option, and maybe even more. As cool as I think this is, it is a bit more complicated and might result in an even higher entry fee for newcomers. I am not sure people want to deal with that when they just want to run kOS and it might cause problems because of the wildly varying performance of the computers that people have at home.

What do you guys think?

I've been thinking about interesting ways to have lower tech CPUS that run slower, but the above problem would have to be addressed first. As it is already, not everyone is *really* getting the same speeds out of their kOS CPUs.

I have experimented with speeds, but had not realized this. It might be fine as it is, though that really depends on the overall approach.

Edited by Camacha
Link to comment
Share on other sites

I agree that it's ridiculous. It's been largely left alone for now because a future goal is to make multiple sized storage units and until that infrastrucure is in place any changes made now would just have to be changed again later.

Can you comment on your view on this? :)

Link to comment
Share on other sites

  • 5 weeks later...

I'm new to this so please bear with me. I have tested KOS and IR together. Part naming works in editor.

I have skimmed through the docs and got a few results. There is a lot of ground to cover in short time and i will post when i have something more to say than "omg it's broken!". :)

Questions : Will there be a version of terminal window that can scroll through few pages of prints ? Since i'm new to KOS i'm exploring what can be activated and read data back. When i want to review all parts on my test "craft", the printout is quite long.

On a side note : Will there be some kind of TAB key activated code-completion ? Something like typing "SHIP:" and then get a suffixes that are applicable to SHIP, each TAB key press cycles to next valid suffix. Also i do not expect it to work on variables, that would be too much to ask.

Examples for above :


SHIP: [TAB key gives PARTSTAGGED, PARTSNAMED, ... etc]
SHIP:PARTSTAGGED("ROTATRON")[0]: [TAB key gives ALLMODULES, GETMODULE, ... etc]
SHIP:PARTSTAGGED("ROTATRON")[0]:GETMODULE("MuMechToggle"): [TAB key gives ALLEVENTS, DOEVENT, ALLACTIONS, DOACTION, ALLFIELDS, GETFIELD, ... etc]

Ohh yes another one : Is it possible to determine if a part has a indirect parent of specific name ? Important when for example you have a vessel docked to a automated space station and want to act only on parts that belong to that space station (like lights, fuel transfers, electrical subsystems etc) and not touching anything that belongs to a docked vessel ?

Which also brings up one more question : If an arbitrarily constructed vessel docks to a space station, its docking port may not be the root part (chance is that some remote guidance unit or manned cockpit are root parts), so trying to determine root part would not yield correct relationships. Is there some kind of event or method to detect newly docked vessel / subsection to help maintain control hierarchy of the station ?

Edited by fatcargo
Link to comment
Share on other sites

v0.16.0 - Remote Terminal Access

BREAKING

  • Body:ANGULARVEL is now a Vector instead of a Direction. (This is the same as the change that was done to Vessel:ANGULARVEL in v0.15.4, but we missed the fact that Body had the same problem). It was pretty useless before so this shouldn't hurt many scripters :)
  • Both Body:ANGULARVEL and Vessel:ANGULARVEL now are expressed in the same SHIP_RAW coordinate system as everything else in kOS, rather than in their own private weirdly mirrored reference frame. (Thanks to forum user @thegreatgonz for finding the problem and the fix)
  • #536 the 1.5m kOS part has always had trouble with clipping into other parts due to the rim of the cylinder sticking up past the attachment points. The part definition has been changed to fix this, but in KSP new part definitions don't affect vessels that have already been built or have already had their design saved in a craft file in the VAB/SPH. To see the fix you'll need to start a new vessel design from scratch, otherwise you'll still have the old clipping behavior.

New Features

  • TELNET SERVER. The biggest new feature this update is the introduction of a telnet serveryou can use to access the terminals in game. For security, it's turned off by default, but you can enable it with the config radio button. Full documentation on this new feature is athttp://ksp-kos.github.io/KOS_DOC/general/telnet.html
    • Synopsis:
      • Telnet to 127.0.0.1, port 5410
      • Select CPU from welcome menu by typing a number and hitting Return.
      • Your telnet client is now a clone of that CPU's terminal window and can control it.
      • If you want to open it up to others to use (i.e. controlling your KSP game from a second computer), you can use an ssh tunnel to access the local loopback address, or if you just want to throw caution to the wind, you can tell it to stop using loopback and use your real IP address. Be aware of the security risk if you choose this.

    [*]Added HUDTEXT that lets you add text to the screen. Thanks @pgodd !

    [*]#72 - Added STAGE:NUMBER and STAGE:READY to allow for staging very close together

    [*]#522 - Added BODY:GEOPOSITIONOF and BODY:ALTITUDEOF for getting body-relative info about a 3D point in space.

    [*]#524 and #523 - mission waypoints now have 3d positions

    [*]In game Terminal is now resizable! From a script with SET TERMINAL:WIDTH and SET TERMINAL:HEIGHT, or from dragging the lower-right corner of the GUI window.

Bug Fixes

  • Fixes #389 - LOCK STEERING broken for RCS-only (no torque) ships.
  • Fixes #516 - kOSTags are now applied in the correct MM pass
  • Fixes #541 - All BODY: suffixes should now work properly when the body is the Sun without crashing.
  • Fixes #544 - Terminal subbuffer won't shrink when up-arrowing to a previous smaller command.
  • Fixes #548 - If SHIP is not the same as ActiveVessel, then executing STAGE stages the wrong vessel.
  • Fixes #581 - SHIP:CONTROL:PILOTFORE and SHIP:CONTROL:PILOTSTARBOARD are no longer inverted.
  • Fixes #578 - renamed our use of RemoteTech2 to RemoteTech to follow their new naming.
  • Fixes #427 - Stack now clears when interactive commands throw exceptions. (no longer reports false stack traces).
  • Fixes #409 - Delete no longer leaves file in memory.
  • Fixes #172 - Lock states no longer persist through power cycling unit. Now they become default for unlocked state

    [*]Fixes #580 - RT "signal lost. waiting to re-aquire signal" check previously disallowed manned terminal use. Now it only disables the terminal if the vessel is unmanned.

    [*]Fixes #344 - KOSArgumentMismatchException reported wrong arg number (i.e. it would claim your 3rd argument is wrong when it's really your 1st argument). Fixed.

Link to comment
Share on other sites

Github is a bit of a mystery to me, there was a bug KOS/issues/555 that appears to be fixed but isn't in the list above. You might be able to tell me in less time than it takes me to try it myself :) Oh, and thanks for the time you people are spending on this - it keeps getting better.

Edit - it seems to be fixed, thankyou :)

Edited by Darren9
Link to comment
Share on other sites

Github is a bit of a mystery to me, there was a bug KOS/issues/555 that appears to be fixed but isn't in the list above.

The changelog list is built manually by one of us eyeballing the list of recent closed issues and typing them into the list, so it was just missed that's all. There doesn't seem to be a built-in facility for building a changelog automatically that way, we have to do it by eyeball.

Link to comment
Share on other sites

  • 1 month later...

Hi guys

I'm writing some code to modelling an orbits in game. To calculate flight plans, to optimize the routines, etc...

I faced with some difficulties with the LAN calculation.

Seems everything is ok but the LAN value doesn't match with the KOS/MJ LAN value.

Please, take a look at the screenshot:

http://postimg.org/image/kq6so2pv9/

The ascending node is exact. It is 121 degrees. I have checked it by moving origin at Kerbin.

And it matched with the AN by time given by MJ and visually when passing equator.

We can see the AN vector lies left of Z-axis.

It means the calculated value is near to be true because it must be greater than 90 (the X-axis is pale red).

But the LAN displayed in the window of the orbit info is 21 degrees. And the LAN given by KSP is 21 degrees.

I guess this issue is linked with something like a vector of vernal equinox, right?

Any advices how to fix the calculated LAN.

It is just needed because I'll make my own orbits from existing ingame orbits to use it.

And the LAN will be a problem if just copy it.

Thanks.

Link to comment
Share on other sites

  • 2 weeks later...

First off THANK YOU for keeping KOS alive.

I am trying to create a T+ launch time variable that I can trigger events (like if T+ = 00:01:30, then { // do something} ). I found the TIME system variable but it holds the overall game time since I put my first ship in the air, and the timespan structure that I have not had much success in using. Is there already a T+ timer built in, as it does already show in the top-right of the KSP launch window, it would be very cool to tap that.

Thanks

Link to comment
Share on other sites

First off THANK YOU for keeping KOS alive.

I am trying to create a T+ launch time variable that I can trigger events (like if T+ = 00:01:30, then { // do something} ). I found the TIME system variable but it holds the overall game time since I put my first ship in the air, and the timespan structure that I have not had much success in using. Is there already a T+ timer built in, as it does already show in the top-right of the KSP launch window, it would be very cool to tap that.

Thanks

Well, I came up with my own little function to do this.


function plusTime {

set tplus to time.

when 0=0 then {
set tplus1 to time - tplus.
print tplus1 +"+Sec." at (20,20).
preserve.
}
}

run plusTime().

It only displays seconds, but I really dont need it to display the time. All i need is to keep time during the launch script so I can print some telemetry data at certain intervals.

Edited by roosterr
Link to comment
Share on other sites

Well, I came up with my own little function to do this.


function plusTime {

set tplus to time.

when 0=0 then {
set tplus1 to time - tplus.
print tplus1 +"+Sec." at (20,20).
preserve.
}
}

run plusTime().

It only displays seconds, but I really dont need it to display the time. All i need is to keep time during the launch script so I can print some telemetry data at certain intervals.

AND to answer my own question, I did finally find what I was looking for: "MISSIONTIME", round(missiontime) will do it all for me or anyone else wondering. Oh well, building my own Time+ script was fun too. :cool:

Link to comment
Share on other sites

  • 4 weeks later...

Hi guys!

I'm trying to script some automatic stage reenter, but I've a little problem: after the decouple of the main stage, the script execution doesn't works anymore.

This is my rocket:

E = Engine

K = Kos

P = Probe

D = Decoupler

C = Manned Capsule

E - P - K - D - E - C

I run my script before decouple, (I'm using a simple "WAIT 20." that let me to decouple and move to a safe place). I can see the print statements in the terminal, but the detached stage didn't move or change throttle. I'm using RemoteTech and Kos with RT integration, BTW I think is the decoupling who make crazy Kos.

It is a bug? It is a normal behaviour?

Edited by Kbyte
Link to comment
Share on other sites

I'ts something like this (I'm out now but I can remember the original script :P):


PRINT "Start procedure".
WAIT 60.
PRINT "Lock to retrograde".
LOCK STEERING TO SHIP:RETROGRADE.
WAIT 60.
PRINT "Engines on".
LOCK THROTTLE TO 0.8.
UNTIL SHIP:PERIAPSIS > 20000 {
WAIT 1.
}
PRINT "Shutdown".
LOCK THROTTLE TO 0.0.
WAIT 10.
SHUTDOWN.

The capsule have got an antenna, but the stage not. I expect Kos to keep execute commands without any antenna attached to the probe because I start the script before the decouple. I can't try if an antenna also on detached stage could avoid this atm.

Edited by Kbyte
Link to comment
Share on other sites

question regarding this image:

n0f1jNt.png

You can see on the right-click menu I have three science experiments - "Collect Data", "Collect Samples" and "Telemetry Report". When I query the Avionics Package for modules I get three "ModuleScienceExperiment" modules. So far so good, but when I go and try to check out the events for the 3 modules they all come back with "Collect Data". Activating them all individually with doAction() just runs the same experiment three times.

So I can only assume that the same module is being returned. How do I differentiate between modules of the same name? It mentions in the docs that modules can have the same name but I couldn't find anything on what to do about accessing different modules with the same name

Link to comment
Share on other sites

Hey guys,

I just stumbled across this mod and have to say I am extremely excited to have found it. As an undergrad software engineer I think I will have an absolute blast coding up ships with specific mission objectives. I would even like to contribute to the making of the mod at some time in the future (after I have had a bit more of an in depth look at it).

The one thing I can't seem to find information on though is how ships with a computer and scripts on board react when you are not focused on them? Will they continue to run their scripts properly if you are off doing something else (like another mission etc.)?

What if you time warp? Say I have an automated rover on the mun and while it roams around I am doing some other mission which requires me to time warp, will the rover script be run while I am time warping?

Another thing that just occurred to me as I was typing is what happens when the ship runs out of electrical charge? Will the script running at the time pick back up where it left off from the same line in the script where it stopped? Will it start over again? Will I need to intervene in some way?

I know these seem like basic questions but I have not been able to find any answers in my fishing around as yet. I am extremely keen to get some automated missions done with this thing!

Link to comment
Share on other sites

Hey,

It's best to ask here: [1.0] kOS Scriptable Autopilot System v0.17.2 2015/4/28

As for your questions:

1) Ships not in physics range cannot run scripts

2) Timewarping works fine as long as you stay focused on the ship running scripts and you can control the rate of the warp via script as well

3) Running out of power resets your computer so it will not continue running from the same line, but will start from clean when you get your power up, unless you have a devilishly clever boot script.

Link to comment
Share on other sites

Thanks - I will post any further questions I have in the thread you mentioned.

However as a quick follow-up question - I assume this means that #3 applies to #2 as well? What I mean by this is if I switch away from a craft (out of physics range) and switch back, it will reset the computer in the same way and start running the script from the beginning again?

It's a bit of a shame (although understandable) that you need to be focused on a ship for it to run scripts. It rules out the possibility of leaving automated rovers on bodies to collect science etc. while you do other things. Because rovers are so slow it would be a bit of a pain to have to just watch an automated rover explore a planet (although I guess you could just timewarp through it but it makes it a bit less fun in my opinion).

Either way I am extremely keen to start playing with this mod!

Link to comment
Share on other sites

Thanks - I will post any further questions I have in the thread you mentioned.

However as a quick follow-up question - I assume this means that #3 applies to #2 as well? What I mean by this is if I switch away from a craft (out of physics range) and switch back, it will reset the computer in the same way and start running the script from the beginning again?

It's a bit of a shame (although understandable) that you need to be focused on a ship for it to run scripts. It rules out the possibility of leaving automated rovers on bodies to collect science etc. while you do other things. Because rovers are so slow it would be a bit of a pain to have to just watch an automated rover explore a planet (although I guess you could just timewarp through it but it makes it a bit less fun in my opinion).

Either way I am extremely keen to start playing with this mod!

Unfortunately it is not possible in KSP. But as you stated you can leave your rover script running and do 4x timewarp.

And the answer to your follow-up question is Yes, the computer will reset. It might change in the future, but it is quite hard to implement and even harder to debug.

Link to comment
Share on other sites

...I know these seem like basic questions but I have not been able to find any answers in my fishing around as yet. .....

Use the sub reddit page here: https://www.reddit.com/r/kos

It seems more active than the KSP forum for KOS.

- - - Updated - - -

Use the sub reddit page here: https://www.reddit.com/r/kos

It seems more active than the KSP forum for KOS.

Well, I take some of that back. Although the sub reddit page is a great place, and the devs are very active there as well, I did not know until I saw the link posted above by ZIW that there is another KOS thread on the KSP forums for v.17.2, and it appears to be very active, which is great. Although the reddit page is broken down into a more organized system for answering questions.

Link to comment
Share on other sites

I can confirm that the reddit page has become more active. I'm not sure as to the social reasons for it, but it seems the only thing holding it back for so long was the lack of a reddit mod. It was set up by a user who then abandoned reddit and went inactive. For over a year it was impossible to get its stale links fixed because nobody else was allowed to edit the sidebar for it and the one with permission was gone. Once someone came along who knew reddit better and knew how to contact some reddit ops to get the situation rectified and a new person to become the mod (TheGreatFez), then the reddit group slowly started becoming more active than the forum thread here.

I suspect it's because the format here only expects you to have one thread per mod, and that's a less useful way to organize the questions people are asking and the help they're getting.

Link to comment
Share on other sites

I come across with this thread by accident. It might be good to have link for all threads related to kOS somewhere in OP in main kOS thread forums.

Also it is good for you folks who maintain kOS to put some usefull links in signature. When someone does not read OP so often and does not notice changes in OP, he could notice some most relevant stuff in your signature.

Especialy when you answer to someones question in any forum related to kOS.

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Hi All :)

I'm playing with Kos from some days, and i don't understand why i didn't try this excellent tool before !!!

I'm working on a Kos script to optimise my Eve SSTO ascent, but i didn't found a way to get the actual maxtemp of the ship in Kos to control throttle to have the maximum possible twr without exploding...

Is there a way to get that information ?

Fly safe with Val :)

Link to comment
Share on other sites

I've found some very strange behaviour with rotation multiplication.

it appeared when I was testing the following code for launch algorythm.

lock steering to up +R(0, 0, (90+Azimuth))*R(0, 90-AscentProfile(), 0).

(if you just sum the rotations, it still pitches east, no matter the azimuth)

It turned out to work OK up to the moment the pitch angle approaches 0. Then something strange happens.

Here's the demonstration of how this vector behaves (the craft is in near-polar orbit):

P.S.

A small documentation issue:

Body:ANGULARVEL

Despite the name, this is technically not a velocity. It only tells you the axis of rotation, not the speed of rotation around that axis.

Apparently, now it shows the angular velocity in rad/s. (that is 1/body:angularvel:mag*2*pi=body:rotationperiod)

Edited by Alchemist
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...