Dunbaratu Posted February 10, 2014 Share Posted February 10, 2014 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 More sharing options...
erbmur Posted February 10, 2014 Share Posted February 10, 2014 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 More sharing options...
Dunbaratu Posted February 10, 2014 Share Posted February 10, 2014 I think you quoted the wrong post their.yeah sorry I did. Link to comment Share on other sites More sharing options...
erendrake Posted February 10, 2014 Author Share Posted February 10, 2014 There is no random number generator function in kOS (yet?).Ask and you shall receive:https://github.com/erendrake/KOS/commit/2c61c0919eb68a52555a24fafb4e83f56a85be88There is a little more work to do to make it better but we should be able to use it in v0.11.1 Link to comment Share on other sites More sharing options...
Noando Posted February 10, 2014 Share Posted February 10, 2014 Hi Endrake, enkidu and jvanderbeck,I'm still testing the Prerelease 0.11.0RC and it looks very well! Thank you verry much for your create work!Greetings Noando Link to comment Share on other sites More sharing options...
Camacha Posted February 10, 2014 Share Posted February 10, 2014 Do I understand correctly that list can now actually be used? Link to comment Share on other sites More sharing options...
erendrake Posted February 10, 2014 Author Share Posted February 10, 2014 Do I understand correctly that list can now actually be used?If you are running the pre-release of v0.11 yes! I have some examples here: https://github.com/erendrake/KOS/wiki/List Link to comment Share on other sites More sharing options...
Camacha Posted February 10, 2014 Share Posted February 10, 2014 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 More sharing options...
Dunbaratu Posted February 10, 2014 Share Posted February 10, 2014 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 More sharing options...
Dunbaratu Posted February 10, 2014 Share Posted February 10, 2014 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 More sharing options...
Camacha Posted February 11, 2014 Share Posted February 11, 2014 (edited) 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 February 11, 2014 by Camacha Link to comment Share on other sites More sharing options...
erendrake Posted February 11, 2014 Author Share Posted February 11, 2014 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 More sharing options...
togfox Posted February 11, 2014 Share Posted February 11, 2014 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 More sharing options...
kaesekuchen Posted February 11, 2014 Share Posted February 11, 2014 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 More sharing options...
erendrake Posted February 13, 2014 Author Share Posted February 13, 2014 (edited) New full release v0.11SpaceportChangelog- 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 February 13, 2014 by erendrake Link to comment Share on other sites More sharing options...
togfox Posted February 13, 2014 Share Posted February 13, 2014 Random ()?Thanks. Nice work. Link to comment Share on other sites More sharing options...
adammada Posted February 13, 2014 Share Posted February 13, 2014 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 ? Link to comment Share on other sites More sharing options...
erendrake Posted February 13, 2014 Author Share Posted February 13, 2014 Random ()?Thanks. Nice work.you are welcome, most of the time i try to lock new features so close to a release but it was so small that i even forgot to add it to the notes Link to comment Share on other sites More sharing options...
erendrake Posted February 13, 2014 Author Share Posted February 13, 2014 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 Link to comment Share on other sites More sharing options...
goldenpeach Posted February 13, 2014 Share Posted February 13, 2014 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 More sharing options...
Camacha Posted February 14, 2014 Share Posted February 14, 2014 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 More sharing options...
goldenpeach Posted February 14, 2014 Share Posted February 14, 2014 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 More sharing options...
togfox Posted February 14, 2014 Share Posted February 14, 2014 So is there a random function now and how would I use it. Do you mean it is in the release or it is not?random(min, max)rnd()rand()Cheers n beers. Since its Friday, especially beers ... Link to comment Share on other sites More sharing options...
goldenpeach Posted February 14, 2014 Share Posted February 14, 2014 (edited) 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 February 14, 2014 by goldenpeach Link to comment Share on other sites More sharing options...
whaaw Posted February 14, 2014 Share Posted February 14, 2014 i use "lock steering to up +r(x,x,x)." works fine for me Link to comment Share on other sites More sharing options...
Recommended Posts