ettieapple Posted October 13, 2013 Share Posted October 13, 2013 It's not exactly what i was looking for. Still, thanks for your quick answer. Link to comment Share on other sites More sharing options...
slin3 Posted October 13, 2013 Share Posted October 13, 2013 (edited) so I'm having some serious problems with this mod. first of all the game still takes my commands when I write in the kOS interface so when I press space it will stage.second problem: I write this very simple program: lock throttle to 1.It doesn't work. The throttle stays at 0. If I make the program like this: lock throttle to 1. stage.It will stage but the throttle still won't move. Really strange. Is this a bug? did I make a mistake with the syntax?mabye I should add that I'm using kOS 0.84 and the newest version of KSP 0.21.something. Edited October 14, 2013 by slin3 Link to comment Share on other sites More sharing options...
Sma Posted October 14, 2013 Share Posted October 14, 2013 (edited) so I'm having some serious problems with this mod. first of all the game still takes my commands when I write in the kOS interface so when I press space it will stage.second problem: I write this very simple program: lock throttle to 1.It doesn't work. The throttle stays at 0. If I make the program like this: lock throttle to 1. stage.It will stage but the throttle still won't move. Really strange. Is this a bug? did I make a mistake with the syntax?mabye I should add that I'm using kOS 0.84 and the newest version of KSP 0.21.something.For your first problem, it sounds like you are using Remotech. Second yes, it's a bug (one that has been brought up multiple times pages ago), although I'm pretty sure lock throttle was working in 0.84, but other things weren't. If possible the best version to use currently is 0.7 if you have it or can find it. Bizz has a link to past versions somewhere. Edited October 14, 2013 by Sma Link to comment Share on other sites More sharing options...
Bizz Keryear Posted October 14, 2013 Share Posted October 14, 2013 For your first problem, it sounds like you are using Remotech. Second yes, it's a bug (one that has been brought up multiple times pages ago), although I'm pretty sure lock throttle was working in 0.84, but other things weren't. If possible the best version to use currently is 0.7 if you have it or can find it. Bizz has a link to past versions somewhere.Link is in the wiki on the issues page Link to comment Share on other sites More sharing options...
willow Posted October 14, 2013 Share Posted October 14, 2013 Could kOS implement Vector math. Additions and subtractions at least. Multiplications dot and cross products would be nice, but there's a lot you can do without them.I'd like to do mechjeb style node calculations. Like a circularization node, a hoffman transfer, a planetary transfer, and some functions helpfull in landing. I imagine if the vector math is implemented properly we could achieve those things in scripts. We'll still have to see how the thing performs, after all, it's an emulated script, but it should at least be doable. Link to comment Share on other sites More sharing options...
Payload Posted October 14, 2013 Share Posted October 14, 2013 Could kOS implement Vector math. Additions and subtractions at least. Multiplications dot and cross products would be nice, but there's a lot you can do without them.I'd like to do mechjeb style node calculations. Like a circularization node, a hoffman transfer, a planetary transfer, and some functions helpfull in landing. I imagine if the vector math is implemented properly we could achieve those things in scripts. We'll still have to see how the thing performs, after all, it's an emulated script, but it should at least be doable.You already can.Example. Lets say we have vector notation V(x,y,z). You can decimate that vector and preform mathematical computation like so.Name the vector notation. In the case of those vectors that are provided by kOS, say velocity:surface, you would do something like this.set SurfVel to velocity:surface.Now you have access to those vector elements via.SurfVel:xSurfVel:ySurfVel:zEuler rotations can be decimated in a similar way. The only reason we renamed velocity:surface is because it's name by default already has a colon in it.If you are dealing with Euler rotation you can decimate in the same way.Prograde is....Prograde:yawPrograde:pitchPrograde:rollI think what you are asking for is to just be able to say:set SurfRetro to V(-1,-1,-1) * velocity:surface.The last time I tried, that didn't work. YMMV. Link to comment Share on other sites More sharing options...
slin3 Posted October 14, 2013 Share Posted October 14, 2013 Thanks for the help. Any infos if or when kOS and Remotetech will be compatible? Do I need to go and beg the RT-guys to make it compatible or is it a problem of kOS (or maybe both?). Link to comment Share on other sites More sharing options...
Bizz Keryear Posted October 14, 2013 Share Posted October 14, 2013 Thanks for the help. Any infos if or when kOS and Remotetech will be compatible? Do I need to go and beg the RT-guys to make it compatible or is it a problem of kOS (or maybe both?).Its a problem of RT, cause its redirect the keyboard inputs through itself (to making the delay possible, or deny control and such).But as far as I know RT development is suspended until 0.22 comes out officially. Link to comment Share on other sites More sharing options...
aNewHope Posted October 14, 2013 Share Posted October 14, 2013 I got a question:Is there any good way of finding out, how much ∆V you will need to circularize your Orbit?I want to know this because I already programmed almost perfectly working launch programs for SSTO-spaceplanes and rockets.(Altitude error < 10m, eccentricity < 0.001, rocket inclination error < 0.5°, SSTOs only equatorial orbits)The only problem there is left, is that there is no easy way of finding out when to start your circularization burn. (And the SSTO inclination)Has anyone found a good solution to this problem? Link to comment Share on other sites More sharing options...
willow Posted October 14, 2013 Share Posted October 14, 2013 You already can.Thank you for your elaborate answer payload. I was aware of the features you point out.I think what you are asking for is to just be able to say:set SurfRetro to V(-1,-1,-1) * velocity:surface.The last time I tried, that didn't work. YMMV.Yes or even just set vt to v1 + v2.I'm not sure if you can do a construct like set x to velocity:x.set y to velocity:y.set z to velocity:z.set vec to V(x,y,z).I'm presuming it's possible, though I am not sure, but if you want to write anything related to astro navigation you're going to have to juggle a lot of vectors around. If you have to spell out every operation on a scalar level, you'll just end up spraining your brain The locking mechanism kOS has implemented in combination with vectors could do some amazing things.Take a very simple operation of following a maneuvering node. It'd be trivial with vector math. But you triple the amount of code when you have to break every vector down to it's scalar components.I'm really charmed by the kOS plugin. I think it solves the problem that mechjeb doesn't take every single action out of your hands I love just flying the rockets, but some missions like 5 refuelling missions for a particularly large fuel tank in orbit would be much more fun if you could build the script and say "Go!" Being able to call subscripts that perform mechjeb like actions would be akin to the holy grail... Afer that, will probably come some gui functions so you can put your scripts behind on screen buttons. Link to comment Share on other sites More sharing options...
lijat Posted October 14, 2013 Share Posted October 14, 2013 I got a question:Is there any good way of finding out, how much ∆V you will need to circularize your Orbit?I want to know this because I already programmed almost perfectly working launch programs for SSTO-spaceplanes and rockets.(Altitude error < 10m, eccentricity < 0.001, rocket inclination error < 0.5°, SSTOs only equatorial orbits)The only problem there is left, is that there is no easy way of finding out when to start your circularization burn. (And the SSTO inclination)Has anyone found a good solution to this problem?Doing the math yields something like this∆V=sqrt(GM/r1)-(r2v2/r1)whereG is the gravitational constantM is the mass of kerbinr1 is the distance from apoapsis to the center of kerbinr2 is your current distance from the center of kerbinv2 is your current orbital speedI was developing this for a launch script in version 0.7 and it almost worked, a bug with velocity:x etc prevented me from getting the orbital velocity in any nice way so I get gave up waiting for a less buggy version, that less buggy version has not arrived yet, now I have even more bugs in my script :/So according to my calculations of orbital energy it should work but not really tested, its only reasonably close when using surface speed as an aproximation (got within 200m/s so it looks about right) Link to comment Share on other sites More sharing options...
Bizz Keryear Posted October 14, 2013 Share Posted October 14, 2013 Doing the math yields something like this∆V=sqrt(GM/r1)-(r2v2/r1)whereG is the gravitational constantM is the mass of kerbinr1 is the distance from apoapsis to the center of kerbinr2 is your current distance from the center of kerbinv2 is your current orbital speedI was developing this for a launch script in version 0.7 and it almost worked, a bug with velocity:x etc prevented me from getting the orbital velocity in any nice way so I get gave up waiting for a less buggy version, that less buggy version has not arrived yet, now I have even more bugs in my script :/So according to my calculations of orbital energy it should work but not really tested, its only reasonably close when using surface speed as an aproximation (got within 200m/s so it looks about right)It seems to like Kevin currently stopped working on kOS and is instead killing innocent victims (Victim Nr. 1 Nr. 2 Nr. 3 ... btw. did someone else noticed that the uid in youtube videos got longer lately?)I can understand that it seems like only a couple of hours (depends on definition) until 0.22 comes out. Link to comment Share on other sites More sharing options...
Dunbaratu Posted October 14, 2013 Share Posted October 14, 2013 ...a bug with velocity:x etc prevented me from getting the orbital velocity in any nice way...According to a comment on the github issues page there might be a workaround for this (although I haven't tested it myself yet).If you explicitly use velocity:orbit instead of velocity it apparently doesn't have the problem even though they're meant to be synonymous.So this works:set vel to velocity:orbit.print vel:x.Where this didn't:set vel to velocity.print vel:x.You will need the temporary in-between variable "vel" and can't just do "velocity:orbit:x" because the parser doesn't like multiple colons in the same term.Like I said I haven't tried this myself yet. I'm just parroting what someone said in a github issue. I hope it works. Link to comment Share on other sites More sharing options...
JewelShisen Posted October 15, 2013 Share Posted October 15, 2013 Ok maybe somebody here can help me. I need to find a way to limit the following equation to the values of -1 <= x <= 1. ( ( targalt - alt:radar ) / targalt ) It's for an altitude control program and this is part of the code that sets the pitch thus why i need the limits. Also targalt is something the user would set when they start the program. Link to comment Share on other sites More sharing options...
Sma Posted October 15, 2013 Share Posted October 15, 2013 (edited) Ok maybe somebody here can help me. I need to find a way to limit the following equation to the values of -1 <= x <= 1. ( ( targalt - alt:radar ) / targalt ) It's for an altitude control program and this is part of the code that sets the pitch thus why i need the limits. Also targalt is something the user would set when they start the program.I'm not 100% sure this would do it but maybe:if x > -1 or x < 1 or x = -1 or x = 1{//do something here}That should in theory (if in a loop) give you the ability to do something and keep x with in -1 or 1, if my thinking is correct.Edit: Added the equals part other wise it wouldn't be <= or >= lol. Now...I haven't tested it of course so I dunno how well it works/doesnt work. Edited October 15, 2013 by Sma Link to comment Share on other sites More sharing options...
Sma Posted October 15, 2013 Share Posted October 15, 2013 It seems to like Kevin currently stopped working on kOS and is instead killing innocent victims (Victim Nr. 1 Nr. 2 Nr. 3 ... btw. did someone else noticed that the uid in youtube videos got longer lately?)I can understand that it seems like only a couple of hours (depends on definition) until 0.22 comes out.Yeah, I imagine with 0.22 coming out soon he may be waiting to see what breaks even more. That or hopefully he's working on a rather large update to fix all the current bugs and give us something cool. Wishful thinking maybe? Who knows except for future historians...and time lords. Allons-y! Link to comment Share on other sites More sharing options...
Bizz Keryear Posted October 15, 2013 Share Posted October 15, 2013 Yeah, I imagine with 0.22 coming out soon he may be waiting to see what breaks even more. That or hopefully he's working on a rather large update to fix all the current bugs and give us something cool. Wishful thinking maybe? Who knows except for future historians...and time lords. Allons-y! Bow ties are cool. Link to comment Share on other sites More sharing options...
Payload Posted October 15, 2013 Share Posted October 15, 2013 (edited) ........So according to my calculations of orbital energy it should work but not really tested, its only reasonably close when using surface speed as an aproximation (got within 200m/s so it looks about right)You don't need to know your orbital velocity even though you can get it.clearscreen.set done to 0.set Gk to 3.5316000*10^12.set tAp to 100000.set tPe to 0.// For dV at Ap set Radius to AMSL-Kerbin + Ap. For Pe use AMSL-Kerbin + Pe.set Radius to 600000 + tAp. set sma to 600000 + ((tPe+tAp)/2).set V1 to (Gk/Radius)^.5.set V2 to (Gk*((2/Radius)-(1/sma)))^.5.set dV to abs(V1-V2).set acceleration to (maxthrust/mass).set burnTime to (dV/acceleration).set tTime to (burnTime/2).until done = 1{if ag1 = "True" { set done to 1. toggle ag1. }.print "Semi-Major Axis " + sma at (0,1).print "Target Velocity " + V1 at (0,3).print "Velocity at Burn " + V2 at (0,5).print "Delta Velocity " + dV at (0,7).print "Max Acceleration " + acceleration at (0,9).print "Burn Time " + burnTime at (0,11).print "Target Time " + tTime at (0,13).}.That is Vis-a-Vis for circularization.Checked against here.http://files.arklyffe.com/orbcalc.html Edited October 15, 2013 by Payload Link to comment Share on other sites More sharing options...
Dunbaratu Posted October 15, 2013 Share Posted October 15, 2013 (edited) A while back people were posting about wanting to get the normal and anti-normal directions for maneuvers and steering. Just today I was trying to work out how to obtain inclination angle and as a stepping stone to that I also got the normal and anti-normal calculations based on the limited information available from KOS. I added a thing on the wiki for it here: http://kos.wikia.com/wiki/Tutorial_-_getting_normal_vectorShorthand explanation: A while ago I worked out how to transform any of KOS's Directions that get expressed as Euler rotations into unit vectors in XYZ terms instead and put an example of that on the wiki. It just occurred to me today that since this means I can get the UP direction as a vector, and I can get the velocity as a vector, that this gives me two vectors in different directions that are both in the plane of the orbit. that means their cross-product is a vector normal to the plane of the orbit.If you are trying to make an inclination-changing burn, you can continue running the code to recalculate the normal vector in a loop to keep changing the steering as the inclination changes. Edited October 15, 2013 by Steven Mading Link to comment Share on other sites More sharing options...
123nick Posted October 15, 2013 Share Posted October 15, 2013 man, more people need to place there scripts here. like i cant find a single user-made KOS script anywhere! there needs to be a place where people can share there programs Link to comment Share on other sites More sharing options...
NathanKell Posted October 15, 2013 Share Posted October 15, 2013 http://forum.kerbalspaceprogram.com/threads/48428-Space-Computer-Brought-to-you-by-kOS-and-hopefully-many-nerdsSearch (these forums, or upthread) and ye shall find. Link to comment Share on other sites More sharing options...
Dunbaratu Posted October 15, 2013 Share Posted October 15, 2013 man, more people need to place there scripts here. like i cant find a single user-made KOS script anywhere! there needs to be a place where people can share there programshttp://kos.wikia.com/wiki/Look on the right side list for "tutorials and examples". Bizz has collected together some examples from other places and put them there. When I find a solution to a small problem I put up a small example there to show it. I think that's valuable as the target user for KOS is not someone who wants a fully working mechjeb to do the work for them, but someone who wants to make their own autopilot. So posting small examples that address specific individual problems along with the bigger examples that do an entire task is important. Some people will presumably want to make their own autopilot but want help with things like "how do I calculate such-and-such from the available information?" Link to comment Share on other sites More sharing options...
razark Posted October 15, 2013 Share Posted October 15, 2013 http://forum.kerbalspaceprogram.com/threads/48428-Space-Computer-Brought-to-you-by-kOS-and-hopefully-many-nerdsSearch (these forums, or upthread) and ye shall find.That's not a general purpose thread, though. It's really a thread for discussion/building one specific program in kOS. We need two things: a thread to discuss general scripts/programming, and moderators that won't over-zealously close any such thread on the basis of the existing "space computer" thread. Link to comment Share on other sites More sharing options...
NathanKell Posted October 15, 2013 Share Posted October 15, 2013 Well, it was created the last time there was discussion in this thread about "we need a central location for all these scripts, and to not clutter the dev thread." And Payload said he'd create one and linked to it. So I thought that's what it was. Link to comment Share on other sites More sharing options...
Dunbaratu Posted October 15, 2013 Share Posted October 15, 2013 (edited) That's not a general purpose thread, though. It's really a thread for discussion/building one specific program in kOS. We need two things: a thread to discuss general scripts/programming, and moderators that won't over-zealously close any such thread on the basis of the existing "space computer" thread.I'd rather take the approach of building a library of subroutines for people to pick and choose from rather than a single monolithic program. Now that the "Program ended" messages are going away for sub-program calls (once 0.8x gets fixed well enough to be usable) it's going to become more practical to use the "run progname(arg,arg,arg)" command as a subroutine call. It's got a lot of overhead behind doing the call, which makes it a bit slower than a native routine but for a thing like a scripting language it's about like a shell script running a lot of small programs to each do one little thing.And while a forum thread might be an appropriate place to ask questions about such a hypothetical library of example routines, or make announcements about them, I don't think it's an appropriate place to store them for download, as only the thread starter would have the rights to edit the head post of the thread so it would end up meaning it would be a thread of scattered examples to search for. A thing like a wiki makes more sense for collaborative work on a shared library of example routines. Edited October 15, 2013 by Steven Mading Link to comment Share on other sites More sharing options...
Recommended Posts