Jump to content

kOS Scriptable Autopilot System 0.9


KevinLaity

Recommended Posts

Well the thing is the Mod code is open sourced, so it's perfectly legal to fork it and make a new project for it. It's just a bit rude to do that if the creator was planning to return to it later. All we really need to know is "are you abandoning it or just taking a short break?" It's a relevant difference.

I know, I just feel that modmakers are pressured a lot on the forums here. I see quite a few of them quitting or reducing output pretty quickly. Sometimes because they burn themselves out or lose interest naturally, sometimes because people keep harassing them with the same questions, with feature requests, for updates or people get mad because they do not understand a mod and blame the author. It is good that people are enthousiastic about something, buy they can get a bit fanatical sometimes.

Link to comment
Share on other sites

with the code


print "Skycrane systems Activated. Waiting until 2000 meters for engine start.".
wait until alt:radar = 2000.
lock retrograde.
stage.
print "Retroburn.".
lock throttle 1.
wait until surfacespeed = 3.
lock throttle 0.
print "Retroburn over.".
wait until alt:radar = 200.
lock throttle 1.
print "Hovermode on standby.".
wait until verticalspeed = 20.
print "Hover mode start.".
lock throttle 0.1.
wait until verticalspeed = 5.
print "Waiting until altitude is two meters above surface.".
wait until alt:radar = 10.
print "Ten meters".
wait until alt:radar = 2.
stage.
lock throttle 1.

It comes out with "Error Syntax line 0"

Edit. This is with all long scripts. I have tried with another I just made

Edit 2. I am stupid, I was writing lock throttle 1, instead of lock throttle to 1.

Also shouldn't "lock retrograde" be "lock steering to retrograde"?

Link to comment
Share on other sites

I am not too sure of Kevin's reasons for not being around here anymore, but I am quite sure that trying to contact someone over a couple of seperate channels at the same time might appear a little... pushy. I can imagine he needed a break and opening an all-out offensive for contact might not help.

Well at least I restrained myself to contact him on his dating site .. or give him a (international) phone call...
Well the thing is the Mod code is open sourced, so it's perfectly legal to fork it and make a new project for it. It's just a bit rude to do that if the creator was planning to return to it later. All we really need to know is "are you abandoning it or just taking a short break?" It's a relevant difference.

I think once it's been going long enough it's started causing problems with the rest of the KSP code it might break things.. If it's leaking memory in some way than other parts of KSP would start to break when the 32-bit memory limit is hit.

Especially for bug fixing he should name an admin which takes over while he isn't around ... There are quite some annoying things in it .. like still floats everywhere while the intention was to have doubles. and those lagging ... and that the kOS IDs are broken ... I think that also might be the cause for troubles where the cause is hard to find (I am talking about vessels parts still controlled by kOS even after detaching and such... at least I think I have read this in GitHub)
I know, I just feel that modmakers are pressured a lot on the forums here. I see quite a few of them quitting or reducing output pretty quickly. Sometimes because they burn themselves out or lose interest naturally, sometimes because people keep harassing them with the same questions, with feature requests, for updates or people get mad because they do not understand a mod and blame the author. It is good that people are enthousiastic about something, buy they can get a bit fanatical sometimes.
Well yes, we leachers (as in others and I ... that doesn't have to include you) are eager to have newer better versions ... but I think most of them understand that after all KSP is just a hobby not a profession. And no one would had rip head off the developer if he is saying that he is feed up and need a break or is quitting.

Anyway I got finally an answer from him.

Hi yes sorry. I know I've been gone for a long time but I'm just going through some personal stuff right now

I just answered him that he could/should have told us that a while ago. I also told him that (probably ... I was assuming from my point of view the opinion of everybody else) nobody would have been mad, cause KSP is just a hobby and not a profession.

And I asked him is there is are any plans to assign someone in charge while his life is happens...

(and warned him that the community might take over if he is waiting too long...)

Link to comment
Share on other sites

I just answered him that he could/should have told us that a while ago. I also told him that (probably ... I was assuming from my point of view the opinion of everybody else) nobody would have been mad, cause KSP is just a hobby and not a profession.

Absolutely. There's no obligation to force him to work on it if he doesn't want to. What's there presently already constitutes quite a lot of selfless donation of his own personal time for which we are very grateful. If he decides to walk away from it and abandon it that would be perfectly cool. I'm sure plenty of people wouldn't mind taking it over. The only thing holding that back from happening is just common courtesy - it's his baby. He made it. If he doesn't want to relinquish control of it because he expects to come back to it later and doesn't want too many design decisions made in his abscense, that's perfectly cool too.

It's just that right now we're totally guessing as to what his intentions are.

And hey, if he's having personal stuff right now and wants to walk away, I hope he's coping okay and realizes how much we love what he's made, despite all the "complaining". A lot of the time what is actually meant as constructive feedback of a thing we love and want to contribute to can look like nagging.

Feel free to forward that on to him if you like.

Link to comment
Share on other sites

Hello, I have decided to bite the bullet and make a KOS script. I am having trouble getting my craft to face a particular direction, or look like it is turning at all.

I am using

lock steering to heading 90 by 55.

Which AFAIK should face me at at a 55 degree pitch and a normal launch direction (east)

Am I missing something? My craft wiggles the fins and gimbals for a while then does nothing. My craft needs to turn using the gimbal and fins, torque is not an option.

Myself I just need some more examples or to know the answers to a couple of questions.

I assume the axis for the final number is the `rotate on the direction of travel` number?

What would east at 55 degrees be is it, +r(0,35,180)? and would south at 10 degrees be +r(80,0,180)?

So would that mean straight up is +r (0,0,180)?

If that is all ok (thinking as I type) then would a standard launch and gravity turn start at (0,0,180) and smoothly go to (0,90,180)?

EDIT : after looking at the WIKI again I am still unsure whether to use `set direction to up+r(0,10,180).` or `set steering to up+r(0,10,180).` to make my craft point 10 degrees east from vertical. It really is not explicitly clear on that point.

or `set direction to up+r(0,10,180). set steering to direction.` (which seems redundant)

EDIT2 : Ok so it seems my craft is trying to stay vertical, as in it is moving the fins and gimbal, but it is not actually doing anything to control the direction it flies.

Here is the code I am using.


lock throttle to 1.
lock steering to up.
stage.
print "launch".
until 0 {
wait 1.
if altitude>7999 {break.}.
}.
print 8000.

Can anyone tell me why `lock steering to up.` does not keep my craft pointed straight up?

EDIT 3 : lock steering to up+r(0,0,0). does not change my attitude or anything else.

EDIT 4: As there have been no replies I`m going to put KOS on a fresh install with no mods and see if that works. AFAIK I am doing it right but it is not working.

Sorry, not been in, I'll work through your post now.

Link to comment
Share on other sites

Stuff

Looks like you understand it, just not sure of the right commands.

I assume the axis for the final number is the `rotate on the direction of travel` number?

Exactly. Rotate on the direction of travel set by the previous part of the command.

What would east at 55 degrees be is it, +r(0,35,180)? and would south at 10 degrees be +r(80,0,180)?

Yep, spot on.

Edit: South at 10 degrees from the horizon yes.

South at 10 degrees from vertical is up + R(10,0,180).

So would that mean straight up is +r (0,0,180)?

Right again.

If that is all ok (thinking as I type) then would a standard launch and gravity turn start at (0,0,180) and smoothly go to (0,90,180)?

Exactly.

EDIT : after looking at the WIKI again I am still unsure whether to use `set direction to up+r(0,10,180).` or `set steering to up+r(0,10,180).` to make my craft point 10 degrees east from vertical. It really is not explicitly clear on that point.

or `set direction to up+r(0,10,180). set steering to direction.` (which seems redundant)

I always use the lock command. The wiki specifically says to use lock with steering and throtle so that's what I do. There other ways of doing it but because I have no idea what I'm doing either, I stick to the foolproof methods.

So I would use

lock steering to up + R(0,10,180).

Only time I've found it doesn't work is when the aerodynamic forces exceed the crafts ability to turn, I use FAR exclusively so performing a 45 degree turn at mach 3 just isn't going to happen :)


lock throttle to 1.
lock steering to up.
stage.
print "launch".
until 0 {
wait 1.
if altitude>7999 {break.}.
}.
print 8000.

Not sure what you're trying to do here. So you're waiting until 0 something?

You don't really need to put in an if and break as that is what an until does automatically. You can also word it differently to save on complexity.

lock throttle to 1.
lock steering to up + R(0,0,180).
stage.
print "launch".
wait until alt:radar >7999.
Print "8000".

If for example you wanted to check the program was running and cycling, the way I do it is get it to count for me. Handy with multiple If statements and you want to see how the program is working.

lock throttle to 1.
lock steering to up + R(0,0,180).
set count to 1.
stage.
print "launch".
clearscreen.
until alt:radar >7999
{
print "program check" + count at (5,5).
set count to count +1.
}.

Print "8000".

This will count up each time the program cycles through that statement until the altitude is greater than 7999. The "at" part means it will count up on the same part of the screen instead of filling the screen up with numbers. The set count to count + 1 means each time it cycles, it will add 1 to the number there previously. Just looks better and is the first stage of programming consoles for debugging or whatever. See my videos in previous posts for examples of what I mean on the console thing. When the craft gets to > 7999 it will print "8000" and away you go to the next part of the program.

Hope this helps :)

Edited by Kass
Link to comment
Share on other sites

Well the thing is the Mod code is open sourced, so it's perfectly legal to fork it and make a new project for it.

No. That is just not correct. The fact that it's open source has nothing to do with the fact that yes, it's perfectly legal to fork it and make a new project for it. The GNU GPL "copyleft" license is what makes it legal, and despite people seeming to have the idea that open source means freedom to do what you like with it, the license is still what matters. You can have open source with all rights reserved.

You probably knew this and it's what you meant, but I thought it worth clarifying so that people who don't know aren't getting the wrong idea.

Link to comment
Share on other sites

No. That is just not correct. The fact that it's open source has nothing to do with the fact that yes, it's perfectly legal to fork it and make a new project for it. The GNU GPL "copyleft" license is what makes it legal, and despite people seeming to have the idea that open source means freedom to do what you like with it, the license is still what matters. You can have open source with all rights reserved.

You probably knew this and it's what you meant, but I thought it worth clarifying so that people who don't know aren't getting the wrong idea.

Your response is predicated on the idea that the phrase "open source" simply means that you can see the source code and that's all it means. If that was true I'd agree with you. But it doesn't just mean that. While it's true that many licenses allow you to fork the code and use it for your own purposes, and it's the license that allows this, the fact that there are many such licenses with slightly different terms gave rise to the need to make a catch-all term for them, and that catch-all term is open source. It does not merely mean you can look at the source. It's a fuzzy catch-all term that means "that collection of various licenses that share in common the ability to use and modify the source code." (note, USE, not just look at.).

Edited by Steven Mading
Link to comment
Share on other sites

Not sure what you're trying to do here. So you're waiting until 0 something?

You don't really need to put in an if and break as that is what an until does automatically. You can also word it differently to save on complexity.

He has an impossible to fulfill until loop so he kinda does need the break. Or just rephrasing the whole bit like you said. :)

I'm still trying to wrap my head around the fact that some programmers think "until 0 {" is fine, after the flak coders tend to give on "goto", either infinite loops are bad or they aren't. :confused:

Hell, "until 0 {" doesn't even make sense, I mean I shudder at Maddings way of "until done {" because the condition is implied, but at least that makes logical sense, since it's basically "until done=true" or "until done != 0" and ends the loop with "set done to 1.", but how is "until false = true" or "until 0 != 0" supposed to work, even theoretically? :huh:

P.S. Don't mind me, if it works for you, it works. Y'all do whatever you like. ^_^

Link to comment
Share on other sites

He has an impossible to fulfill until loop so he kinda does need the break. Or just rephrasing the whole bit like you said. :)

I'm still trying to wrap my head around the fact that some programmers think "until 0 {" is fine, after the flak coders tend to give on "goto", either infinite loops are bad or they aren't. :confused:

until 0 is only an infinite loop when it contains no code inside that causes break.

ANY loop has the potential to be infinite if the condition wasn't set up right. Even if you explicitly say something like "until X > 10" it could still be infinite if X doesn't count up correctly. You still have to examine the body of the loop to see if it's infinite or not.

Hell, "until 0 {" doesn't even make sense, I mean I shudder at Maddings way of "until done {" because the condition is implied, but at least that makes logical sense, since it's basically "until done=true"

ANY condition that checks for (some variable)=TRUE is poor coding that would be far better served by just using the variable bare without the =TRUE part. This is because TRUE will be a single value (typically 1) where the actual boolean definition says that ALL non-falses (for example, 2, 3, 4, 5, -1, 2, -3, etc) are true. There's a relevant difference.

And the idea of using the name of a variable bare as a conditional clause is VERY VERY well established longstanding practice. It's not something I invented out of whole cloth. It's how boolean variables have been used for decades.

Link to comment
Share on other sites

Interesting. I am not 100% sure why it would do that. However, I had something similiar happen to me before. I fixed it by changing my roll orientation before setting the pitch angle via heading. Mine would eventually steer to the correct heading but it did it in an arc across the compass instead of just by directly pitching over. I guess it might be how kOS steers and which direction it seeks to first or since you are pointing straight up it might get confused sort of like a gimbal lock ... but I don't really know. Anyway if I changed my roll first it would fix it.

Here is a section of my launch code that handles attitude control which works pretty good. I took some intersting bits like the turn profile from some code I found on the forums.

PRINT "Setting Attitude Profile". 
SET tgtorbvel to sqrt(gConst*[B]bodyMass[/B] / (bodyRadius+tgtApo)).
LOCK STEERING TO UP+R(0,0,180). //set to straight up as positioned on the pad i.e pointing toward VAB.
WHEN alt:radar > 500 THEN LOCK STEERING TO HEADING(90, 90). // this is also straight but changes roll .. same as UP+R(0,0,0) ... I think
LOCK turnProfile to 90 - sqrt(vel:mag/tgtorbvel)*90. // calculates a parabolic turn (90 to 0) based the ratio of current velocity to orbVel
WHEN turnProfile < 1 THEN LOCK turnProfile to 1. // Velocity can exceed ending orb velocity on ascent and return negative pitch ... switch to turn based on total energy.
WHEN currpress < 0.25 THEN LOCK STEERING TO HEADING(turnProfile, 90). // start turn at pressure of 0.25 about 8k on kerbin

Note: vel is locked to either velocity:orbit or velocity:surface depeding on altitude.

currpress is locked to the equation for atmospheric pressure.

body parameters like radius, mass, and grav constants are loaded based on what body you are on.

For bodymass, what is the value for Kerbin?

I`ve found the 5.2915793×10^22 kg figure, would I use 52915793000000000000000?

I take it the grav. constant for Kerbin is 9.81?

Link to comment
Share on other sites

No. That is just not correct. The fact that it's open source has nothing to do with the fact that yes, it's perfectly legal to fork it and make a new project for it. The GNU GPL "copyleft" license is what makes it legal, and despite people seeming to have the idea that open source means freedom to do what you like with it, the license is still what matters. You can have open source with all rights reserved.

You probably knew this and it's what you meant, but I thought it worth clarifying so that people who don't know aren't getting the wrong idea.

Your response is predicated on the idea that the phrase "open source" simply means that you can see the source code and that's all it means. If that was true I'd agree with you. But it doesn't just mean that. While it's true that many licenses allow you to fork the code and use it for your own purposes, and it's the license that allows this, the fact that there are many such licenses with slightly different terms gave rise to the need to make a catch-all term for them, and that catch-all term is open source. It does not merely mean you can look at the source. It's a fuzzy catch-all term that means "that collection of various licenses that share in common the ability to use and modify the source code." (note, USE, not just look at.).

In fact I heard that, too. There is one open source project I heard of with all right reserved... even though I can't point out which one it was...

Link to comment
Share on other sites

Your response is predicated on the idea that the phrase "open source" simply means that you can see the source code and that's all it means. If that was true I'd agree with you. But it doesn't just mean that. It's a catch-all term for a variety of licenses that differ in many ways except that the one thing they share in common is the ability to use (not just look at) the source code.

Your response is predicated on the idea that all programs that are open sourced use a copyleft license.

Just because programs with an open source are usually combined with a license that allows using the source, does not mean that the term open source explicitly grants these rights. I will concur that usually, and in casual conversation open source does tend to mean that you're also granted extensive rights on the code. And yes, open sourced programs tend to as a rule (figure of speech, it isn't a rule) allow modification, but distributing said changes, while again commonly allowed, is not a guaranteed thing.

The forum requires the source and a license to be posted, and usual recommendation for modders without licenses is "just say all rights reserved until you decide", but according to you, if it's open source it can't have all rights reserved, since being open source already makes it free to be modified and then distributed.

Or it could well be a language barrier on my part, how do you say "a program that has it's source code available but isn't allowed to be distributed as a changed version" in English? It's "open source" (avoin lähdekoodi) here, and generally programs with freedom to alter and distribute altered code are referred to as "free software" (vapaa ohjelmisto). (that's free as in freedom, not as without-cost)

Of course for the purposes of kOS, this discussion is moot, since it does come with a copyleft license. :)

Link to comment
Share on other sites

Only time I've found it doesn't work is when the aerodynamic forces exceed the crafts ability to turn, I use FAR exclusively so performing a 45 degree turn at mach 3 just isn't going to happen :)

Not sure what you're trying to do here. So you're waiting until 0 something?

Hope this helps :)

This might be what is happening to me. I may be suffering from forces wanting to spin my craft and stopping me from turning quickly enough.

Not sure what you're trying to do here. So you're waiting until 0 something?

I set up a permanent loop (which had a 1 second delay to cut down on cycles) which executed a break at 8000m to start gravity turn. It meant I could just slot in commands later if I wanted to do stuff during that time. I design my programs to be easy to change later when I am making them and when it all works I sort of hard code that down and make it small and fast.

Hope this helps :)

It helped very much. I only downloaded KOS about 30 hours ago and I`m still trying to figure out how to force the craft to turn with vigour. Currently it flops the fins about like a fish out of water and turns like an ocean liner.

I`d really love a way to force the craft to rotate to a known cardinal point and then to pitch left, right, up or down under explicit control of the program, not just to set a heading and hope it figures it out in time...

(please tell me this is possible, that would be great)

Link to comment
Share on other sites

Your response is predicated on the idea that the phrase "open source" simply means that you can see the source code and that's all it means. If that was true I'd agree with you. But it doesn't just mean that. While it's true that many licenses allow you to fork the code and use it for your own purposes, and it's the license that allows this, the fact that there are many such licenses with slightly different terms gave rise to the need to make a catch-all term for them, and that catch-all term is open source. It does not merely mean you can look at the source. It's a fuzzy catch-all term that means "that collection of various licenses that share in common the ability to use and modify the source code." (note, USE, not just look at.).

Sorry to break that to you, but as other have already pointed out, this is completely wrong. Of course noone can prevent you from doing what you want on your own computer, but as soon as you're going to publish a derivative work, you have to abide by the license. In that sense, the term "open source" is totally meaningless, because if the license forbids you from publishing derivative work, you are NOT legally entitled to doing so.

Link to comment
Share on other sites

until 0 is only an infinite loop when it contains no code inside that causes break.

Matter of perspective I suppose, for me the requirement of break is what makes it an infinite loop, it cannot fulfill it's until goal, even theoretically, so it needs to be broken to move on, can't the break condition be the until condition?

To me that just seems like doing

10 print "boo"
20 if <whatever you want to "break" with> then goto 40
30 goto 10
40 print "hoo"

Which I consider even sillier ^_^ (and obviously there are differences, but both are an "infinite" loop with a break clause. Yet I've seen people take crap for using goto, but basically the same trick without goto is just fine. (not meaning to imply you or anyone on this forum has given crap, just a general observation in programming circles))

ANY loop has the potential to be infinite if the condition wasn't set up right. Even if you explicitly say something like "until X > 10" it could still be infinite if X doesn't count up correctly. You still have to examine the body of the loop to see if it's infinite or not.

Of course, I phrased myself poorly, I meant making an intentional infinite loop with basically no exit clause. Not that your loop becomes infinite because due to other factors the conditions never get fulfilled.

This is because TRUE will be a single value (typically 1) where the actual boolean definition says that ALL non-falses (for example, 2, 3, 4, 5, -1, 2, -3, etc) are true. There's a relevant difference.

Depends on if you need it to be true, or just "not false". But yeah, good point. I tend to want things to be true or false, but there are rarely reasons why not_false wouldn't work just as well or better.

And the idea of using the name of a variable bare as a conditional clause is VERY VERY well established longstanding practice. It's not something I invented out of whole cloth. It's how boolean variables have been used for decades.

Yeah I know, I didn't mean to imply you came up with it or anything, hell you use it in a way I'm almost okay with :P

Just because it's well established doesn't mean it isn't silly ;) (though that's merely my opinion) And I don't have a big problem with "until done" since while it hurts my eyes, it's a functioning condition of "until done not false", but "until 0 {" is painful. How does an "until false not true" work, logically speaking. Unless you consider the 0 to be a variable name, so you could do "set 0 to 1." :confused:

Still, I apologize if I ruffled some feathers, didn't mean to offend anyone or bash their coding style, whatever works for you, works. :) (and I'm pretty sure my code is filled with dirty hacks and odd bits that'd make you guys facepalm ^_^ )

Link to comment
Share on other sites

I don't understand the discussion about the code being Open Source and free software or not.

Fact 1: kOS is published under the GNU GPL licence.

Fact 2: From here:

“Free software†means software that respects users' freedom and community. Roughly, the users have the freedom to run, copy, distribute, study, change and improve the software.

...

A program is free software if the program's users have the four essential freedoms:

The freedom to run the program, for any purpose (freedom 0).

The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this.

The freedom to redistribute copies so you can help your neighbor (freedom 2).

The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.

So - and tell me if I am wrong here - according to my understanding anyone (according to freedom 3) may fork kOS, change it, and publish it; as long as it comes with a GPL.

Edited by baloan
Link to comment
Share on other sites

Fact 2: From here:

Do note that this is not a license, and even if it were, it is not the license kOS has been published under.

So - and tell me if I am wrong here - according to my understanding anyone (according to freedom 3) may fork kOS, change it, and publish it; as long as it comes with a GPL.

Again, "freedom 3" is irrelevant here. Other than that, you are correct.

("Irrelevant" meaning that the text on http://www.gnu.org/philosophy/free-sw.html is irrelevant. It's only the text in the GPL v3 that matters for kOS.)

Link to comment
Share on other sites

It helped very much. I only downloaded KOS about 30 hours ago and I`m still trying to figure out how to force the craft to turn with vigour. Currently it flops the fins about like a fish out of water and turns like an ocean liner.

I`d really love a way to force the craft to rotate to a known cardinal point and then to pitch left, right, up or down under explicit control of the program, not just to set a heading and hope it figures it out in time...

(please tell me this is possible, that would be great)

I generally find that the craft turns with the same force as would be available normally. So small agile craft turn really quickly and large craft turn like whales. Have you tried doing the manoeuvre manually and seeing how the craft responds and how it relates to kOS' behaviour?

Yeah, I've only had kOS a week or so and never coded before that so I propably have no idea whatsoever what I'm doing. :)

Link to comment
Share on other sites

Matter of perspective I suppose, for me the requirement of break is what makes it an infinite loop, it cannot fulfill it's until goal, even theoretically, so it needs to be broken to move on, can't the break condition be the until condition?

To me that just seems like doing

10 print "boo"
20 if <whatever you want to "break" with> then goto 40
30 goto 10
40 print "hoo"

Which I consider even sillier ^_^ (and obviously there are differences, but both are an "infinite" loop with a break clause. Yet I've seen people take crap for using goto, but basically the same trick without goto is just fine. (not meaning to imply you or anyone on this forum has given crap, just a general observation in programming circles))

Of course, I phrased myself poorly, I meant making an intentional infinite loop with basically no exit clause. Not that your loop becomes infinite because due to other factors the conditions never get fulfilled.

Depends on if you need it to be true, or just "not false". But yeah, good point. I tend to want things to be true or false, but there are rarely reasons why not_false wouldn't work just as well or better.

Yeah I know, I didn't mean to imply you came up with it or anything, hell you use it in a way I'm almost okay with :P

Just because it's well established doesn't mean it isn't silly ;) (though that's merely my opinion) And I don't have a big problem with "until done" since while it hurts my eyes, it's a functioning condition of "until done not false", but "until 0 {" is painful. How does an "until false not true" work, logically speaking. Unless you consider the 0 to be a variable name, so you could do "set 0 to 1." :confused:

Still, I apologize if I ruffled some feathers, didn't mean to offend anyone or bash their coding style, whatever works for you, works. :) (and I'm pretty sure my code is filled with dirty hacks and odd bits that'd make you guys facepalm ^_^ )

I generally try to make my breaks my exit clause, thus cutting down on the complexity of the programs and making them easy to understand and modify.

If I want an infinite loop to continue, say because I'm still working on my uber hover program I do it this way so I have an easy manual break:

set deactivateFlag to 0.
on AG9 set deactivateFlag to 1.

until deactivateFlag=1 {

some script

}.

Link to comment
Share on other sites

I`d really love a way to force the craft to rotate to a known cardinal point and then to pitch left, right, up or down under explicit control of the program, not just to set a heading and hope it figures it out in time...

(please tell me this is possible, that would be great)

I can't double check this in kOS since I'm not home, but isn't that what the +R() is doing? Just skip the heading and give it directions in it's native tongue.

If you're at level flight pointing east with 0 roll, you can give it a +r(0,45,0) to have it pitch up, or +r(45,0,0) to have it yaw right. Just be careful, doing +r(0,0,45) and then +r(0,45,0) will have it pitching up after rolling, but on the navball you'll wind up changing your angle diagonally.

Nutshell, if you use +r(), you can command the craft like an airplane. Also, if you use r() (without the plus) you can confuse the snot out of yourself. http://en.wikipedia.org/wiki/File:Euler2a.gif

I'll have to double check this when I get home... Hopefully didn't muck anything up :)

Been doing computer graphics for the last ten years, so I can use the eulers intuitively, just that whenever I actually start thinking about what and how I'm doing things that my brain goes " *bzzt* does not compute. Redo from start."

Link to comment
Share on other sites

I don't understand the discussion about the code being Open Source and free software or not.

Fact 1: kOS is published under the GNU GPL licence.

So - and tell me if I am wrong here - according to my understanding anyone (according to freedom 3) may fork kOS, change it, and publish it; as long as it comes with a GPL.

Yes you're right, like I said in a recent post; "Of course for the purposes of kOS, this discussion is moot, since it does come with a copyleft license."

I merely started nitpicking when Madding said "Well the thing is the Mod code is open sourced, so it's perfectly legal to fork it and make a new project for it." to which I felt it necessary to point out that while his end result is correct, his reasoning was not. kOS is legal to be forked and distributed, but because it's license grants it, not because it's open source.

It is a nitpick, which I probably should have done it in the topic for discussing licenses, and as such I'm dropping the subject in 3..2...1... :)

Link to comment
Share on other sites

For bodymass, what is the value for Kerbin?

I`ve found the 5.2915793×10^22 kg figure, would I use 52915793000000000000000?

I take it the grav. constant for Kerbin is 9.81?

No gConst is the universal gravity constant that is used to figure out the force of gravity on all bodies. 9.81 would be gConstant*bodyMass/bodyRadius^2 on Kerbin


set gConst to 6.67384*10^(0-11).
set bodyMass to 5.2915793*10^22.

FYI, since gConst is almost always multiplied by bodyMass you could just use the gravitational parameter in their place. Which for Kerbin is:

set gParam to 3.5316*10^12.

Link to comment
Share on other sites

OK, can someone confirm this? :

If more than one computer is installed on the vessel then

copy program from 0.

causes a flagrant error.

While it works when only one core is installed.

Edit: Guesswork: OK, I think its only affecting my build, since copy to also doesn't work.

Edited by Bizz Keryear
Link to comment
Share on other sites

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