Jump to content

[WIN/MAC/LINUX] KSP Trajectory Optimization Tool v1.6.9 [New MATLAB Version!]


Recommended Posts

Well, the reason why I came across this program is a new contract I've got: getting a class c asteroid out of the solar system. I've read somewhere on the internet that one can use gravity assists to do so, but since i've never performed one I wanted to have a tool to help me with that. At the moment I'm experimenting on a new sandbox savefile to understand the basics of it and use the multiflyby sequencer at the same time. Thanks for your help though :)

Link to comment
Share on other sites

some usage notes on the MFBS from Arrowstar a little while back:

If you're constantly getting "infeasible" solutions, then your best bet is to widen up your launch window and your min/max transfer orbit durations for each leg of the journey. Those are the variables in play, so you can't find a solution, you need to widen the bounds on them a bit.

As for how to actually use FMS with MA, here's my process:

  1. First, you need to get a solution with FMS. Once you have this, keep FMS around in the background so you can reference it.
  2. Open up MA.
  3. Set the epoch of your initial state to the departure date of your FMS solution, minus the rough time needed to leave the SoI of the departure body.
  4. Set the orbit of the initial state to the initial orbit you used in FMS.
  5. Insert a coast into MA to the first burn true anomaly specified in FMS.
  6. Insert an impulsive burn into MA with the component magnitudes (prograde/normal/radial) shown in FMS.
  7. Attempt to propagate to the periapse of the flyby body (this will fail as you likely won't hit the flyby body's SoI).
  8. Here's where it gets tricky: you need to try to hit the same flyby orbit parameters in MA as shown in FMS. So if your flyby orbit has an SMA/ecc/inc/RAAN/arg of a/b/c/d/e, you need to try to get a flyby that also has those parameters (they can be off a bit due to the inexact nature of FMS, but they'll still be close). Use the optimizer to achieve this.
  9. Insert a burn @ periapse if needed.
  10. Insert another coast to the periapse of your next flyby body. Optimize to hit your next target.
  11. Repeat 6-9 for each flyby that occurs.

That's the general process. Don't get me wrong, it's still going to be VERY hard to get more than one flyby to work, and even one is a challenge. But with some luck and persistence, you'll get it.

Link to comment
Share on other sites

I've been having good luck working on my Kerbin-Eve-Moho sequence (down to ~4km/s and leaving Kerbin around day 185).

Skipping some of the detailed steps:

1. Setup the initial state and first burn so that I get the Kerbin Departure Date at the True Anomaly with the Departure Burn. Add a coast to get to the Solar SOI.

2. Optimize the departure burn so that the first solar transfer orbit matches MFMS.

3. Minimize the distance to Eve with a constraint that the periapsis occurs at the UT of the Eve Arrival Date. The time is an important factor, here, and the optimizer can find other encounters that don't work for the full mission.

4. With the final step still being the coast to Eve periapsis, optimize to match the Inclination and Periapsis Radius for the "Inbound Hyperbolic Flyby Orbit to Eve" and being in the general range of the right ascension of the ascending node (plus/minus 20 degrees is plenty tight enough of a constraint).

5. Add the flyby burn at Eve, and a coast back out to Solar SOI.

6. Go back to 2 and optimize the flyby burn to match the second transfer orbit in MFMS. Repeat for each flyby in your sequence until you get an encounter with your final destination.

Now, actually turning this mission into a reality is proving difficult. I've created the mission with both Impulse and Finite Duration maneuvers. Executing either version of the departure burn doesn't get me anywhere near an encounter with Eve. I managed to get to stop one of the burns early when it encountered Eve, but that was more than 10% short of the planned delta-V for the burn. So far my only hypothesis is that I planned about 50 Kerbin days in advance, and perhaps the orbit isn't the same after that much time; I'm trying to replan with new orbital elements extracted ~30m or so from the maneuver.

-bk2w

Edited by bk2w
Link to comment
Share on other sites

Hey Arrowstar another request - would it be possible to have the option next to SOI Radii and Show Children to render other spacecraft orbits in the Mission Architect window? Similar to what you can do in the Mission Animator?

And another - I love how the switch between UT/Delta Time/True Anomaly converts everything for you. Makes it easy to set a UT after a certain event by creating a Delta Time event of 0 then going back and switching it to UT. However when converting from UT/Delta Time back to True Anomaly, it doesn't take into account the number of Revs Prior to Coast, so you get degrees for TA, but not the actual equivalent in time

Edited by Gaiiden
Link to comment
Share on other sites

I've noticed something odd. No matter what data I give the Graphical Analysis tool to crunch when I ask it for a plot of Distance to Ref Spacecraft and Line of Sight to Ref Spacecraft, it always takes around 2 minutes to spit out an answer. I've fed it trajectories 60 seconds long, 5 min, 30 min, 60 min... it always takes around 2 minutes to get a plot

Link to comment
Share on other sites

You make it sound like it may be intended. I don't know if that was what he intended. If that is what he intended, then that's cool. If it's not then maybe it's a bug. Who's complaining?

- - - Updated - - -

also Arrowstar been meaning to ask if you have any control over where the windows pop up. For example when using Mission Architect on one of my side monitors the Save prompt and Open dialogs will pop up over the MA window, but things like the Graphical Analysis tool and the Edit State dialogs will always show up on my center (main) display. I'm guessing since those are non-system displays their behavior is different.

And does anyone else instinctively try to press Esc to close the Edit State windows when you just want to cancel out without saving? I don't even really know where I picked up that habit with dialog windows

Link to comment
Share on other sites

Guys I need some help!

I'm planning a Jool mission, with a fly-by at Eve, but I'm stuck in the search of a feasible flyby trajectory.

What I have exactly to do, to make it work?

I've tried to get a departure date from the flyby porkchop plotter, and the various transfer times.

Then I've put those data in the multi-flyby sequencer, but I can't have feasible solutions. What's wrong?

Link to comment
Share on other sites

Hi, I've just discovered this tool, and am trying desperately to figure out how to take the information given from the multiflyby sequencer and put that into a maneuver to enter my escape trajectory. I'm sure that this is simply me being too incompetent to figure this out on my own, but I am getting really frustrated that I can't understand how to work this. Any help or advice would be appreciated.

Link to comment
Share on other sites

Update: I have tried to follow your instructions about multi flybys, to the letter, but I am continually met with discontent and failure. I would appreciate it if you were to put together more comprehensive tutorials regarding the features of your software. I am currently trying to create a Kerbin-Eve-Duna flyby, ending in a mapping satellite above Duna. My problem comes when attempting to input the departure burn information into MA. When I then create an event to coast to periapse at eve, I am simply met with the spacecraft's final parent body as the Sun. I believe that I don't understand the mission optimizer, which you reference as being THE tool to make sure that my burn creates a trajectory heading for Eve. Yet, when I attempt to optimize for central body, I am left with an orbit exactly the same as my initial orbit. I really want to use this tool to create awesome missions, but I feel that this is a far off goal without proper instructions

Edited by Spartan_MiniMe
Link to comment
Share on other sites

Hey guys, I know there have been a lot of comments here lately that I haven't responded to. My life is pretty busy right now, but I swear I have a good reason for it: I'm preparing to move across the country to start a job at a NASA center. :) Needless to say, between finalizing my life here and trying to get my new life into something resembling normalcy, I've been busy. I promise when things settle down I'll be back. In the mean time, as my resident-not-me-expert, I'm sure Gaiiden can handle most questions as his time and will allow. :)

Link to comment
Share on other sites

I see that the OS X version is rather old compared to the PC version. What do you need to get the OS X build up-to-date?

I've been supplying the OSX builds so far. At the moment, I need time. The switch from R2013 to R2014 has introduced a number of quirks and bugs that I'm trying to isolate.

The majority of the quirks are that many UI elements are printed with really really small text. Makes for difficult reading. I'm also encountering a number of bugs in the communication between KSPTOT and KSP. At the moment, I'm unable to read KSPTOT save files for orbit data, and the KSPTOT Connect plugin cannot reliably move orbit data over to KSPTOT. At least uploading maneuver nodes into KSP is working reliably.

I suspect most of the problems are due to changes in how Matlab handles Windows versus OSX UI elements and file systems. I'm making some progress, but it's taking time.

I'm preparing to move across the country to start a job at a NASA center. :)

Congratulations! Now I'm terribly curious. Can you share what you're going to be doing? Goddard? Marshall? Johnson?

-bk2w

- - - Updated - - -

My problem comes when attempting to input the departure burn information into MA. When I then create an event to coast to periapse at eve, I am simply met with the spacecraft's final parent body as the Sun.

This is pretty typical when moving from the various Manuver tools to MA. The fact is that that distances involved are so large and the planets so small that very tiny differences at Kerbin can mean the difference between crashing into Eve and flying past it 100 million meters away. If you look at the orbit plot, you'll probably see your spacecraft's orbit arcing down from Kerbin to very close to Eve's orbit.

It sounds like you've got a good start with MA, and the next step is to use the Optimizer to fine tune the when the departure burn happens, and what the burn is.

Yet, when I attempt to optimize for central body, I am left with an orbit exactly the same as my initial orbit.

It sounds like you might not have the optimizer configured quite right. What goal are you attempting to optimize, and what constraints are you using? (A screen shot of the optimizer window would be very helpful)

I know it can be a bit frustrating for a while, but it'll eventually make sense.

-bk2w

Link to comment
Share on other sites

Ah, I see. The problem you're running into is that Constraints aren't the best way to direct the optimizer to what you want to achieve. In general, optimizers like this will have Constraints, which must not be violated, and an Objective Function, which should be minimized or maximized as much as the optimizer can manage. Solutions can be characterized as "feasible" or "infeasible", depending on whether the Constraints have been met. The MA optimizer has a hard time working if the starting point is infeasible, particularly Central Body constraints, which is what you've arranged. Think of the constraints as the edges of the playing field, and Objective Function as the direction you'd like to move on the field. If it starts way off the field, the optimizer has a hard time finding the field. Once it's on the field, it can push things around towards your goal.

In this case, a better approach is to set the Objective Function to "Minimize Distance to Body", set the Applicable Event to "Event 4: Coast", and the Applicable Body to "Eve". Remove the Central Body constraint, and hit "Optimize Mission". It'll think for awhile, and should eventually come up with a solution that crashes straight into Eve.

Once you've got a solution that crashes into Eve, add an "Altitude of Periapsis" constraint of 100km (just above Eve's atmosphere), and a Central Body constraint for Eve, then rerun the optimizer. That'll get you a fly-by that doesn't crash into Eve, but probably isn't anywhere near the inclination that you want.

The Central Body constraint is most useful for when you've already got a solution that reaches Eve, and are trying to adjust the inclination, which is the next step. Add a Central Body constraint to prevent the optimizer from moving outside of Eve's Sphere or Influence. Look at the Event Information for Event 4, and you should see an Inclination, it may be larger or smaller than your desired inclination. Add an Inclination constraint that goes from the current inclination to your desired inclination. Change the Objective Function to either Minimize Inclination or Maximize Inclination depending on which direction it needs to move, and run.

-bk2w

Link to comment
Share on other sites

On average, how many iteration should the computation take? I've started optimizing my coast, but I'm at 150 iterations and counting.

At 150 iterations, you've either given the optimizer a very hard problem to solve with a lot (10+) of variables, or it's running up against an optimization limit. My suggestion is to stop the optimizer and accept its solution. Once you're back to the MA window, take a look at the variables that you've enabled for optimization in Event 2 and Event 3. In general, I try to have no more then 5 variables being optimized at a time; since this is such a short mission, you've got no more than 4 variables total. Most likely one of your variables is near a limit. MA may even be telling you in the status pane at the lower right that some variables are near their optimization limits. You'll need to find them and increase the limits to give the optimizer some more room to explore.

-bk2w

Link to comment
Share on other sites

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...