Dunbaratu Posted May 9, 2014 Share Posted May 9, 2014 Anyway, I have another wonder : have steering been heavily modified in .12 ? My probes don't handle good at all and my old "executenode" script which relies on a very stable vessel is of no use anymore. The spacecraft keeps trying to steer towards the node but it results in an "artificial wobble" which doesn't come from the structure but from the craft moving "around the vector" for 3°/4°, not being able to hold itself stricly along it. That is surely more "realistic" but I find it very annoying for maneuvers which require precision (I can't do better than 2 or 3 m/s precision now, I could do 0.1 before, no rcs required). It behaves almost like if the reaction wheel was not used.I get a lot of insane see-saw action from steering as of 0.12 but I don't know the cause of it. I have found that putting some mass radially out away from the center helps a lot. Making a craft that has a larger moment arm for rotations around its main axis, and therefore more rotational inertia seems to make the steering calm down. (i.e. put fuel tanks radially mounted on the side instead of having everything in one narrow stack). Link to comment Share on other sites More sharing options...
Dexter9313 Posted May 10, 2014 Share Posted May 10, 2014 I get a lot of insane see-saw action from steering as of 0.12 but I don't know the cause of it. I have found that putting some mass radially out away from the center helps a lot. Making a craft that has a larger moment arm for rotations around its main axis, and therefore more rotational inertia seems to make the steering calm down. (i.e. put fuel tanks radially mounted on the side instead of having everything in one narrow stack).Thank you for the advice, I'll try this but you rarely have a "large" vessel when you have achieved an LKO. Radially mounted tanks are more often used for lift-off, and even with that initial set up the rotational inertia isn't high enough to make it as stable as before. I'll investigate on this as well. Link to comment Share on other sites More sharing options...
Dunbaratu Posted May 10, 2014 Share Posted May 10, 2014 Thank you for the advice, I'll try this but you rarely have a "large" vessel when you have achieved an LKO. Radially mounted tanks are more often used for lift-off, and even with that initial set up the rotational inertia isn't high enough to make it as stable as before. I'll investigate on this as well.Oh, I don't think it's a good solution. Whatever is wrong needs to be looked at. I was just saying that the fact that this has worked might be a hint about what's going wrong. Triggering the problem (for me) has always required a ship with all its parts right on the central axis (a stack) and once even just a little bit of mass is off that axis the problem seems to go away. Link to comment Share on other sites More sharing options...
dr.phees Posted May 10, 2014 Share Posted May 10, 2014 I understand now, that Pitch, Yaw and Roll have to be read as the relation between vertical up (with inverted roll values) and the craft's root element.I am trying to get readings out of that, which reflect my navball readings (pitch, heading, roll). And, especially, I want to lock the steering to Heading, Pitch and Roll values that I can handle (aka Navball readings ). As I do want to set heading, pitch AND roll for a horizontally hovering craft, I cannot use Lock steering to Haeading(Pitch,Heading). (Maybe I am wrong here. If so, please enlighten me!)Does anyone have a sample code?ALSO:Is there a way to run an autorun.txt or so when booting a kOS unit? (I would mainly throw in a "switch to 0." command ) Link to comment Share on other sites More sharing options...
erendrake Posted May 10, 2014 Author Share Posted May 10, 2014 Is there a way to run an autorun.txt or so when booting a kOS unit? (I would mainly throw in a "switch to 0." command )A bootstrapper is part of the roadmap and im going to try to get it in to v13.0 Link to comment Share on other sites More sharing options...
erendrake Posted May 10, 2014 Author Share Posted May 10, 2014 (edited) NEW PRE-RELEASEUp on GithubAfter v12.0 we started finding a lot of bugs with steering and the "revert to launch" button. This is the first pre-release of v12.1On Github* Fixed Terminal linewrap @ the bottom of the terminal* Fixed "Revert to Launch" button, it was blowing up the world and not allowing control before* Fixed LOCK s in subprograms* Fixed RemoteTech integration blowing up everything* Fixed flight controls not releasing when they should Edited May 10, 2014 by erendrake Link to comment Share on other sites More sharing options...
Dunbaratu Posted May 10, 2014 Share Posted May 10, 2014 (edited) I understand now, that Pitch, Yaw and Roll have to be read as the relation between vertical up (with inverted roll values) and the craft's root element.Uhhh... SORT of. It's actually a rotation from the KSP's native XYZ system (this many degrees rotated from whichever way the X axis is pointed, this many degrees away from whichever way the Y axis is pointed, etc). KSP's native XYZ system is a bit messy (Okay it's VERY messy) because of all the weird tricks SQUAD had to do to avoid the floating point precision problems that would come from using large coordinate numbers.It's usually best to force the rotation into a frame of mind you can make sense of, by using one of the existing known rotations first and then adding more rotation after that. For example this:lock steering to up + R(30,0,0).Will pick a rotation that's 30 degrees deflected from whichever way "up" is at the moment in the XYZ coordinate system. That's because "Up" is a special keyword that means "whichever rotation gets you from the Z axis (0,0,1) rotated up to pointing away from the planet center right now."TO make a rotation relative to the ship's current direction, use the special value "FACING", like so:set curFace to SHIP:Facing.lock steering to curFace + R(30,0,0).To rotate 30 degrees off from the current pointing direction. The reason for the extra step of 'set curFace ..." is because if you locked steering to something relative to the current ship facing directly, then it would continually update like that, and keep spinning more and more because it would be constantly saying "always keep trying to point 30 degrees off from whatever you are currently pointing at."I am trying to get readings out of that, which reflect my navball readings (pitch, heading, roll). And, especially, I want to lock the steering to Heading, Pitch and Roll values that I can handle (aka Navball readings ). As I do want to set heading, pitch AND roll for a horizontally hovering craft, I cannot use Lock steering to Haeading(Pitch,Heading). (Maybe I am wrong here. If so, please enlighten me!)Using HEADING() does point the ship according to the navball, but doesn't let you pick the roll. You get whatever you happen to get. For rockets this is fine, but for planes it's not quite enough.If you need to control everything exactly, and do it relative to the ship's own orientation, I recommend giving the RAW controls a try instead. They let your script directly control the craft, as if your script had its "hands" on the W,A,S,D,Q, and E keys, instead of letting the mod try to abstract the work for you. More about it here: http://ksp-kos.github.io/KOS_DOC/summary_topics/ship_control/ (scroll about halfway down the page to the part entitled "Raw Control".)ALSO:Is there a way to run an autorun.txt or so when booting a kOS unit? (I would mainly throw in a "switch to 0." command )It's on the list of features to implement "any day now". At the moment a lot of those features are on hold as there's important bug fixes being worked on in regards to user controls getting locked out when they shouldn't be. Several ideas have been bandied about about how to do the auto-run idea, one of which was to let you put commands inside the craft description field in the VAB and they run any time that craft is loaded onto the launchpad. But the idea isn't set in stone yet. But it is true that the devs want to implement some type of auto-loading. At the moment it's not there yet. Edited May 10, 2014 by Steven Mading Link to comment Share on other sites More sharing options...
Ralathon Posted May 10, 2014 Share Posted May 10, 2014 With this 12.1 prerelease and RemoteTech I'm getting stack overflows when I repeatedly loop this:if stageStatus = 0 { // Check for flameout of any of the existing engines: set stg_numF to 0. list engines in stg_eList. for stg_eng in stg_eList { if stg_eng:flameout { set stg_numF to stg_numF + 1. }. }. if stg_numF > 0 { set stageStatus to 2. set stageMsg to stg_numF + " engine(s) flamed out". }.}.So I suspect something in this code is leaking memory where it formerly didn't. Link to comment Share on other sites More sharing options...
dr.phees Posted May 10, 2014 Share Posted May 10, 2014 Will pick a rotation that's 30 degrees deflected from whichever way "up" is at the moment in the XYZ coordinate system. That's because "Up" is a special keyword that means "whichever rotation gets you from the Z axis (0,0,1) rotated up to pointing away from the planet center right now."And that's my problem When launching a vertically built ship, everything works fine. But controlling a spaceplane via R(a,b,c) is more complicated. It basically is a vector-matrix multiplication, but I still have to figure out the matrix. (Both, to translate the Facing into Navball compliance as back.)As for the bootstrapping: Yay! Link to comment Share on other sites More sharing options...
erendrake Posted May 10, 2014 Author Share Posted May 10, 2014 So I suspect something in this code is leaking memory where it formerly didn't.So far i am unable to reproduce this. If you shoot me a craft and kOSscript file that shows the error it will help a lot. Link to comment Share on other sites More sharing options...
Vulkan Posted May 10, 2014 Share Posted May 10, 2014 Am I right in thinking that lock:steering does not make use of engine gimbals? I'm trying to do a kOS career and so have no torque or aerodynamics as yet. With an LV-T45 under an unmanned probe (edited the tech tree to give me one at the start) I can runset ship:control:yaw to 0.5.lock throttle to 1.stage.and go into a nice sidespin butlock steering to heading(90,45)lock throttle to 1.stage.goes straight up. If so is ther a workaround beyond of any kind?Thanks in advance. Link to comment Share on other sites More sharing options...
erendrake Posted May 10, 2014 Author Share Posted May 10, 2014 (edited) Am I right in thinking that lock:steering does not make use of engine gimbals? I'm trying to do a kOS career and so have no torque or aerodynamics as yet. With an LV-T45 under an unmanned probe (edited the tech tree to give me one at the start) I can runset ship:control:yaw to 0.5.lock throttle to 1.stage.and go into a nice sidespin butlock steering to heading(90,45)lock throttle to 1.stage.goes straight up. If so is ther a workaround beyond of any kind?Thanks in advance.the algorithm for LOCK STEERING is pretty rough and yes it does not count engine torque when determining steering. Luckily you can take direct control of all of the flight controls and steer yourself. Info on how to do so is here: http://ksp-kos.github.io/KOS_DOC/summary_topics/ship_control/EDIT: If you have engine torque it will use it the same as normal steering, but if all you have is engine torque it doesnt think you can steer so it doesnt bother. Edited May 10, 2014 by erendrake Link to comment Share on other sites More sharing options...
dr.phees Posted May 10, 2014 Share Posted May 10, 2014 What does "out of sync" mean?I was returning to KSC using my hover program and suddenly, about 200m from the VAB, I got the message "out of sync" and my craft crashed. Link to comment Share on other sites More sharing options...
Vulkan Posted May 10, 2014 Share Posted May 10, 2014 the algorithm for LOCK STEERING is pretty rough and yes it does not count engine torque when determining steering. Luckily you can take direct control of all of the flight controls and steer yourself. Info on how to do so is here: http://ksp-kos.github.io/KOS_DOC/summary_topics/ship_control/EDIT: If you have engine torque it will use it the same as normal steering, but if all you have is engine torque it doesnt think you can steer so it doesnt bother.Thanks very much, that explains things. Looks like it's time to brush the dust of my pid control notes. Link to comment Share on other sites More sharing options...
erendrake Posted May 10, 2014 Author Share Posted May 10, 2014 Thanks very much, that explains things. Looks like it's time to brush the dust of my pid control notes.Sweet! I cant wait to see what you come up with. Link to comment Share on other sites More sharing options...
marianoapp Posted May 10, 2014 Share Posted May 10, 2014 Also SAS needs to be off for LOCK STEERING to work. Link to comment Share on other sites More sharing options...
sfr1000 Posted May 11, 2014 Share Posted May 11, 2014 ok new to ksp forum, mainly to keep up to date with this mod. switch to 0 (each time)/no file saving? is this the current limit of this mod or have i installed incorrectly. sorry if this has been covered already! its a big thread. Link to comment Share on other sites More sharing options...
BadRocketsCo. Posted May 11, 2014 Share Posted May 11, 2014 Now, I am not sure, if this mod detects the RealFuels resources. Would 'wait until stage:kerosene (equals) 0. stage.' work? Link to comment Share on other sites More sharing options...
Ralathon Posted May 11, 2014 Share Posted May 11, 2014 Now, I am not sure, if this mod detects the RealFuels resources. Would 'wait until stage:kerosene (equals) 0. stage.' work?yes, it works. Link to comment Share on other sites More sharing options...
Dunbaratu Posted May 11, 2014 Share Posted May 11, 2014 ok new to ksp forum, mainly to keep up to date with this mod. switch to 0 (each time)/no file saving? is this the current limit of this mod or have i installed incorrectly. sorry if this has been covered already! its a big thread.What limit? I can't understand the way you worded your question. Link to comment Share on other sites More sharing options...
airbus a320 Posted May 11, 2014 Share Posted May 11, 2014 (edited) Does anyone have a good formula for calculating the ascent lean angle?I'm writing an ascent script. Initially i tried to bind lean angle to altitude linearly, but it was too "slow", so i tried sqrt(altitude) that is "faster" around 0, then sqrt(sqrt(altitude)) ... but i think it's still far to optimal.Here is my code. There is a nice PID controller for the throttle that lock ascent speed to the terminal velocity, a staging loop that works with asparagus (i found here on the forum i guess)Without comments and indentations it's about 1600kb[COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]thr [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]1[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#0080FF][/COLOR][COLOR=#249B24][B]lock [/B][/COLOR][COLOR=#C0C0C0]tv [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#AFAF76][B]ship[/B][/COLOR][COLOR=#0080FF]:[/COLOR][COLOR=#C0C0C0]termvelocity[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]// disc space economy![/I][/COLOR][COLOR=#249B24][B]lock [/B][/COLOR][COLOR=#C0C0C0]vs [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#AFAF76][B]verticalspeed[/B][/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]//[/I][/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]trg [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]100000[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]// Target altitude[/I][/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]dt [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]0.1[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]// [dt] is "delta time" for integration/differntiation in PID controller.[/I][/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]prerr [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]0[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]// [prerr] and [int] are starting values for PID loop[/I][/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]int [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]0[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]//[/I][/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]Kp [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]0.0018[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]// [Kp] is the proportional response. It's 1/6th of the critical gain (Ziegler–Nichols method)[/I][/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]period [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]10[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]// [Period] is the oscillation frequency at critical gain.[/I][/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]Ki [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]2[/COLOR][COLOR=#0080FF]*[/COLOR][COLOR=#C0C0C0]Kp[/COLOR][COLOR=#0080FF]/[/COLOR][COLOR=#C0C0C0]period[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]// [Ki] and [Kd] are the integral and differential response.[/I][/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]Kd [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#C0C0C0]Kp[/COLOR][COLOR=#0080FF]*[/COLOR][COLOR=#FF82FF]10[/COLOR][COLOR=#0080FF]/[/COLOR][COLOR=#C0C0C0]period[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]clearscreen[/B][/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]lock [/B][/COLOR][COLOR=#AFAF76][B]throttle [/B][/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#C0C0C0]thr[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]lock [/B][/COLOR][COLOR=#AFAF76][B]steering [/B][/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#AFAF76][B]up [/B][/COLOR][COLOR=#0080FF]+ [/COLOR][COLOR=#B48045][B]R[/B][/COLOR][COLOR=#0080FF]([/COLOR][COLOR=#FF82FF]0[/COLOR][COLOR=#0080FF],[/COLOR][COLOR=#FF82FF]0[/COLOR][COLOR=#0080FF],[/COLOR][COLOR=#FF82FF]180[/COLOR][COLOR=#0080FF]).[/COLOR][COLOR=#249B24][B]stage[/B][/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]// Let's go![/I][/COLOR][COLOR=#249B24][B]print [/B][/COLOR][COLOR=#FF8040]"All aboard!"[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#249B24][B]Print [/B][/COLOR][COLOR=#FF8040]" "[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]print [/B][/COLOR][COLOR=#FF8040]"There are some issues with the LOCK STEERING"[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#249B24][B]print [/B][/COLOR][COLOR=#FF8040]"function. If your vessel starts oscillating"[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#249B24][B]print [/B][/COLOR][COLOR=#FF8040]"without control try to recover it with SAS"[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#249B24][B]Print [/B][/COLOR][COLOR=#FF8040]" "[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#9BC89B][I]//lock gLoc to body:mu/((altitude+body:radius)^2).//lock twr to maxthrust/(gLoc*mass).//lock curtwr to twr*thr.[/I][/COLOR][COLOR=#249B24][B]wait until [/B][/COLOR][COLOR=#C0C0C0]tv[/COLOR][COLOR=#0080FF]-[/COLOR][COLOR=#C0C0C0]vs [/COLOR][COLOR=#0080FF]< ([/COLOR][COLOR=#FF82FF]-1[/COLOR][COLOR=#0080FF]). [/COLOR][COLOR=#9BC89B][I]// Wait until speed is close to terminal velocity for the first time before starting PID controlling.[/I][/COLOR][COLOR=#249B24][B]until [/B][/COLOR][COLOR=#AFAF76][B]altitude [/B][/COLOR][COLOR=#0080FF]> [/COLOR][COLOR=#FF82FF]10000[/COLOR][COLOR=#0080FF]{ [/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]err [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#C0C0C0]tv [/COLOR][COLOR=#0080FF]- [/COLOR][COLOR=#C0C0C0]vs[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]// PID controller algorithm based on pseudocode found on wikipedia [/I][/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]int [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#C0C0C0]int [/COLOR][COLOR=#0080FF]+ [/COLOR][COLOR=#C0C0C0]err[/COLOR][COLOR=#0080FF]*[/COLOR][COLOR=#C0C0C0]dt[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]// [/I][/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]der [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#0080FF]([/COLOR][COLOR=#C0C0C0]err [/COLOR][COLOR=#0080FF]- [/COLOR][COLOR=#C0C0C0]prerr[/COLOR][COLOR=#0080FF])/[/COLOR][COLOR=#C0C0C0]dt[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]// [/I][/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]out [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#C0C0C0]Kp[/COLOR][COLOR=#0080FF]*[/COLOR][COLOR=#C0C0C0]err [/COLOR][COLOR=#0080FF]+ [/COLOR][COLOR=#C0C0C0]Ki[/COLOR][COLOR=#0080FF]*[/COLOR][COLOR=#C0C0C0]int [/COLOR][COLOR=#0080FF]+ [/COLOR][COLOR=#C0C0C0]Kd[/COLOR][COLOR=#0080FF]*[/COLOR][COLOR=#C0C0C0]der[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]// [/I][/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]prerr [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#C0C0C0]err[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]// [/I][/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]thr [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#C0C0C0]thr [/COLOR][COLOR=#0080FF]+ [/COLOR][COLOR=#C0C0C0]out[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]// [/I][/COLOR][COLOR=#249B24][B]if [/B][/COLOR][COLOR=#C0C0C0]thr [/COLOR][COLOR=#0080FF]> [/COLOR][COLOR=#FF82FF]1 [/COLOR][COLOR=#0080FF]{[/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]thr [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]1[/COLOR][COLOR=#0080FF].}. [/COLOR][COLOR=#9BC89B][I]// [/I][/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]numOut [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]0[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]// When an engine flameouts probably it's out of fuel, it's staging time!!! [/I][/COLOR][COLOR=#249B24][B]list engines in [/B][/COLOR][COLOR=#C0C0C0]englist[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]// Works with asparagus staging. [/I][/COLOR][COLOR=#249B24][B]for [/B][/COLOR][COLOR=#C0C0C0]eng [/COLOR][COLOR=#249B24][B]in [/B][/COLOR][COLOR=#C0C0C0]englist [/COLOR][COLOR=#0080FF]{[/COLOR][COLOR=#249B24][B]if [/B][/COLOR][COLOR=#C0C0C0]eng[/COLOR][COLOR=#0080FF]:[/COLOR][COLOR=#C0C0C0]flameout [/COLOR][COLOR=#0080FF]{[/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]numOut [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#C0C0C0]numOut [/COLOR][COLOR=#0080FF]+ [/COLOR][COLOR=#FF82FF]1[/COLOR][COLOR=#0080FF].}.}. [/COLOR][COLOR=#9BC89B][I]// [/I][/COLOR][COLOR=#249B24][B]if [/B][/COLOR][COLOR=#C0C0C0]numOut [/COLOR][COLOR=#0080FF]> [/COLOR][COLOR=#FF82FF]0 [/COLOR][COLOR=#0080FF]{[/COLOR][COLOR=#249B24][B]stage[/B][/COLOR][COLOR=#0080FF].}. [/COLOR][COLOR=#9BC89B][I]// // print "vs-tv = " + (vs-tv) at (0,3). // Debug strings // print "out = " + out at (0,4). // [/I][/COLOR][COLOR=#249B24][B]wait [/B][/COLOR][COLOR=#C0C0C0]dt[/COLOR][COLOR=#0080FF].}.[/COLOR][COLOR=#249B24][B]lock [/B][/COLOR][COLOR=#C0C0C0]lean [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]-1 [/COLOR][COLOR=#0080FF]* ([/COLOR][COLOR=#B48045][B]sqrt[/B][/COLOR][COLOR=#0080FF]([/COLOR][COLOR=#B48045][B]sqrt[/B][/COLOR][COLOR=#0080FF]([/COLOR][COLOR=#AFAF76][B]altitude[/B][/COLOR][COLOR=#FF82FF]-10000[/COLOR][COLOR=#0080FF]))*[/COLOR][COLOR=#FF82FF]6[/COLOR][COLOR=#0080FF]). [/COLOR][COLOR=#9BC89B][I]// Ascent path. I couldn't find a better formula...[/I][/COLOR][COLOR=#249B24][B]when [/B][/COLOR][COLOR=#C0C0C0]lean [/COLOR][COLOR=#0080FF]< [/COLOR][COLOR=#FF82FF]-90 [/COLOR][COLOR=#249B24][B]then [/B][/COLOR][COLOR=#0080FF]{[/COLOR][COLOR=#249B24][B]unlock [/B][/COLOR][COLOR=#C0C0C0]lean[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]lean [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]-90[/COLOR][COLOR=#0080FF].}.[/COLOR][COLOR=#249B24][B]lock [/B][/COLOR][COLOR=#AFAF76][B]steering [/B][/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#AFAF76][B]up [/B][/COLOR][COLOR=#0080FF]+ [/COLOR][COLOR=#B48045][B]R[/B][/COLOR][COLOR=#0080FF]([/COLOR][COLOR=#FF82FF]0[/COLOR][COLOR=#0080FF],[/COLOR][COLOR=#FF82FF]0[/COLOR][COLOR=#0080FF],[/COLOR][COLOR=#FF82FF]-90[/COLOR][COLOR=#0080FF]) + [/COLOR][COLOR=#B48045][B]R[/B][/COLOR][COLOR=#0080FF]([/COLOR][COLOR=#FF82FF]0[/COLOR][COLOR=#0080FF],[/COLOR][COLOR=#C0C0C0]lean[/COLOR][COLOR=#0080FF],[/COLOR][COLOR=#FF82FF]0[/COLOR][COLOR=#0080FF]).[/COLOR][COLOR=#249B24][B]print [/B][/COLOR][COLOR=#FF8040]"Woah dude! Is it leaning?!"[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#249B24][B]Print [/B][/COLOR][COLOR=#FF8040]" "[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]wait [/B][/COLOR][COLOR=#FF82FF]5[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]thr [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]1[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]// Full throttle toward infinity![/I][/COLOR][COLOR=#249B24][B]until [/B][/COLOR][COLOR=#AFAF76][B]apoapsis [/B][/COLOR][COLOR=#0080FF]> ([/COLOR][COLOR=#C0C0C0]trg [/COLOR][COLOR=#0080FF]+ [/COLOR][COLOR=#FF82FF]500[/COLOR][COLOR=#0080FF]) [/COLOR][COLOR=#9BC89B][I]// Staging ...[/I][/COLOR][COLOR=#0080FF]{ [/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]numOut [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]0[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#249B24][B]list engines in [/B][/COLOR][COLOR=#C0C0C0]englist[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#249B24][B]for [/B][/COLOR][COLOR=#C0C0C0]eng [/COLOR][COLOR=#249B24][B]in [/B][/COLOR][COLOR=#C0C0C0]englist [/COLOR][COLOR=#0080FF]{[/COLOR][COLOR=#249B24][B]if [/B][/COLOR][COLOR=#C0C0C0]eng[/COLOR][COLOR=#0080FF]:[/COLOR][COLOR=#C0C0C0]flameout [/COLOR][COLOR=#0080FF]{[/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]numOut [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#C0C0C0]numOut [/COLOR][COLOR=#0080FF]+ [/COLOR][COLOR=#FF82FF]1[/COLOR][COLOR=#0080FF].}.}. [/COLOR][COLOR=#249B24][B]if [/B][/COLOR][COLOR=#C0C0C0]numOut [/COLOR][COLOR=#0080FF]> [/COLOR][COLOR=#FF82FF]0 [/COLOR][COLOR=#0080FF]{[/COLOR][COLOR=#249B24][B]stage[/B][/COLOR][COLOR=#0080FF].}. [/COLOR][COLOR=#249B24][B]wait [/B][/COLOR][COLOR=#FF82FF]0.1[/COLOR][COLOR=#0080FF].}.[/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]thr [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]0[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]print [/B][/COLOR][COLOR=#FF8040]"Wait for circularizing burn..."[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#249B24][B]Print [/B][/COLOR][COLOR=#FF8040]" "[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]wait [/B][/COLOR][COLOR=#FF82FF]1[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#AFAF76][B]warp [/B][/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]3[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#9BC89B][I]// Warping to apoapsis[/I][/COLOR][COLOR=#249B24][B]wait until [/B][/COLOR][COLOR=#AFAF76][B]altitude[/B][/COLOR][COLOR=#0080FF]>[/COLOR][COLOR=#FF82FF]70000[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#AFAF76][B]warp [/B][/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]0[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]wait [/B][/COLOR][COLOR=#FF82FF]2[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#AFAF76][B]warp [/B][/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]3[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]wait until [/B][/COLOR][COLOR=#AFAF76][B]eta[/B][/COLOR][COLOR=#0080FF]:[/COLOR][COLOR=#C0C0C0]apoapsis [/COLOR][COLOR=#0080FF]< [/COLOR][COLOR=#FF82FF]60[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#AFAF76][B]warp [/B][/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]0[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]wait until [/B][/COLOR][COLOR=#AFAF76][B]eta[/B][/COLOR][COLOR=#0080FF]:[/COLOR][COLOR=#C0C0C0]apoapsis [/COLOR][COLOR=#0080FF]< [/COLOR][COLOR=#FF82FF]25[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]lock [/B][/COLOR][COLOR=#AFAF76][B]steering [/B][/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#AFAF76][B]prograde[/B][/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]wait until [/B][/COLOR][COLOR=#AFAF76][B]eta[/B][/COLOR][COLOR=#0080FF]:[/COLOR][COLOR=#C0C0C0]apoapsis [/COLOR][COLOR=#0080FF]< [/COLOR][COLOR=#FF82FF]7[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]set [/B][/COLOR][COLOR=#C0C0C0]thr [/COLOR][COLOR=#249B24][B]to [/B][/COLOR][COLOR=#FF82FF]1[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]print [/B][/COLOR][COLOR=#FF8040]"Burn like hell!"[/COLOR][COLOR=#0080FF]. [/COLOR][COLOR=#249B24][B]Print [/B][/COLOR][COLOR=#FF8040]" "[/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]wait until [/B][/COLOR][COLOR=#AFAF76][B]periapsis [/B][/COLOR][COLOR=#0080FF]> ([/COLOR][COLOR=#C0C0C0]trg [/COLOR][COLOR=#0080FF]- [/COLOR][COLOR=#FF82FF]500[/COLOR][COLOR=#0080FF]).[/COLOR][COLOR=#249B24][B]unlock all[/B][/COLOR][COLOR=#0080FF].[/COLOR][COLOR=#249B24][B]wait [/B][/COLOR][COLOR=#FF82FF]4[/COLOR][COLOR=#0080FF].[/COLOR]I tried to fix the LOCK STEERING weirdness with the PID controller but it's too hard for me! Edited May 11, 2014 by airbus a320 Link to comment Share on other sites More sharing options...
Dunbaratu Posted May 11, 2014 Share Posted May 11, 2014 Does anyone have a good formula for calculating the ascent lean angle?I'm writing an ascent script. Initially i tried to bind lean angle to altitude linearly, but it was too "slow", so i tried sqrt(altitude) that is "faster" around 0, then sqrt(sqrt(altitude)) ... but i think it's still far to optimal.I've heard some people had success with just aiming based on how high your apoapsis is compared to your current altitude. If the apoapsis is a lot higher than your current altitude, then you've got enough momentum that you need to pitch down. If your apopapsis is not high enough above your current altitude than you're aiming too far horizontally for your momentum and will probably fall back in. So dynamically adjust your pitch to keep your apoapsis-altitude to a fixed constant amount. I haven't tried this technique myself (I use the srqt method similar to what you use) but it seems sound. The problem with picking a fixed pre-determined path is that it doesn't adjust to the different TWR's of different craft. The optimal shape of the path is not the same for every rocket. The apoapsis-altitude thing sounds like a good idea I'd like to try at some point, but at the moment I've shifted focus to joining the devs underneath the hood so I haven't written a new script in a while.(P.S. How did you get the BBCODE [ color ] tags inserted into your posted content like that. I assume you didn't manually type them all in and you have a program doing it for you that's aware of the syntax of kOS.) Link to comment Share on other sites More sharing options...
airbus a320 Posted May 11, 2014 Share Posted May 11, 2014 I've heard some people had success with just aiming based on how high your apoapsis is compared to your current altitude. If the apoapsis is a lot higher than your current altitude, then you've got enough momentum that you need to pitch down. If your apopapsis is not high enough above your current altitude than you're aiming too far horizontally for your momentum and will probably fall back in. So dynamically adjust your pitch to keep your apoapsis-altitude to a fixed constant amount. I haven't tried this technique myself (I use the srqt method similar to what you use) but it seems sound. The problem with picking a fixed pre-determined path is that it doesn't adjust to the different TWR's of different craft. The optimal shape of the path is not the same for every rocket. The apoapsis-altitude thing sounds like a good idea I'd like to try at some point, but at the moment I've shifted focus to joining the devs underneath the hood so I haven't written a new script in a while.(P.S. How did you get the BBCODE [ color ] tags inserted into your posted content like that. I assume you didn't manually type them all in and you have a program doing it for you that's aware of the syntax of kOS.)Thank you, right now i'm rewriting the same equation turning the sqrt into an exponential (something like (altitude-10000)^(1/4)) so the coefficients' roles are more intuitive... i'll try to lock the apo-alt difference to the lean angle with a negative feedback (PID algorythm)Do you know if someone has already wrote an alternative script for the LOCK STEERING function? When i tried by myself i broke everything! The direction i want to follow is in the navball's vector basis, the error as well, but the pitch/yaw/roll adjustements are in the vessel vector basis, so i think there should be a rotation/translation. It doesn't look that hard but what will happen if i try to steer around the 0°/360° direction? i'll get a wrong error reading, i'm not sure if i can just do something like IF error>half_range THEN error=(error-half_range) ...i'm using this tool for writing (http://forum.kerbalspaceprogram.com/threads/62834-Saturn-yet-another-kOS-IDE) Link to comment Share on other sites More sharing options...
Elliptical Orbit Posted May 11, 2014 Share Posted May 11, 2014 Does anyone have a good formula for calculating the ascent lean angle?I'm writing an ascent script. Initially i tried to bind lean angle to altitude linearly, but it was too "slow", so i tried sqrt(altitude) that is "faster" around 0, then sqrt(sqrt(altitude)) ... but i think it's still far to optimal.I tried to fix the LOCK STEERING weirdness with the PID controller but it's too hard for me!The best results I had was back in 21.1 and using Mechjeb and KOS at the same time. Mechjeb did all the ascent guidance and KOS did all the mechanicals and it worked perfect. I would just setup my plan in to Mechjeb and manually engage the auto pilot, then go start my script in KOS sit back and watch the show.The one thing that I can’t get to work in this newest version is the ability to lock the throttle to positions I want the engines to have with Mechjeb engaged. It seems not to work in this version and I know that in the older version I have for 21.1 Kevin has had this issue before and fixed it. I want to say that those file versions was either 8.x or 9.x. So at the moment I have to engage Mechjeb after my vehicles leave the ground but I still have no throttle control using KOS. Wonder if this can be possibly looked at? Link to comment Share on other sites More sharing options...
sfr1000 Posted May 12, 2014 Share Posted May 12, 2014 What i mean is when I run KOS every time i need to type switch to 0, and place my txt file out side the gamedata folder to be read ( J:\Program Files\Steam\steamapps\common\Kerbal Space Program\Plugins\PluginData\Archive ), then its fine. also i have seen vids of scipts being edited in the KOS UI and saved from there I can't do this! I wondered if it was the 2.35 update and KOS was being modified to correct this? (current limits) or like I suspect i have installed incorrectly. this mod is the No1 mod 4 me i would love it to function correctly. (archives the only problem 4 me)It would be perfect if the script could be loaded from my public documents so i can edit it on my laptop, My goal is to be able to control my rover over wifi or even the net. only seeing what its cameras can see (like real missions).a simple config file for the archive directory would solve this. Link to comment Share on other sites More sharing options...
Recommended Posts