Jump to content

[1.3] kOS Scriptable Autopilot System v1.1.3.0


erendrake

Recommended Posts

On the topic of utilizing the list parts feature... is it possible to access the tweakable values of the parts? I.e. the thrust limiter setting of engines, or deployment altitude / pressure of parachutes?

That'd be really really helpful :)

Link to comment
Share on other sites

[...]

Thanks for the clarifications. I kinda gave up on getting a roll angle and just used the heading to control roll as well as yaw. I can now lock heading and height (which is awesome :P). I thought about changing my program so that I pass altitude and heading as parameters but that wouldn't work with the heading for roll control aporach...


set setalt to ship:altitude.

clearscreen.
print "| Locking Course and Altitude! |".
print "--------------------------------------------------".
print "| set course : set alt : |".
print "| |".
print "| pitch input: |".
print "| yaw input : |".
print "| roll input : |".
print "| |".
print "--------------------------------------------------".

print round(setcourse ,3) at (15,2).
print round(setalt ,3) at (35,2).

until 0 {
set currentcourse to mod(360-ship:bearing,360).
set currentalt to ship:altitude.

set deltacourse to setcourse - currentcourse.
if abs(deltacourse) > 180 {
set deltacourse to (mod(setcourse+180, 360) - mod(currentcourse+180, 360)).
}.


if (abs(deltacourse) > 0.5) {
set deltacourse to (deltacourse / abs(deltacourse)) * 0.5.
}.

set deltaalt to setalt - currentalt.

set dp to (0.2 * (deltaalt / 10)) - (0.1 * ((verticalspeed / 10))).
set dy to (0.2 * (deltacourse / 5 )).

set ship:control:mainthrottle to 0.33.
set ship:control:pitch to dp.
set ship:control:roll to dy.
set ship:control:yaw to dy.

if (dp < 0) { print "-" at (15,4). } else { print " " at (15,4). }.
if (dy < 0) { print "-" at (15,5). } else { print " " at (15,5). }.
if (dy < 0) { print "-" at (15,6). } else { print " " at (15,6). }.
print round(abs(dp),3) at (16,4).
print round(abs(dy),3) at (16,5).
print round(abs(dy),3) at (16,6).

wait 0.01.
}.
set setcourse to mod(360-ship:bearing,360).

Is my way of getting the heading (set hdg to mod(360-ship:bearing,360). ) the correct way? It seems a bit weird, but nothing else seemed to work...

Link to comment
Share on other sites

On the topic of utilizing the list parts feature... is it possible to access the tweakable values of the parts? I.e. the thrust limiter setting of engines, or deployment altitude / pressure of parachutes?

That'd be really really helpful :)

you cant get to all tweakables right now. However, you can set the thrustlimit on engines

Link to comment
Share on other sites

Thanks for the clarification erendrake.

Have you thought about a RasterPropMonitor integration for kOS? That would be really really immersive :)

I have thought about it a lot. it would be a pretty cool experience! its not on the roadmap yet but it should be :)

Link to comment
Share on other sites

RPM support would put this onto a whole new level... Just to be clear though, are we talking the whole thing with entering code and everything (no more console window) or just having programs send output to an RPM panel instead of the console and being able to listen for the button presses from the panels? First would be cool, but I'd probably be just as happy with the second...

Link to comment
Share on other sites

Getting rid of the free floating console would be great IF and only IF RPM is installed AND you're in a manned capsule. You'd still need the floating console we have now for unmanned probes. But yeah when in IVA I like to hit F2 and fly with only what's there so having the console as a whole on one of the monitors would be great.

The Kerbal Space Industries MFD mod on top of RPM already has integration for SCANSat, VesselView and Mechjeb so I guess it might be quite feasible actually to adapt the kOS console to that. Not sure about the original RPM mod as I hardly used the interface from there.

Link to comment
Share on other sites

Pretty pleeease ;)

But seriously, I know you guys are busy finishing for the next release, no rush :)

Its never too early to talk about sweet features.

RPM support would put this onto a whole new level... Just to be clear though, are we talking the whole thing with entering code and everything (no more console window) or just having programs send output to an RPM panel instead of the console and being able to listen for the button presses from the panels? First would be cool, but I'd probably be just as happy with the second...

It would be nice to have a few views, a terminal, a file manager/runner and the editor. You would switch between with IVA buttons maybe? as for listening to other buttons in the cockpit. One thing at a time :)

Link to comment
Share on other sites

Sounds similar to the problem I bumped into a couple pages ago in this thread. I'm guessing you're running Module Manager, and you're adding kOS processors to all your command modules so you don't need to slap kOS parts on all your stuff. That's what I did to get the problem you described. As it turns out kOS 12.0 and newer broke compatibility with Module Manager.

The solutions are either to:

  1. Avoid adding kOS features to command modules via module manager and use only the kOS parts on all your ships, or…
  2. Roll back to kOS version 0.11. kOS 0.11 is still compatible with Module Manager.

I did the latter because I have too many craft in flight that can't do without it. So until the Module Manager bug is fixed, I'll be using kOS 0.11, despite really wanting to use the new one.

I made that change (adding kOS capabilities to vanilla command modules) so long ago that I forgot I'd even done it. Largely because I use FAR, and it's a real pain to work in additional parts when aerodynamic drag is such a huge concern.

I'm going to undo that change and test to see how it works.

UPDATE: Yup, that fixed it. Conclusion: If you're having the bug where only the command module appears when you revert to the runway, and you modded the mod to add computer capabilities to the capsule, undo that mod.

Edited by S.O.P.H.I.A.
Link to comment
Share on other sites

I'm having a bit of an issue in 12.2P1. For some reason, this block of code:

until ABORT{
print "testing".
set ship:control:pitch to 1.
}.
ABORT off.

is locking the throttle to 0, despite not actually mentioning throttle in the code. Manual controls and "Lock throttle to x" are having no effect.

EDIT: Figured it out. It looks like when you set a control, you also have to set SHIP:CONTROL:MAINTHROTTLE if you don't want the throttle to cut.

Edited by S.O.P.H.I.A.
Link to comment
Share on other sites

Hey, I've got another question. This time it's more of a math question really but it is related to the kOS Documentation so I post here.

On the page explaining vectors (here), it says:

VECTOREXCLUDE(VA,VB) or VXCL(VA,VB) a vector, VA with all of VB excluded from it.

In other words, the projection of VA onto the plane that is normal to VB.

Maybe I'm wrong about projections but I played around with the new vector draw thingy and it seems to me it is the other way around. VB is projected onto the plane that is normal to VA. Bug or typo, that's the question :D

I don't know who's right, never heard of no vector exclude in my life :P

Edit: Here's a picture:

yaUF3XQl.png

So if that's not projected into the plane normal to z I don't know what projection or normal mean. Which could be...

Edited by the_bT
image reasons
Link to comment
Share on other sites

Hey, I've got another question. This time it's more of a math question really but it is related to the kOS Documentation so I post here.

On the page explaining vectors (here), it says:

Maybe I'm wrong about projections but I played around with the new vector draw thingy and it seems to me it is the other way around. VB is projected onto the plane that is normal to VA. Bug or typo, that's the question :D

I don't know who's right, never heard of no vector exclude in my life :P

it is a funny bit of code that comes from unity it is used often in combination with another vector (often up) to project the vectors on the plane with the other vector as a normal.

Link to comment
Share on other sites

So bottom line it works like it should and there is a type in the docs.

I've fixed the docs, reversing "VA" and "VB", but it's not published yet as there's other changes I don't want to publish until the next release mixed in with it.

The markdown processing system used in the docs is a bit annoying in how it dictates explicit names of git branches you must use, thereby making it hard for me to make a branch in which to edit future doc changes that are unreleased yet. I sort of have to edit them all in one big pile. I may have to resort to using full forks for what you're supposed to be able to use just branches for.

But at any rate, that's my problem to deal with. The important thing is that I took note of the error in the docs and the next time they're released it will be fixed. Thanks for pointing it out.

EDIT: Oh, and I'm glad you're making use of vecdraw. When it was added I was afraid from the lack of responses that maybe it just wasn't useful and people didn't want to bother with it.

Edited by Steven Mading
Link to comment
Share on other sites

I've fixed the docs, reversing "VA" and "VB", but it's not published yet as there's other changes I don't want to publish until the next release mixed in with it.

The markdown processing system used in the docs is a bit annoying in how it dictates explicit names of git branches you must use, thereby making it hard for me to make a branch in which to edit future doc changes that are unreleased yet. I sort of have to edit them all in one big pile. I may have to resort to using full forks for what you're supposed to be able to use just branches for.

But at any rate, that's my problem to deal with. The important thing is that I took note of the error in the docs and the next time they're released it will be fixed. Thanks for pointing it out.

EDIT: Oh, and I'm glad you're making use of vecdraw. When it was added I was afraid from the lack of responses that maybe it just wasn't useful and people didn't want to bother with it.

Yeah it's a small error in the docs so no sweat. As long as it gets fixed some time it will be fine.

I must confess when I saw the video on vecdraw I was kinda having mixed feelings about it because it doesn't really fit with the idea of 60s terminal computers and all that.

But its usefulness outweigh that flaw by several orders of magnitude. Doubly so as long as you have to convert vectors manually between coordinate systems. So let me be among the first to respond and thank you for this fine piece of code and your work on the project in general. :D

Link to comment
Share on other sites

Anyone knows a way/mod to display a latitude/longitude grid on a planet or moon?

Or to have an enhanced mouse cursor that displays latitude/longitude next to the mouse cursor?

I am looking for a way to visually select latitude/longitude of a landing zone for my lander.

Link to comment
Share on other sites

Hi, I have problems with this mod.

First, if I do RUN LAUNCH. it will respond "file 'launch' not found", unless I do SWITCH TO 0. before. (and the archive's location is correct).

Next, this is my launch.txt program, and when I run it, it only does the staging, the throttle and steering lines are like ignored.

lock throttle to 1.
lock steering to up + R(0,0,180).
stage.

Thank you for your help.

Link to comment
Share on other sites

Yes, that is all correct. The game will not find your script as its on the archive volume/drive and not the one on your craft. If you want to take it along on your craft, you will need to copy it first. Remember that every craft has its own drive and that you will need to copy your files there if you want to take them to space.

It is not possible for me to test the code right now, so there might be some small mistakes in there.


switch to 0.
copy launch to 1.
switch to 1.
run launch.

Your commands are not ignored, but the programs ends immediately after issuing them, unlocking all locks. To prevent this, add some more code. One option is:


wait 10.

Another option is


until altitude > 10000 {}.

Any code that will prevent the script from ending will do.

Edited by Camacha
Link to comment
Share on other sites

I understand, all right, thank you :) .

Is there a good tutorial for this mod? I mean for beginners, who never programmed before?

If you want to take it along on your craft, you will need to copy it first.

How?

Edited by Tom Robin
Link to comment
Share on other sites

How?

Either the way Camacha wrote (first code block in his reply) or with


copy launch from 0.

this will copy your program "launch" from the archive to your current volume. (On startup normaly the internal volume of your kOS module)

IIRC you need some antennas to be able to access the archive after launch. Which antenna and how much of them depends on the distance to kerbin. With the file copied to your internal volume you will not run into the problem of not beeing able to access your program.

Link to comment
Share on other sites

MechJeb used to have a way to select a landing point just by clicking the planet while in map view, and I think that it also showed the coordinates of the selected point.

I've fiddled with enough of KSP's gui and map view systems when implementing the text editor and the vecdraw that I think I'd know how to go about implementing this if it's desired. I'm sort of stuck in the middle of a bigger project with erendrake right now, but it is potentially possible down the road.

(Obviously I don't mean just lading for you like Mechjeb, that would defeat the purpose of kOS. I mean just having a way to print out the lat/long position of the click so you could take that information and do what you like with it. It may also be possible to turn the click into a position Vector inside kOS, like so:


SET LOC TO GETSURFACECLICK.
PRINT "YOU CLICKED AT LAT=" + LOC:LATLNG:LAT + " LNG=" + LOC:LATLNG:LNG + ".".
PRINT "WHICH IS " + LOC:VEC:MAG " + meters away from your ship right now.".

That's just a pie-in-the-sky idea. Generally, methods of getting runtime input from the user will probably have to be the focus of a future update at some point, and it would make sense to revisit this idea then.

)

Edited by Steven Mading
Link to comment
Share on other sites

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