Jump to content

[1.0.5] GravityTurn version 1.3.1 - Automated Efficient Launches (1.1 pre-release available)


Overengineer1

Recommended Posts

Launch a craft into a low orbit with a few customizable settings.

HxgCx6P.png

Performing a Gravity Turn is arguably the most efficient launch procedure.  The plugin will take care of the entire ascent for you by maintaining a strict hold to prograde (as much as possible) and varying the throttle to keep the desired ascent curvature. The circularization burn will be up to you, but it's normally less than 50 m/s.

The "Best Guess" button tries to find the best settings for a particular rocket. Here's the best I've seen it do so far, 80km orbit in 2987m/s: http://gfycat.com/WellmadeDefiantBlueshark

Download the mod Here

View the source Here

Get the unstable 1.1 pre-release DLL Here

License: GPL V3

Requirements:  None.  (Optional: MechJeb for circularization burn)

Features of this version:

  • Learning system: Learn from previous launches, trying to find the most efficient settings
  • Staging improvements: New StageSettings window to fine tune to your preferences
  • Lift improvement: No more wobbling during initial lift, delay pitch correction until after 45 degrees
  • SRB improvement: Fade HoldAPTime down from wherever the SRB burns out, instead of cutting the throttle all the way back

Previous updates:

  • MechJeb Integration: If a MechJeb module is on board, order it to do a circularization burn after ascent (by popular demand)
  • Auto-detect launch TWR and guess best ascent settings.
  • Destination orbit inclination.
  • Persistent settings per-ship per-planet
  • Detailed loss/burn info for fine tuning settings
  • More aggressive ascent guess for SRB rockets based on max TWR.
  • Better tracking of initial turn heading.
  • Pitch adjustment in upper atmosphere for very low TWR upper stages.
  • More intelligent triggering of procedural fairing stages based on dynamic pressure.
  • Maintain control through to atmosphere exit

 

Some notes on numbers:

Gravity will continue to reduce your orbital speed up until AP. That has to be accounted for, otherwise the numbers wouldn't match up between what you burn, the coriolis you started with, what you end up with at orbit, and the calculated losses. A steeper ascent will result in a much higher gravity loss after the burn than GT's shallow ascents.

Gravity drag is calculated as the dot product of gravity's downward force and your normalized orbital velocity. This is tracked up to the current moment, and then extrapolated into the future to the AP by simply taking the velocity difference between now and the AP.

Thrust vector drag is the difference between your thrust vector and your orbital velocity.

You'll notice that thrust vector drag starts off being very large, because you're burning orthogonal to your orbital velocity due to coriolis. Gravity loss starts at zero, because gravity is also orthogonal to your orbital velocity for the same reason.

Each drag value is summed into an overall loss by multiplying by the time interval (a fraction of a second at a time) as the launch progresses.

Total Burn will not match what you see in KER or MechJeb vacuum stats.  GT will show you the actual total burn, not the idealized vacuum burn.  Because your thrust is always lower at launch than it is in vacuum, the actual Total Burn delta-v will thus be lower than the same amount of fuel burned in vacuum.  This number is tracked just like drag and loss, by summing the instantaneous thrust divided by the instantaneous mass times the time interval many times per second.

You should notice that your final orbital speed will match Total Burn - Total Loss + Coriolis (175 for a zero inclination launch) within a few m/s.

Edited by Overengineer1
Link to comment
Share on other sites

Great idea!  Any particular reason for NOT having it automatically execute the circularization burn?  If it's just a case of 'haven't wanted to deal with the math,' I'm willing to help figure it out!

Also...  one more suggestion - I think it would be VERY useful to give the plugin the ability to run an action group after launch.  Obviously not everyone needs that, but if you added a checkbox that togged action group 0 after the circularization burn, that would allow people to put solar panels, decouplers, docking ports, or other sorts of 'launch complete' tasks into it and have them run automatically.  

 

The reason I like both of those ideas is that... for me the benefit of an automatic launch plugin is that i can start a launch and walk away to make a sandwich... so having it not fall back into the atmosphere because I had to hunt for the mustard is nice!  

I know, I'm lazy.  But I didn't ask you to make it EMAIL ME when the launch is complete!  Though....  Systems.Net.Mail....   ;)

 

Also, they're right...  putting a picture of a rocket banked over at a 45 degree angle in the first post will make more people stop and read what you've got to say, even though that picture won't show anything about what your plugin actually does.

Edited by artwhaley
Link to comment
Share on other sites

How is The "Best Guess" calculated?  Something similar to the Excel Solver macro?  Cool Idea.  But how is this different from Mechjeb's auto assent? The reason I ask is because Mechjeb's auto assent could use some significant improvement, so if yours is better might make it worth the download.  Also if it is better you should say so in the OP.

Link to comment
Share on other sites

14 minutes ago, mcirish3 said:

How is The "Best Guess" calculated?  Something similar to the Excel Solver macro? 

Taking a peek at the code, it seems to set start speed and turn angle based on calculated TWR of the first stage with a modification if SRBs are involved.

Link to comment
Share on other sites

  • It handles auto-staging, and has an option to disable it
  • It works with RSS Earth and probably any other planet.  My test RSS launch with stock parts used under 9k m/s of delta V.
  • It kinda works with Realism Overhaul.  But since the whole mechanism of the mod is adjusting throttle, it doesn't perform all that well with the unthrottlable engines.  It would be just as easy to do by hand.
  • Best Guess is calculated based on launch TWR and my experimentation.  The higher the TWR, the sharper and earlier it will turn to initiate the gravity turn.
  • It definitely seems to beat MechJeb's default settings.  But that's not something I can promise for every ship.  And I don't want to advertise GravityTurn by talking about MechJeb.
  • I have other ideas for the "launch complete" actions.  That will be a different, unrelated mod.
  • MechJeb already has everything you need to do circularization burns.  This mod is really not meant to go that far.
Link to comment
Share on other sites

31 minutes ago, Overengineer1 said:
  • It handles auto-staging, and has an option to disable it
  • It works with RSS Earth and probably any other planet.  My test RSS launch with stock parts used under 9k m/s of delta V.
  • It kinda works with Realism Overhaul.  But since the whole mechanism of the mod is adjusting throttle, it doesn't perform all that well with the unthrottlable engines.  It would be just as easy to do by hand.
  • Best Guess is calculated based on launch TWR and my experimentation.  The higher the TWR, the sharper and earlier it will turn to initiate the gravity turn.
  • It definitely seems to beat MechJeb's default settings.  But that's not something I can promise for every ship.  And I don't want to advertise GravityTurn by talking about MechJeb.
  • I have other ideas for the "launch complete" actions.  That will be a different, unrelated mod.
  • MechJeb already has everything you need to do circularization burns.  This mod is really not meant to go that far.

yeah, but having some mechjeb integration too have it plot a manuever node to circularize at the apoapsis and have it executed by mechjeb would be nice. this mod seems to have a more efficient ascent profile compared too when i use mechjeb, also less prone to failure- id assume. i wouldnt mind it.

Link to comment
Share on other sites

11 hours ago, Overengineer1 said:

It definitely seems to beat MechJeb's default settings.  But that's not something I can promise for every ship.  And I don't want to advertise GravityTurn by talking about MechJeb.

 

11 hours ago, Overengineer1 said:

MechJeb already has everything you need to do circularization burns.  This mod is really not meant to go that far.

Have you considered talking to @NathanKell Something tells me he would not be opposed to working with you.

10 hours ago, 123nick said:

yeah, but having some mechjeb integration too have it plot a manuever node to circularize at the apoapsis and have it executed by mechjeb would be nice. this mod seems to have a more efficient ascent profile compared too when i use mechjeb, also less prone to failure- id assume. i wouldnt mind it.

I really think this is a good idea at the very least.  No need to recreate the wheel.

 

11 hours ago, Aelfhe1m said:

Taking a peek at the code, it seems to set start speed and turn angle based on calculated TWR of the first stage with a modification if SRBs are involved.

Hmm seems to be incomplete but still better than Mechjeb in general.  Though I can foresee some cases where MechJeb would work better.  It would seem to me a formula could be devised that would plot the optimal path for any rocket.  No matter the staging or throttle ability, and regardless of atmo and planet size.  It has always puzzled me that one has not been developed.  If I knew enough about the physics in KSP I think I  could derive one.  it could even recalculate trajectory on the fly for when fight errors happen.

Edit:  I actually took a cursory glance at the code.  Perhaps I did not understand correctly but it looked to me like it took into account all stages.  But in what manner is the real question.  I do not think I understood the code well enough to say. 

@Overengineer1  I am sure you are a busy guy, but would you be willing to explain the code logic?  Also, I am sure you have already figured this out but what challenges exist in re running the full simulation at every point of the launch?(how can it be improved)  Is it a performance issue?  Or is your program already doing this?

 

Edited by mcirish3
Link to comment
Share on other sites

2 hours ago, Overengineer1 said:
  • It handles auto-staging, and has an option to disable it
  • It works with RSS Earth and probably any other planet.  My test RSS launch with stock parts used under 9k m/s of delta V.
  • It kinda works with Realism Overhaul.  But since the whole mechanism of the mod is adjusting throttle, it doesn't perform all that well with the unthrottlable engines.  It would be just as easy to do by hand.
  • Best Guess is calculated based on launch TWR and my experimentation.  The higher the TWR, the sharper and earlier it will turn to initiate the gravity turn.
  • It definitely seems to beat MechJeb's default settings.  But that's not something I can promise for every ship.  And I don't want to advertise GravityTurn by talking about MechJeb.
  • I have other ideas for the "launch complete" actions.  That will be a different, unrelated mod.
  • MechJeb already has everything you need to do circularization burns.  This mod is really not meant to go that far.

I totally understand now that what i was suggesting isn't in line with your mod.  For me... this plugin isn't all that useful if I have to sit there and watch things launch so I can fly the circularization myself.  I don't play within tight enough delta-v tolerances that the optimization is worth it, so if I can't alt-tab and read the forums during launch...  I'll probably stick with mechjeb. :)  But as a modmaker, I'm the first to say 'not every mod is for every play style!' Great work and keep it up!   

Link to comment
Share on other sites

Out of curiosity (I mainly fly spaceplanes), but the roll field: does that affect the inclination of the launch? I know equatorial orbit tend to be the main launch objective, but want about inclined orbits? From the looks of it, this automatically puts you into an equatorial orbit. Does the Roll field affect just the craft orientation (i.e. the craft will always tilt due east on launch) or can it be used to affect inclination (i.e. the craft always tilts "down"/towards ventral, so the orientation of the craft matters in the end for launch direction.)

I'm guessing it not a major thing, but I have RemoteTech and ScanSat usage scenarios in my head. Both of those mods can benefit from direct polar/inclined orbit launches. (Polar comms coverage and full planet scanning, respectively.)

Link to comment
Share on other sites

Very nice mod! I usualy use MechJeb for launching into orbit, but for some reason it always fails and falls back into the atmosphere. This mod is really better!(At least for me)

-EDIT-

I have one problem though. I tested in KSP SKY (5x rescale) and i set the desired apoapsis to 300km and it flies all well but it just stops when AP reaches 72km? Maybe i have to set desired AP higher because of drag?

-EDIT2-

After more testing, no matter what setting i put in, it just stops when AP reaches 72km

Edited by Joco223
Link to comment
Share on other sites

Very cool. I much perfer "one and done" type mods to large, try-to-do-everything mods like MechJeb. I understand why the larger mods exist and use them when they fit my play style (KER I'm looking at you) but I'd be far more likely to install this than MechJeb.

I agree though that outside of testing, the main draw for me for this mod would be the ability to tell it to launch and then go and do something else for a couple minutes. Sadly, that would frequently end up with me coming back and seeing my poor ship either plummeting through the atmosphere, or already crashed.

As was said, not all mods are for all people and this looks to be a very well-done mod. I could totally see installing it to quickly test not just designs but launch profiles.

Link to comment
Share on other sites

Latest version 1.2 released.  The major update that many people were asking for is that it now does a MechJeb circularization burn at the apoapsis.  This will only happen if MechJeb is available on the ship, otherwise the plugin will continue to function as before without a circularization burn.

 

@mcirish3: The stage calculations are done many times per second, but they're just some basic arithmetic.  The total CPU load for the entire mod is vanishingly small next to the overall load for the game.  If you're asking about how I calculate the TWR, then it is only the launch stage that is taken into account here.  For now.

@Joco223: I'm not familiar with that mod.  The 1.0 release would end as soon as it left the atmosphere.  I'm not sure about 1.1, it might have had this problem.  But this 1.2 release should work better, since I added support to launch from moons without atmosphere.  It should now not complete the ascent burn until the apoapsis matches the destination height.

Link to comment
Share on other sites

7 hours ago, Overengineer1 said:

Latest version 1.2 released.  The major update that many people were asking for is that it now does a MechJeb circularization burn at the apoapsis.  This will only happen if MechJeb is available on the ship, otherwise the plugin will continue to function as before without a circularization burn.

 

@mcirish3: The stage calculations are done many times per second, but they're just some basic arithmetic.  The total CPU load for the entire mod is vanishingly small next to the overall load for the game.  If you're asking about how I calculate the TWR, then it is only the launch stage that is taken into account here.  For now.

@Joco223: I'm not familiar with that mod.  The 1.0 release would end as soon as it left the atmosphere.  I'm not sure about 1.1, it might have had this problem.  But this 1.2 release should work better, since I added support to launch from moons without atmosphere.  It should now not complete the ascent burn until the apoapsis matches the destination height.

Ok. I also later tested it in RSS and it work perfectly. (Thou sometimes AP was not reaching destination height because of drag(i guess))

-EDIT-

Another question. How do you set in which inclination to launch to?

Edited by Joco223
Link to comment
Share on other sites

Holy crap this is sweet.

Building a jool science mission...my first. And had a launch of 5 science probes to RV with my mothership. A large and ungangly ship.I have crashed several times.

I hit best guess. Launch and off she went. Nurve racking in a career save watching your ship hit orbital velocity at 40k and burn for that long.

Had so much fuel left I was frantically trying to find a claw in orbit that I could use to transfer the fuel to some thing else. Couldn't, so I crashed the lifter into the moon..you know, for science!

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...