Steven Mading

[1.8.1] kOS v1.2.1.0 : kOS Scriptable Autopilot System

Recommended Posts


Sounds like your code is completing without going through the bit you want it to do.  A couple of common issues I've messed myself up with a few times is to define the function but not actually call it, or have a bit of script to do a task but forget to put it in a loop so it just runs once and then stops.

Best thing I can advise to try and debug your problem is to put in plenty of print statements to try and work out where it's going in the code.

In general I have a common boot script that copies various other files to the KOS module and runs them, so that I don't have to modify the boot script and revert back to VAB to reload it, which sounds like what you're trying to do.

Share this post


Link to post
Share on other sites

Hi, i'm a fanatic to this game and specially to this mod, I would like this mod a bit more realistic regarding as how some telemetry is handled. Currently, you can access all information without restriction, but for instance, in real life, is impossible to know exactly where the position is or speed has, or some other telemetry reading without a direct communication to a ground station or GPS connection. Also the device must be very precise at longer distances. I would like the mod take into account this rule as option. Other realism options like precision of this reading depending of the epoch could be added, but i think it's a bit more complex.

Is it a right place to make this request?

 

Share this post


Link to post
Share on other sites
On 12/9/2019 at 8:10 AM, Albert7df said:

Hi, i'm a fanatic to this game and specially to this mod, I would like this mod a bit more realistic regarding as how some telemetry is handled. Currently, you can access all information without restriction, but for instance, in real life, is impossible to know exactly where the position is or speed has, or some other telemetry reading without a direct communication to a ground station or GPS connection. Also the device must be very precise at longer distances. I would like the mod take into account this rule as option. Other realism options like precision of this reading depending of the epoch could be added, but i think it's a bit more complex.

Is it a right place to make this request?

 

Well, noone forces you to use all the build-in accessible flight variables like altitude, airspeed etc. You are free to code your very own IMU and so on by using the data you can get from the stock in game sensor parts, would actually be quite interesting to try that.

Share this post


Link to post
Share on other sites

Are you saing to create like a wrapper around KOS in kerboscript? Many times i had think to donwload the code and make tiny modifiations to have some of this features, but the debug process is a hell, and more when it's not my code.

What IMU is?

4 minutes ago, Albert7df said:
58 minutes ago, Kartoffelkuchen said:

Well, noone forces you to use all the build-in accessible flight variables like altitude, airspeed etc. You are free to code your very own IMU and so on by using the data you can get from the stock in game sensor parts, would actually be quite interesting to try that.

Are you saing to create like a wrapper around KOS in kerboscript? Many times i had think to donwload the code and make tiny modifiations to have some of this features, but the debug process is a hell, and more when it's not my code.

What IMU is?

 

Share this post


Link to post
Share on other sites

Inertial Measurement Unit.  Basically a set of gyroscopes that can be used to measure acceleration in different directions.

https://airandspace.si.edu/collection-objects/inertial-measurement-unit-space-shuttle

kOS can access the output of science instruments you put on your vessel, so you can use the accelerometer to work out your ships acceleration.  I've done this before to estimate drag by comparing thrust, mass and acceleration, but you could use the acceleration to calculate your speed and some fancy maths to then work out your location.  

You could also use the inbuilt vector system to imitate direction radio navigation, put in some ground stations and then measure the angle between them.  Apollo also used a telescope and sextant as a backup method to update the INS, but that would be a bit trickier in KSP as you only have the planets to take bearings on rather than stars.

I personally see kOS as a higher level system and accept that other instruments/systems have already worked out my velocity and location and I'm just putting the control layer over the top, but it's a powerful system so you should be able to work out things like ship:velocity:orbit by other means.

 

Share this post


Link to post
Share on other sites
On 12/16/2019 at 4:41 AM, RizzoTheRat said:

Inertial Measurement Unit.  Basically a set of gyroscopes that can be used to measure acceleration in different directions.

https://airandspace.si.edu/collection-objects/inertial-measurement-unit-space-shuttle

kOS can access the output of science instruments you put on your vessel, so you can use the accelerometer to work out your ships acceleration.  I've done this before to estimate drag by comparing thrust, mass and acceleration, but you could use the acceleration to calculate your speed and some fancy maths to then work out your location.  

You could also use the inbuilt vector system to imitate direction radio navigation, put in some ground stations and then measure the angle between them.  Apollo also used a telescope and sextant as a backup method to update the INS, but that would be a bit trickier in KSP as you only have the planets to take bearings on rather than stars.

I personally see kOS as a higher level system and accept that other instruments/systems have already worked out my velocity and location and I'm just putting the control layer over the top, but it's a powerful system so you should be able to work out things like ship:velocity:orbit by other means.

 

The inercial system could give you acceleration and orientation of the ship (Also by some image processing of the the starts), but "following" the position and speed by integrating of those parameter is very inaccuratelly in real life, once you have the information from ground, and with no rocket propulsion also you could predict position and speed, but frecuently you need updates because the little variations of all the solar system. 

So.. i thinks for more realism a very easy patch rule could be like this: If no connetion (or not sight view) with some ground station then no position and speed are available. Also the position and speed should be given with a delay. I'm assuming the position and speed is gathered by the doopler effect on radio wave emited by the ship and  usual radars detection.  This patch is very simple to do. I'm waiting also the feature to emulate a KSC main program running on the ground and a vessel program running. I have read it's going to include in next releases. With this feature, this realism would be almost natural.

 

Edited by Albert7df
adding

Share this post


Link to post
Share on other sites

Finally flying a ship that contains two separate CPUs, one for the lifter rocket and another for the payload to be deployed. I have the naming priority setup so the probe is properly named once it is deployed, but I can't seem to access that name until the payload becomes its own ship. Is there any way a future kOS version could get at this information?

Share this post


Link to post
Share on other sites
12 hours ago, Drew Kerman said:

Finally flying a ship that contains two separate CPUs, one for the lifter rocket and another for the payload to be deployed. I have the naming priority setup so the probe is properly named once it is deployed, but I can't seem to access that name until the payload becomes its own ship. Is there any way a future kOS version could get at this information?

Have you tried to play arond with craft naming feature under command module PAW ? For each probe is possible to set specific ship name that should be preserved even after undocking. IIRC, it is stock feature and it should prevent creating random craft names after separation. It is being a while, but I think it is possible to create script in a way that use exact vessel name instead generic "SHIP".
Hope that it helps.

Share this post


Link to post
Share on other sites
3 hours ago, kcs123 said:

For each probe is possible to set specific ship name that should be preserved even after undocking. IIRC, it is stock feature and it should prevent creating random craft names after separation.

That is the naming priority that I set up. I can’t seem to reference it tho in flight

Share this post


Link to post
Share on other sites

Just a question:

How can i do the following?

Wait until surface prograde is heading 90, pitch 87, then follow pitch 3 lower than surface prograde.

 

Share this post


Link to post
Share on other sites
On 2/9/2020 at 5:50 PM, KnedlikMCPE said:

Just a question:

How can i do the following?

Wait until surface prograde is heading 90, pitch 87, then follow pitch 3 lower than surface prograde.

It'll be hard for prograde to be EXACTLY (90, 87), but heading shouldn't matter that much for 87 degrees, so I'd suggest this:

wait until vang(ship:up:vector, ship:velocity:surface) > 3.
lock steering to heading(90, 90 - vang(ship:up:vector, ship:velocity:surface) - 3).

 

Share this post


Link to post
Share on other sites
On 2/23/2020 at 5:33 PM, Kerbal007 said:

Just curious if KOS integrates with probe control room at all ?

Cheers

Yep, use this

 

Share this post


Link to post
Share on other sites

I have an annoying issue, not sure if it can be solved: some keyboard entries are not catched by the kOS terminal and toggle other screens. Most notably, since I just installed probe control coom, "c" switches camera to the control room. Or (on German Keyboard it's Alt Gr + 0) "}" toggles EVE settings. Is there a way to get around this?

Share this post


Link to post
Share on other sites
2 hours ago, infinite_monkey said:

I have an annoying issue, not sure if it can be solved: some keyboard entries are not catched by the kOS terminal and toggle other screens. Most notably, since I just installed probe control coom, "c" switches camera to the control room. Or (on German Keyboard it's Alt Gr + 0) "}" toggles EVE settings. Is there a way to get around this?

idk... "c" works ok for me... Just make sure you click on the terminal first, and make sure the terminal outline/border is lit up green?

Share this post


Link to post
Share on other sites
6 minutes ago, Stone Blue said:

idk... "c" works ok for me... Just make sure you click on the terminal first, and make sure the terminal outline/border is lit up green?

It is. It happens in the middle of typing a command, which makes it so annoying. The c issue seems to be new, might have to do with probe control room.

Share this post


Link to post
Share on other sites
11 minutes ago, infinite_monkey said:

It is. It happens in the middle of typing a command, which makes it so annoying. The c issue seems to be new, might have to do with probe control room.

hmm.. that is weird? ... does this *only* happen with PCR *open*?...

Share this post


Link to post
Share on other sites
2 minutes ago, Stone Blue said:

hmm.. that is weird? ... does this *only* happen with PCR *open*?...

No, it actually OPENS pcr. Or the EVE settings in case of "}"

Share this post


Link to post
Share on other sites
4 hours ago, infinite_monkey said:

I have an annoying issue, not sure if it can be solved: some keyboard entries are not catched by the kOS terminal and toggle other screens. Most notably, since I just installed probe control coom, "c" switches camera to the control room. Or (on German Keyboard it's Alt Gr + 0) "}" toggles EVE settings. Is there a way to get around this?

It's a known issue: https://github.com/KSP-KOS/KOS/issues/2659

The best way around it is probably to write your code outside of kOS (which is generally preferred anyway) and avoid typing in the terminal (which makes it hard to test code).

Share this post


Link to post
Share on other sites
1 hour ago, ElWanderer said:

It's a known issue: https://github.com/KSP-KOS/KOS/issues/2659

The best way around it is probably to write your code outside of kOS (which is generally preferred anyway) and avoid typing in the terminal (which makes it hard to test code).

Ah, thanks for the hint. Yes, I usually write outside of kOS, but I usually not use bootfiles until I'm done experimenting. So I have to type at least "switch to 0"... ;-) And sometimes I do just some quick checks in order to see if a formula is correct, the contents of a list...

Share this post


Link to post
Share on other sites

Has anyone know how to get position about center of mass? Thanks.
I use Ship:Altitude, but it doesn't work well.
It's about position of root part, not center of mass.

Share this post


Link to post
Share on other sites
Posted (edited)
On 3/3/2020 at 11:15 PM, infinite_monkey said:

Ah, thanks for the hint. Yes, I usually write outside of kOS, but I usually not use bootfiles until I'm done experimenting. So I have to type at least "switch to 0"... ;-) And sometimes I do just some quick checks in order to see if a formula is correct, the contents of a list...

It's been a while, but I used to have a default boot file that did only one thing: load another script from the archive that has the same name as the vessel (which of course you read from within the boot script), and run that. Everything else gets set up there, and you can safely edit that file outside the game. EDIT: If you don't want to use the ship's name, you might use the CPU's name tag.

Doesn't make the issue go away of course, but may be one less stumbling block.

Edited by Corax

Share this post


Link to post
Share on other sites
4 hours ago, Lookerksy said:

Has anyone know how to get position about center of mass? Thanks.

The way kOS handles it, vessel:position returns the center of mass. And the coordinate system is ship-centered, so for current vessel  ship:position=v(0,0,0)

Not the most obvious thing, but that's how it works

Share this post


Link to post
Share on other sites

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.