Jump to content

[1.3] kOS Scriptable Autopilot System v1.1.3.0


erendrake

Recommended Posts

Does anybody know of any script that would allow me to calculate phase-angles and/or ejection angles for transfers to other bodies?

I have been trying different approaches and I just can't seem to get anything to stick!

Any help would be much appreciated.

There is no random number generator function in kOS (yet?). If you make your own with the divide/remainder technique, you need to know that the numbers in kOS are NOT integers. They're always 64-bit floating point numbers in IEEE754 format (1 bit for sign, 11 bits for exponent, 52 bits for mantissa-after-the-1.) . That affects what sort of pseudorandom generator to use.

(It always feels a bit odd to me that I'm using Doubles as loop counters and now List indeces. It just feels *wrong* to an old programmer, but I understand the decision to make all numbers Doubles - it does make everything simpler to understand for new people.)

Link to comment
Share on other sites

There is no random number generator function in kOS (yet?). If you make your own with the divide/remainder technique, you need to know that the numbers in kOS are NOT integers. They're always 64-bit floating point numbers in IEEE754 format (1 bit for sign, 11 bits for exponent, 52 bits for mantissa-after-the-1.) . That affects what sort of pseudorandom generator to use.

(It always feels a bit odd to me that I'm using Doubles as loop counters and now List indeces. It just feels *wrong* to an old programmer, but I understand the decision to make all numbers Doubles - it does make everything simpler to understand for new people.)

I think you quoted the wrong post their.

Thought you had an answer for me and got my hopes up for a second...;.;

Link to comment
Share on other sites

Looks a bit confusing, but I guess I will need to give it a whirl :) I love the engine properties, those will enable so many nifty setups. I like that they seem based on real world measurable variables, instead of magic numbers derived from thin air. If that approach is applied to all variables I am veritably in love.

Flame-out protection, here I come.

Oh yeah, I will make a bold request right away: any chance of seperately controllable engine throttles?

Link to comment
Share on other sites

My ascent script calculates air pressure from known information about the planetary body and the current altitude. I think I'll switch it to actually looking for a barometer instrument on the vessel and reading it directly from that. Seems more appropriate.

Link to comment
Share on other sites

Oh yeah, I will make a bold request right away: any chance of seperately controllable engine throttles?

I suspect that it would first require a change to KSP itself to support this. What might work however would be access to the engine's tweakables, where the thrust output can be capped. You could make a sort of makeshift separate throttle that way by setting the throttle to max and then using the engine caps as your throttle.

Link to comment
Share on other sites

I suspect that it would first require a change to KSP itself to support this. What might work however would be access to the engine's tweakables, where the thrust output can be capped. You could make a sort of makeshift separate throttle that way by setting the throttle to max and then using the engine caps as your throttle.

Yeah, I figured that using the tweakable parameters would be easier. Personally I do not really prefer one or the other. The tweakable route might be nice, as it would probably mean all tweakables are easily accessible, though direct control is a bit more pure.

The only thing I do wonder about is compatibility with RSS, as engines in it can sometimes not be throttled, or only between maximum power and something like 70%.

Edited by Camacha
Link to comment
Share on other sites

Yeah, I figured that using the tweakable parameters would be easier. Personally I do not really prefer one or the other. The tweakable route might be nice, as it would probably mean all tweakables are easily accessible, though direct control is a bit more pure.

The only thing I do wonder about is compatibility with RSS, as engines in it can sometimes not be throttled, or only between maximum power and something like 70%.

This is exactly what i was thinking about doing. As for compatibility with RSS, i think i should be able to retrieve these values and respect them.

Link to comment
Share on other sites

Just out of curiosity, what are you using random numbers for in kOS?

Poker game? Slot machine? craps (dice) game?

I'm exploring a pathfinding script and if my rover bumps up against a building, landed vessel or mun arch then it needs to reverse and then turn a random number of degrees left/right. Just like those battery toys you played with when you were knee high. :)

Link to comment
Share on other sites

A big thanks to erendrake for his quick response to enhancement requests and the overall work on 0.11 :)

I have finished up the script sources i made while playing with 0.10 and will now switch to the 0.11 rc.

I'll hopefully be able to provide constructive feedback regarding the new 0.11 features during the next couple of days.

keep up the good work :)

regards,

kaesekuchen

Link to comment
Share on other sites

New full release v0.11

Spaceport

Changelog

- Thanks to enkido and jwvanderbeck for your help.


- BREAKING: BODY, SHIP:BODY, TARGET:BODY now all return a Body structure rather than the name of the body
- BREAKING: Removed NODE:APOAPSIS and NODE:PERIAPSIS. They are now available in NODE:ORBIT:APOAPSIS

- Basic RemoveTech Intergration
- Added VOLUME:NAME to getting the current volume
- Lists can now be populated with basic data that you can loop over or index [Full Info](/wiki/List/)
- Bodies (eg Kerbin, Mun, Duna)
- Targets - All Vessels other than current
- Engines - Engines on the craft
- Resources - All Ship Resources
- Parts - All Ship Parts (slow)
- Sensors - (eg Pres, Grav, Accel)
- Elements - All flights connected to the active vessel
- A Lot of bug fixes and refactoring
- Constants (eg G, E, PI) are now retrieved using CONSTANT() rather than spreadout.
- Commands resolve in order of descending specificity, rather than in the pseudorandom order they were in before
- Added Math operators LN, LOG10, MIN, MAX.

Edited by erendrake
Link to comment
Share on other sites

No documentation in wiki about node (broken link in manual).

Can orbit object return apoapsis/periapsis ETA?

What do you think about periapsis/apoapsis returning object, not value, like I described here:

https://github.com/Nivekk/KOS/pull/277

?

Something like that sounds great! i would do the same for something like DN/AN too. The biggest challenge I have right now is documentation and the Github wiki is not really making me happy.

The reason I mention documentation is that this could be harder for people to just know how to use.

Would you mind moving that ticket over to the new repo? I split it from Kevins so github would let us search the code in it :P

Link to comment
Share on other sites

Is there a way to make a KOS module send information to another KOS module?

It would permit to make a some sort of remote controlled ships or starting program without having to being focused on the ship.

Also, is there a way to know the orientation of a ship?

It would be very useful for maneuvers: you want to be sure that the craft is heading in the right direction before starting the burn!

Link to comment
Share on other sites

Is there a way to make a KOS module send information to another KOS module?

It would permit to make a some sort of remote controlled ships or starting program without having to being focused on the ship.

As long as you are within range, you can use a file on the archive that both vessels access. Both craft need to be loaded and running a program though, ships on rails will not run kOS programs. You can have one vessel write to a file, while another polls/listens for changes. kOS does not like a file being accessed by two instances at the same time though, so you might have to invent some mechanism to prevent simultanuously reading and writing a file. This could for instance be achieved by reading on even times (1:30:24, 1:30:26 et cetera) while the other craft writes on odd times (1:30:25, 1:30:27 et cetera). Other variations are also feasible.

Also, is there a way to know the orientation of a ship?

It would be very useful for maneuvers: you want to be sure that the craft is heading in the right direction before starting the burn!

Yes, see the facing and associated commands. You will need to translate the readings yourself though, probably using some vector math.

Link to comment
Share on other sites

Thank you!

the file writings commands will allow me to transfer a script I made on a separate craft which is too far to transmit to archive but near another ship(it happened to me yesterday and I had to rewrite the scrip,fortunately it wasn't big nor complicated)!

Link to comment
Share on other sites

When I use the Euler's angles(with r() function) to control the orientation of a craft, KOS overcompensate for roll which make my craft rolling back and forth endlessly.

Am I doing anything wrong?

Note: I typed "lock steering to r(90,0,0)."(without brackets) but it seem that the overcompensation occur regardless of the angles I use.

EDIT: I tested the same command with another ship and it seem to work. Maybe the other ship has too much torque for its size(it was the MK-1 capsule with a FL-t800 fuel tank and a LV-T45 engine.)

However, after KOS has correctly orientated the ship( I used "lock steering to r(90,0,0).", I used "facing" to know the orientation and the number printed didn't matched(it printed: "R(90,22.475,0)" ).

Edited by goldenpeach
Link to comment
Share on other sites

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