Dunbaratu Posted November 26, 2014 Share Posted November 26, 2014 My A vector is my target:position.My B Vector is my SHIP:SRFPROGRADE.How to explain to the KOS that i want to build a vector C witch C+B=A? Because what ever i do the missile don't compensate for the gravity enough and hits in the ground in front of the target. Vector addition and subtraction works just like basic algebra: __\ __\ __\if: C + B = A __\ __\ __\then: C = A - Bi.e.SET vecC TO vecA - vecB.(Note the same does not apply to multiplication, as that's quite different in vector math than scalar math, as there's two different kinds of "multiply" for vectors - cross and dot products).And can someone explain to me what Trim is (in sense of :YAWTRIM) because the translator is useless, and goggle just shows some articles about hard drives."Trim" is the aviation version of "cruise control". Often when flying you have to hold the controls a bit off-center for a very long time with a slight amount of force. For example, you might have a slightly unbalanced plane that wants to tip to the right, so you have to push the control stick slightly to the left just to stay straight. Or you might be a bit nose-heavy and have to pull back slightly on the stick a certain amount to stay level. Over a long time this can become very fatiguing. So aircraft often have trim controls, which is a way of moving a dial or a lever to change where the neutral 'center' of the controls are. (where the controls will go when you let go of them). This is actually accomplished using little tabs on the control surfaces themselves that push the physical surfaces offcenter a bit in the wind.Autopilots often operate *via* the trim controls, especially when they are in 'maintain' mode - just trying to level things for you. They leave the main controls alone and just fiddle with the trim instead. That way you can still grab the stick and override what the autopilot is doing. To see the effect in the game, put a plane on the runway, and make sure SAS is off. then notice how the little PITCH slider moves when you press S and W, and how it moves back to the center when you let go. Now hold "ALT" and "S" for about 10 seconds, and then try S and W again (without the ALT). Notice that the location the pitch control centers to is no longer in the middle. Now it's a bit above the center. That's the effect of trim. In game you can fiddle with trim using ALT+W,A,S,D,Q,E, but often players don't see it because turning on SAS overrides it, making it hard to both trim and use SAS (which I find annoying a bit, when SAS doesn't hold the nose up but I want it on for its help with the other levelings). Link to comment Share on other sites More sharing options...
Reddy Posted November 26, 2014 Share Posted November 26, 2014 Alright thank you guys! I found out that you can simply print your current velocity with this code:PRINT (SHIP:VELOCITY:SURFACE:Z + SHIP:VELOCITY:SURFACE:Y +SHIP:VELOCITY:SURFACE:X).Only the value you will get will be completely unrelated to your actual velocity - unless you're going perfectly straight along one of the XYZ axes, which will never really occur in reality. You can obtain the velocity with SHIP:VELOCITY:SURFACE:MAG, which calculates the magnitude of your velocity vector (this is, square root of X^2+Y^2+Z^2). Link to comment Share on other sites More sharing options...
Gfurst Posted November 26, 2014 Share Posted November 26, 2014 Only the value you will get will be completely unrelated to your actual velocity - unless you're going perfectly straight along one of the XYZ axes, which will never really occur in reality. You can obtain the velocity with SHIP:VELOCITY:SURFACE:MAG, which calculates the magnitude of your velocity vector (this is, square root of X^2+Y^2+Z^2).Seriously for Actual surface speed all you have to do is VESSEL:SURFACESPEED = number in m/s, as per doc.On another note:I've been trying to use pilot input as above, for fine direction correction of vessel while in ascent. Because of FAR I can't simply make big direction changes....Please check out my new program code below:DECLARE PARAMETER stg1. // Number of stagesSET logfile TO ship:shipname + ".log". // Log file nameSET text TO "". // General variable to use textSET time0 TO time. // Initial timeLOCK time1 TO time - time0. // Elapsed timeSET t0 TO time1:seconds. // Reference for delta tLOCK td TO time1:seconds - t0. // Delta t elapsed since last refIF (stg1 <= 0) { // Check appropriatte parameter SET text TO time1:clock + " Invalid parameter, set number of stages". PRINT text. LOG text TO logfile. //BREAK. // need to add a way to terminate program} ELSE { SET text TO time1:clock + " Beginning program at " + time0:calendar + ", " + time0:clock. PRINT text. LOG text TO logfile. SET text TO time1:clock + " Number of stages parameter: " + stg1. PRINT text. LOG text TO logfile.}WAIT 1.0.SET stg0 TO 0. // Staging countSET throt TO 0. // Throttle trackSET cntd0 TO 9. // Launch countdownSET drect TO ship:facing. // Maintain initial directionLOCK throttle TO throt.LOCK steering TO drect.// Launch CountdownSET text TO time1:clock + " Beginning Launch on T-:" + (cntd0+1).PRINT text.LOG text TO logfile.WAIT 1.0.UNTIL ( cntd0 = 0 ) { SET text TO time1:clock + " ..." + cntd0. PRINT text. LOG text TO logfile. SET cntd0 TO cntd0 - 1.// Begin engines burn IF ( cntd0 = 1 ) { SET throt TO 1.0. SET text TO time1:clock + " Engines on". PRINT text. LOG text TO logfile. STAGE. SET stg0 TO stg0 + 1.0. } WAIT 1.0.}// Release launch stabilizersSET text TO time1:clock + " Releasing clamps".PRINT text.LOG text TO logfile.STAGE.SET stg0 TO stg0 + 1.0.// SolidFuel stageIF stage:solidfuel > 0.1 { WHEN (ship:altitude >= 20000) AND (stage:solidfuel < 1) THEN { SET text TO time1:clock + " Releasing SolidFuel boosters". PRINT text. LOG text TO logfile. STAGE. SET stg0 TO stg0 + 1.0. }}// Regular stagesWHEN (true) AND (stage:liquidfuel < 0.1) THEN { SET text TO time1:clock + " Fuel depleted, activating next stage". PRINT text. LOG text TO logfile. STAGE. SET stg0 TO stg0 + 1.0. IF ( ship:liquidfuel > stage:liquidfuel ) { PRESERVE. }}// Wait until 4000 for controlUNTIL (ship:altitude >= 4000) { IF (td >= 10) { SET t0 TO time1:seconds. SET text TO time1:clock+" alt:"+ROUND(ship:altitude)+" hdg:"+ROUND(ship:heading)+" sfr:"+ROUND(ship:surfacespeed)+" apo:"+ROUND(ship:apoapsis). LOG text TO logfile. } WAIT 0.5.}SET text TO time1:clock + " Reached 4000 meters altitude".PRINT text.LOG text TO logfile.SET text TO time1:clock + " Allowing pilot correction Control".PRINT text.LOG text TO logfile.UNLOCK throttle.SET ship:control:pilotmainthrottle TO 1.0.// Pilot correction controlWHEN (true) AND (ABS(ship:control:pilotpitch) > 0.9) THEN { SET crtvl TO ROUND(ship:control:pilotpitch). SET drect TO drect + R(crtvl,0,0). SET text TO time1:clock+" Pitch correction of "+crtvl+", direction pitch of "+ROUND(drect:pitch). LOG text TO logfile. PRESERVE.}WHEN (true) AND (ABS(ship:control:pilotyaw) > 0.9) THEN { SET crtvl TO ROUND(ship:control:pilotyaw). SET drect TO drect + R(0,crtvl,0). SET text TO time1:clock+" Yaw correction of "+crtvl+", direction yaw of "+ROUND(drect:yaw). LOG text TO logfile. PRESERVE.}WHEN (true) AND (ABS(ship:control:pilotroll) > 0.9) THEN { SET crtvl TO ROUND(ship:control:pilotroll). SET drect TO drect + R(0,0,crtvl). SET text TO time1:clock+" Roll correction of "+crtvl+", direction roll of "+ROUND(drect:roll). LOG text TO logfile. PRESERVE.}UNTIL (ship:altitude >= 24000) { IF (td >= 10) { SET t0 TO time1:seconds. SET text TO time1:clock+" alt:"+ROUND(ship:altitude)+" hdg:"+ROUND(ship:heading)+" sfr:"+ROUND(ship:surfacespeed)+" apo:"+ROUND(ship:apoapsis). LOG text TO logfile. } WAIT 0.5.}SET text TO time1:clock + " 24 thousands meters altitude reached".LOG text TO logfile.PRINT text.UNTIL (ship:apoapsis >= 69000) { IF (td >= 10) { SET t0 TO time1:seconds. SET text TO time1:clock+" alt:"+ROUND(ship:altitude)+" hdg:"+ROUND(ship:heading)+" sfr:"+ROUND(ship:surfacespeed)+" apo:"+ROUND(ship:apoapsis). LOG text TO logfile. } WAIT 0.5.}SET text TO time1:clock + " 69k Apoapsis reached".LOG text TO logfile.PRINT text.SET text TO time1:clock + " Closing Program".LOG text TO logfile.PRINT text.SET ship:control:pilotmainthrottle TO 0.0.UNLOCK steering.I'm trying to achieve a direction correction by reading on pilot input and then adding that input to the steering direction:// Pilot correction controlWHEN (true) AND (ABS(ship:control:pilotpitch) > 0.9) THEN { SET crtvl TO ROUND(ship:control:pilotpitch). SET drect TO drect + R(crtvl,0,0). SET text TO time1:clock+" Pitch correction of "+crtvl+", direction pitch of "+ROUND(drect:pitch). LOG text TO logfile. PRESERVE.}First issue it seems is that Input from pilot actually responds on the vessel, contradicting that pilot doesn't have control. Second it seems that input from the automated steering is also read as pilot input.AS a result first time I tried this instantly stopped the program for breaking the IPU limit as constantly reading input from the steering. I tried to solve this by limiting the condition to > 0.9 from input, so the ship navigates a bit more but still stops from too much processing inside WHEN loop. The WHEN is triggered several times before responding...Also there might be some oddities which adding of directions that I have yet to figure out. As for the triggers I thought they would only be check each cycle obeying the wait time inside the UNTIL loops, apparently it doesn't.I'll try to find a more elegant way for the coding, but still, the pilot command readings should only read on from actual commands and not from steering itself.On another note, I saw that some things in the Doc already begun to change. Nice! Be sure to check on cpu_hardware page, Its an important topic but doesn't show up on front page. Link to comment Share on other sites More sharing options...
Dunbaratu Posted November 26, 2014 Share Posted November 26, 2014 Seriously for Actual surface speed all you have to do is VESSEL:SURFACESPEED = number in m/s, as per doc.There is a significant different between vessel:surfacespeed and ship:velocity:surface:mag. They are only identical when you are actually ON the surface right now. When you are up in orbit, or flying in atmosphere they differ. Ship:velocity:surface is your 3-D velocity relative to the point at sea level of the surface directly under you. Vessel:surfacespeed, on the other hand, is a 2-D speed that ignores your vertical motion. For example, if you are aimed straight up and flying up at 100 m/s, ship:velocity:surface:mag will be 100, while vessel:surfacespeed will be 0.On another note, I saw that some things in the Doc already begun to change. Nice! Be sure to check on cpu_hardware page, Its an important topic but doesn't show up on front page.It's linked to from all the places where something mentions a thing related to it - like WHEN/ON triggers, the WAIT statement, and so on. Link to comment Share on other sites More sharing options...
Gfurst Posted November 27, 2014 Share Posted November 27, 2014 Hi, does anybody know how I can print the radar altitude? Not the "normal altitude". And also, does anybody know how to get the actual velocity (Surface/Orbit) without that it shows off the velocity in the three dimensions? Just as the velocity marker in the navball? There is a significant different between vessel:surfacespeed and ship:velocity:surface:mag. Yeah I've guess I misunderstand the direct meaning... Anyway, for what Kartofeelkchen looks SHIP:AIRSPEED should be enough: How fast the ship is moving relative to the air. KSP models atmosphere as simply a solid block of air "glued" to the planet surface (the weather on Kerbin is boring and there's no wind). Therefore airspeed is generally the same thing as as the magnitude of the surface velocity.It's linked to from all the places where something mentions a thing related to it - like WHEN/ON triggers, the WAIT statement, and so on.Still don't you think this is as a important enough topic to be mentioned in the front page? As a summary would do?Anyway, about the pilot command input stuff, no comment on that? Link to comment Share on other sites More sharing options...
erendrake Posted November 27, 2014 Author Share Posted November 27, 2014 Anyway, about the pilot command input stuff, no comment on that?I am usually the keeper of the tribal knowledge on the flight controls and i am currently coming out of complete incognito status after my wife was so kind as to give us a baby boy I added a new issue for this on github here :https://github.com/KSP-KOS/KOS/issues/425the pilot controls are a pretty new feature and i have to admit i never tested the them in conjunction with the autopilot so i never saw part of your issue. I consider that a bug that we might have a quick conversation to make sure we come to the correct conclusion. As far as the behavior of letting the pilot control stuff while the autopilot is on that was a feature request from users that didnt like that writing a terminal velocity or similar single axis of control script would lock out everything. I do see your point about creating a full fly by wire system you would want to be the man-in-the-middle and prevent any direct control. I think that leaving the way it is by default is fine and we could add a "lockout" function that does what you are asking for. Link to comment Share on other sites More sharing options...
Trewor007 Posted November 27, 2014 Share Posted November 27, 2014 Vector addition and subtraction works just like basic algebra: __\ __\ __\if: C + B = A __\ __\ __\then: C = A - Bi.e.SET vecC TO vecA - vecB.normaly that would do just fine but as can be seen on the pic below:the blue vector is my ship surface prograde.the red vector is my target position.and the green vector is target position - ship surface prograde.the green and red vector are so close they form a yellow line.When i was talking about adding and retracting vectors i meant constructing a vector that when pointed at will cause the angle between the blue and red vector to go to 0. probably something in style of this TRIM control. Link to comment Share on other sites More sharing options...
Dunbaratu Posted November 28, 2014 Share Posted November 28, 2014 the blue vector is my ship surface prograde.the red vector is my target position.and the green vector is target position - ship surface prograde.the green and red vector are so close they form a yellow line.When i was talking about adding and retracting vectors i meant constructing a vector that when pointed at will cause the angle between the blue and red vector to go to 0. probably something in style of this TRIM control.Why subtract a velocity from a position? They're not the same sort of thing.The basic concept of cancelling units is always a good thing for sanity checking. Just like when you do addition and subtraction on scalar numbers, when you do it on vectors you want to make sure the two vectors are measuring the same units. Position is meters, velocity is meters per second. Subtracting them directly doesn't give a valid meaningful answer in vectors for the same reason it doesn't in scalars.If all you need is the aim to be in the same direction as P, then try finding it experimentally during flight. Use NORMALIZED to erase the differences in magnitude and just look at the directions with trig.Like so: SET PNORM to TARGET:POSITION:NORMALIZED. SET VNORM to SHIP:VELOCITY:SURFACE:NORMALIZED.Now you can take the diff between them: SET NORMDIFF to VNORM-PNORM.Now you can get the component of that diff that is in the up direction (to get if it above or below the target). SET NORMDIFFUP TO VDOT( NORMDIFF, TARGET:UP:VECTOR ).Now NORMDIFFUP will be a number between 0.0 and 1.0. 0.0 means your velocity is in the same direction as the target. 1.0 means its perpendicular to it, upward. -1.0 means it's perpendicular below it. a value like +0.05 means you're a bit above it, and -0.05 means you're a bit below it.So you can keep recalculating that in a loop (or LOCK it to make it recalc it), and move your aim up or down a bit to bring that number to 0.0. If its > 0.0, aim more down. If it's < 0.0, aim more up. Use PID logic if you want that to be nice and smooth, or try with just plain P alone if that's good enough. Link to comment Share on other sites More sharing options...
whynot Posted November 29, 2014 Share Posted November 29, 2014 Hey everybody, just posting to see if anyone else is having this problem:The kOS processors detatches from the craft. It appears to be related to RemoteTech. I posted this bug: https://github.com/KSP-KOS/KOS/issues/428All input is appreciated!Cheers! Link to comment Share on other sites More sharing options...
Dexter9313 Posted November 30, 2014 Share Posted November 30, 2014 Hey everybody, just posting to see if anyone else is having this problem:The kOS processors detatches from the craft. It appears to be related to RemoteTech. I posted this bug: https://github.com/KSP-KOS/KOS/issues/428All input is appreciated!Cheers!I was going to post the exact same thing, although, by the description you are giving, I don't now if we are talking about the same bug or if we just don't analyze it the same way. To me, it's more like the ship's center of mass totally drifts from ship when it reaches 6000m at launch. The camera drops a few hundred meters below the ship and begins to rise at a constant rate as the ship goes away from it leading to wrong steering calculations and making the ship go nuts. I remember seeing the same bug about a year ago (more or less) at the beginning of RT integration in kOS.As far as I used this integration, I have not been able to tell if it was working or not anyway, commands being able to be sent when I had no link to KSC, kOS is not able to control the ship (throttle+steering) when there is no link and there is no signal delay for sent commands (I don't know what I should expect so I describe what it does not compared to the almost functional RT integration we had months ago). I remember at some point that this integration was disabled because of the trouble it was making, is it still the case or am I facing a bug ? If so, I'll try to post a detailed report, but I prefer to ask if there's a point doing so and if RT integration should be functional by now. Link to comment Share on other sites More sharing options...
Reddy Posted November 30, 2014 Share Posted November 30, 2014 YOU GUYS.Yesterday I noticed that my RT integration was disabled so I turned it on and forgot about it. Built a new vehicle, strapped in on my lifter and... the whole rocket exploded at 6km mark. Since the debug console got flooded with different messages (plus some from another mod), I looked at my construction for possible sources instead - checked for collisions, whether FAR shields everything... nada. Launched the craft a couple more times - everytime watching a huge explosion at 6km. I would be sitting there helpless if you didn't remind me of RT integration. I've just disabled it and the same rocket gets to orbit as it always did.Guess the issue is serious. Should I post some logs or anything? Link to comment Share on other sites More sharing options...
Dunbaratu Posted November 30, 2014 Share Posted November 30, 2014 I know next to nothing about RT integration but I can report that I had on several occasions in the past seen the bug where the camera ends up pointed well *behind* the ship as it ascends past 6000m. I noticed the problem never happened anymore recently, and I haven't been using RT at all recently - maybe the two are connected. I know that normally the camera points at the center of mass, and I sometimes saw along with this bug a weird case of one or two VERY LONG lines trailing out behind the ship, as if a piece of the ship was left behind but still being calculated as part of the ship, and I think the long lines were struts connecting to it. I also know that several mods (NOT koS) used to have problems that summoned the kracken at exactly 6000m many versions back. For a brief moment you'd see the red launching clamps reappear at 6000m, reattached to the ship, which would blow it up.Stock KSP does *something* weird at 6000m altitude. I don't know what it is but if you look very carefully you can see a few puffballs of white cloud always appear around the ship on the screen at 6000m as you launch a rocket. I have no idea why. I have a few random guesses though. I know that at some point as you raise altitude the game switches from "real ground" mode to "fake ground" mode. (where the ground is no longer composed of polygons with a real physical presence you can collide with, and is instead just a hologram to look at.) I also know that at some point as you ascend the frame of reference switches from universe-rotates-planet-is-still to planet-rotates-universe-is-still. Either one of those may cause a bit of a jolt teleportation of position when that happens. It may be that the puffballs you see are actually your own exhaust ahead of you, because you jumped a little bit in position as everything was recalculated to the new reference frame.I could see how that might really confuse the heck out of lots of mods, or even break a ship apart, or miscalculate the position of a part of the ship, making enter of mass calculations wrong.As to what to do to fix it, I have no clue. SQUAD would need to be a lot more forthcoming about what secret weird proprietary stuff they're doing at the 6000m mark. It's *something* weird, and it seems to confuse more mods than just ours. Link to comment Share on other sites More sharing options...
hvacengi Posted December 1, 2014 Share Posted December 1, 2014 More comments on the 6000m bug: I had experienced it briefly. I deleted the kOS folder and installed fresh from the download and it went away instantly (exact same ship, exact same script, literally 5min loading time apart). To make sure I was being kind of scientific, I loaded KSP multiple times before hand and tried multiple ships (a mix of space planes and rockets). Then I deleted the folder and installed from scratch, and haven't had a single issue with it since (I want to say it was Tuesday of last week, but I can't be sure).To be clear, I deleted the kOS folder entirely and then modified settings from within the game (I did not replace the settings file with the previous settings file, but the settings matched exactly). Link to comment Share on other sites More sharing options...
Dexter9313 Posted December 2, 2014 Share Posted December 2, 2014 Yeah, the way KSP works with mods is very strange sometimes. I had several issues with mods that could only be solved by reinstalling them (the most recent example I had is Atmospheric Trajectories that stops showing me trajectories sometimes and I have to reinstall it from scratch to make it work again even if the config files remain untouched). That's magic to me. I noticed that this kind of bugs can appear after a KSP crash. I recall encountering a bug where Kerbal Engineer stopped working after every KSP crash I encountered. I had to completely reinstall the mod to make it work again. I don't know why is KSP messing with dlls but I don't think it's a good sign on how it's been implemented. Link to comment Share on other sites More sharing options...
Astral_Nomad Posted December 2, 2014 Share Posted December 2, 2014 alright guys.. now that the script folder has been changed, where am i supposed to put my script files.. Ive tried everything, including the ships/scripts/ folder.. all I ever get is file not found and im getting highly annoyed. Link to comment Share on other sites More sharing options...
erendrake Posted December 2, 2014 Author Share Posted December 2, 2014 astral_nomad : we also changed extensions from *.txt to *.ks. have you updated your scripts? Link to comment Share on other sites More sharing options...
Astral_Nomad Posted December 2, 2014 Share Posted December 2, 2014 no.. becuase i didnt know about it.. stuff like that needs to be in the readme. I will do it now. Link to comment Share on other sites More sharing options...
Astral_Nomad Posted December 2, 2014 Share Posted December 2, 2014 what is the exact path from %KSPDIR% to where im supposed to put the file? and do i need to switch to archive first? cause im still not getting anything. Link to comment Share on other sites More sharing options...
erendrake Posted December 2, 2014 Author Share Posted December 2, 2014 %KSPDIR%\Ships\Script should get your scripts into the archive. The file extension change was in the changelog under https://github.com/KSP-KOS/KOS/blob/master/CHANGELOG.md#changes-breaking-old-scripts Link to comment Share on other sites More sharing options...
Dunbaratu Posted December 2, 2014 Share Posted December 2, 2014 no.. becuase i didnt know about it.. stuff like that needs to be in the readme. I will do it now.Did you not see a popup window on startup after updating that mentioned the movement and offered to move the files for you? It was supposed to appear and if it didn't that's a problem.It was mentioned in the changelog, and in the thread announcement, and the official HTML docs describe it in the new place. The readme is too small of a place to put everything. Link to comment Share on other sites More sharing options...
Astral_Nomad Posted December 4, 2014 Share Posted December 4, 2014 Steven - No.. I didnt -- or at least not that I noticed.. I might have inadverdantly clicked passed it on first load.. any way to trigger it again to be sure?Erendrake - I tried that location and I changed the extension to .ks - still file not found.. Link to comment Share on other sites More sharing options...
Astral_Nomad Posted December 4, 2014 Share Posted December 4, 2014 Okay.. Its finally deciding to co-operate... I dont know why it didnt the first time.. thanks for the help. Link to comment Share on other sites More sharing options...
Warringer Posted December 5, 2014 Share Posted December 5, 2014 Well, Gentlemen.After having found a near perfect launch trajectory for RSS 6.4x with FAR and RealFuels, I've decided to try and write a launcher script that makes use of that trajectory and can be used with any rocket.It worked well enough to get the rocket above tehe atmosphere during development. Then I tried to add a maneuver node part to for orbital insertation and it suddenly didn't work anymore.Something, I don't know what, keeps the throttle to 0, even though its locked to a variable tVal and should be used to adjust the TWR of the first stage (with solid boosters of the test rocket).launchtest.ksSET oldTWR TO 0.SET tVal TO 1.SET combthrust TO 0.SET direction to HEADING(0,90).LIST ENGINES IN engs.LOCK THROTTLE TO tVal.LOCK STEERING TO direction.RUN launchdisplay("Prelaunch", 0, 0, tVal, 0, 0, "Launch in 3!").Wait 1.RUN launchdisplay("Prelaunch", 0, 0, tVal, 0, 0, "Launch in 2!").Wait 1.RUN launchdisplay("Prelaunch", 0, 0, tVal, 0, 0, "Launch in 1!").print THROTTLE.wait 1.stage.wait 0.5.FOR eng IN engs { SET combthrust TO combthrust + eng:THRUST.}.SET TWR to combthrust / (MASS*9.81).print THROTTLE + ", " + tVal + ", " + TWR.until TWR <= 1.2 { SET tVal to (tVal - 0.02). SET combthrust TO 0. FOR eng IN engs { SET combthrust TO combthrust + eng:THRUST. }. SET TWR to combthrust / (MASS*9.81). print THROTTLE + ", " + tVal + ", " + TWR. wait 0.05.}SET oldTWR to 0.SET TWR to 0.RUN launchdisplay("First Stage + Boosters", combthrust, TWR, tVal, 0, 0, "Launch!").wait 0.5.stage.wait 0.5.SET message to "Launch!".SET timer to TIME + 10.WHEN timer = TIME THEN { SET message TO "". }.UNTIL oldTWR > TWR { SET oldTWR to TWR. LIST ENGINES IN engs. SET combthrust TO 0. FOR eng IN engs { SET combthrust TO combthrust + eng:THRUST. }. SET TWR to combthrust / (MASS*9.81). IF VELOCITY:SURFACE:MAG > 75 { SET direction to HEADING(90,ARCCOS(SHIP:ALTITUDE/40000)). }. RUN launchdisplay("First Stage + Boosters", combthrust, TWR, tVal, 0, 0, message). wait 0.5.}SET message to "Booster Separation!".SET timer to TIME + 10.WHEN timer = TIME THEN { SET message TO "". }.SET oldTWR to 0.SET TWR to 0.IF TWR < 1.2 { SET tVal to 1.}.wait 0.25.stage.wait 0.25.WHEN SHIP:ALTITUDE > 30000 THEN { SET direction to SHIP:SRFPROGRADE. WHEN SHIP:ALTITUDE > 50000 THEN { SET direction to SHIP:PROGRADE. }.}.UNTIL oldTWR > TWR { SET diffTWR to (TWR - oldTWR). SET oldTWR to TWR. LIST ENGINES IN engs. SET combthrust TO 0. FOR eng IN engs { SET combthrust TO combthrust + eng:THRUST. }. SET TWR to combthrust / (MASS*9.81). IF SHIP:ALTITUDE < 30000 { SET direction to HEADING(90,ARCCOS(SHIP:ALTITUDE/40000)). }. RUN launchdisplay("First Stage Main Core", combthrust, TWR, tVal, 0, 0, message). wait 0.5.}SET message to "Main Engine cutoff!".SET timer to TIME + 10.WHEN timer = TIME THEN { SET message TO "". }.stage.wait 0.25.SET tVal to 0.wait 0.25.stage.wait 0.25.SET Kerbin to BODY("Kerbin").SET apo to SHIP:APOAPSIS.SET apoVel to VELOCITYAT(SHIP, apo).SET circularVel to SQRT(Kerbin:MU / (apo + Kerbin:RADIUS)).SET circulNode to NODE(ETA:APOAPSIS, 0, 0, circularVel).ADD circulNode.Set DeltaV to circulNode:DETLAV:MAG.SET direction to circulNode.SET acc TO MAXTHRUST/MASS.SET burntime TO 0.5 * acc / DeltaV.SET save TO 5.LOCK Tminus to circulNode:ETA - burntime.WHEN circulNode:ETA < 120 THEN { AG1 ON. AG2 ON.}WHEN (TMinus + save > 300) THEN { SET WARP TO 4. WHEN (TMinus + save > 150) THEN { SET WARP TO 3. WHEN (TMinus + save > 30) THEN { SET WARP TO 2. WHEN (TMinus + save > 15) THEN { SET WARP TO 1. WHEN (TMinus + save > 5) THEN { SET WARP TO 0. }. }. }. }.}.UNTIL TMinus + save < 1 { RUN launchdisplay("Second Stage", 0, 0, 0, circulNode:DETLAV:MAG, circulNode:ETA, message).}SET message to "Second Stage Ignition!".SET timer to TIME + 10.WHEN timer = TIME THEN { SET message TO "". }.SET tVal to 1.WHEN (DeltaV < 50) THEN { SET tVal to 0.1. WHEN (DeltaV < 5) THEN { SET tVal to 0.025. }.}.UNTIL DeltaV < 0.5 { SET combthrust TO 0. FOR eng IN engs { SET combthrust TO combthrust + eng:THRUST. }. SET TWR to combthrust / (MASS*9.81). RUN launchdisplay("Second Stage", combthrust, TWR, tVal, circulNode:DETLAV:MAG, circulNode:ETA, message). wait 0.5.}SET message to "Orbital Insertion Complete!".SET timer to TIME + 10.WHEN timer = TIME THEN { SET message TO "". }.WAIT 15.launchdisplay.ksDECLARE PARAMETER title, thrust, twr, throttle, nodedv, eta, message.set seconds TO MOD(eta,60).set minutes to FLOOR(eta/60).CLEARSCREEN.print title at (14,2).print "Vehicle Data:" at (5,4).print "Orbital Velocity : " + ROUND(VELOCITY:ORBIT:MAG, 3) + "m/s" at (10,6).print "Surface Velocity : " + ROUND(VELOCITY:SURFACE:MAG, 3) + "m/s" at (10,7).print "Altitude : " + ROUND(SHIP:ALTITUDE, 3) + "m" at (10,8).print "Periapsis : " + ROUND(SHIP:APOAPSIS, 3) + "m" at (10,9).print "Apoapsis : " + ROUND(SHIP:PERIAPSIS, 3) + "m" at (10,10).print "Thrust : " + ROUND(thrust, 3) + "kN" at (10,11).print "TWR : " + ROUND(twr, 3) at (10,12).print "Throttle : " + ROUND(throttle * 100, 3) + "%" at (10,13).print "Node Data:" at (5,15).print "Delta-V : " + ROUND(nodedv, 3) + "m/s" at (10, 17).print "ETA : " + minutes + "m " + seconds + "s" at (10,18).print message at (5, 20).Can someone please tell me why it suddenly doesn't work as it should?And potential better ways of doing it. ;-) Link to comment Share on other sites More sharing options...
Dunbaratu Posted December 7, 2014 Share Posted December 7, 2014 Could the fact that you used the identifier "throttle" as the name of one of the parameters for launchdisplay.ks be causing the problem?See what happens if you rename that parameter of the launchdisplay program to some variable name you haven't used anywhere else, say tParam for example. If you try that, will it work? Link to comment Share on other sites More sharing options...
Warringer Posted December 7, 2014 Share Posted December 7, 2014 That turned out to be exactly the problem... >_> Link to comment Share on other sites More sharing options...
Recommended Posts