Jump to content

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


Recommended Posts

15 hours ago, Drew Kerman said:
  • KSPTOT isn't saving my Edit->Options settings from session to session. Is it supposed to?
  • I also have to reload my bodies.ini file over the default every time I start the application - I thought I remembered it saving and loading the last-used file on startup
  • Should the MFMS use the Compute Departure Options when calculating the departure burns? Currently it always uses 50 iterations regardless of the setting

Okay, this pre-release should handle these three requests.  Please go ahead and give it an overview.  I had to do a fair bit of work on the code for the options stuff, so if you find anything that doesn't work, please let me know.  Thanks!

Link to comment
Share on other sites

I hit the atan2 error again, but was unable to reproduce on my second attempt. Still, here is the log file in case it helps, with the MFMS values I used added to the top (also, previous sequences were performed before the run that tripped the error).

Also, the Custom Asteroids mod produces Long Period Comets that seem to be on hyperbolic trajectories in the game, and similarly MA can't render a complete orbit or even coast to apkelion. Here's an example. Could MA be tweaked to handle these huge orbits (probably similar to Oort Cloud trajectories)?

@Arrowstar forgot to tag you. Do you have notifications turned on (and if so, is it only for tagged/quoted posts or any new post)?, or do you just check the forums whenever you have time?

Edited by Drew Kerman
Link to comment
Share on other sites

2 hours ago, Drew Kerman said:

I hit the atan2 error again, but was unable to reproduce on my second attempt. Still, here is the log file in case it helps, with the MFMS values I used added to the top (also, previous sequences were performed before the run that tripped the error).

Okay, thanks for letting me know.  If you can reproduce it, please provide the steps (as last time which was perfect) so I can investigate!

Quote

Also, the Custom Asteroids mod produces Long Period Comets that seem to be on hyperbolic trajectories in the game, and similarly MA can't render a complete orbit or even coast to apkelion. Here's an example. Could MA be tweaked to handle these huge orbits (probably similar to Oort Cloud trajectories)?

In the example you provided me, it looks like you were missing a coast segment.  Is that what you meant?  As far as propagating hyperbolic Sun-centered orbits, you'll have to be careful with it.  There is a maximum true anomaly for hyperbolic orbits, and it's possible that's what you're running into, or running over as the case may be.  If you try to coast to a true anomaly greater than that maximum, the propagator will not be able to go to the target and MA will fail/skip that event.

I was able to get it to propagate out to a true anomaly of 167 deg or so, but because the orbit starts so close to that point, you don't see much.

3VUQOvQ.png?1

And yes, I do get all notifications (replies to the thread and @ name notifications as well), so whatever you'd like to do is fine. :)

Link to comment
Share on other sites

3 hours ago, Arrowstar said:

In the example you provided me, it looks like you were missing a coast segment.  Is that what you meant?  As far as propagating hyperbolic Sun-centered orbits, you'll have to be careful with it.  There is a maximum true anomaly for hyperbolic orbits, and it's possible that's what you're running into, or running over as the case may be.  If you try to coast to a true anomaly greater than that maximum, the propagator will not be able to go to the target and MA will fail/skip that event.

*sigh* never mind I messed up sorry - the orbit is hyperbolic. I thought the game was just treating it as such because it was so large - kind of how you can escape Kerbin's SOI without having to be on a hyperbolic trajectory.

Link to comment
Share on other sites

29 minutes ago, Drew Kerman said:

*sigh* never mind I messed up sorry - the orbit is hyperbolic. I thought the game was just treating it as such because it was so large - kind of how you can escape Kerbin's SOI without having to be on a hyperbolic trajectory.

Ah, I see!  Yeah, in KSP the Sun's SoI is infinitely sized, so there's no bound where you could still be eccentric but "escape" if that makes sense. :)

Link to comment
Share on other sites

17 hours ago, Drew Kerman said:

I hit the atan2 error again, but was unable to reproduce on my second attempt. Still, here is the log file in case it helps, with the MFMS values I used added to the top (also, previous sequences were performed before the run that tripped the error).

So I ran 100+ cases last night of this MFMS set up and couldn't reproduce the error. Do you have a special bodies file in use or anything else not stock?

Link to comment
Share on other sites

Just now, Arrowstar said:

100 is high. If I was doing it for real and not to troubleshoot, maybe only 10 or 15. 

Based on what I was reading in the forum I was seeing 50 a lot. Does it really matter much doing higher number cycles?

Link to comment
Share on other sites

21 minutes ago, wile1411 said:

Based on what I was reading in the forum I was seeing 50 a lot. Does it really matter much doing higher number cycles?

I haven't been paying close attention, but I do recall seeing that some sequences were returning best scores from runs in the 20's and 30's. Anyways I plan on doing 500 runs for just a few select routes and arrowstar said that was great, but for initial pathfinding I'm using 50. You could probably start with 10 or 15 just to make sure a flyby combo is viable (doesn't end with a Not Feasible warning), then bump it up to 50 for a real good route search then up even higher to ensure the best route finding

34 minutes ago, Arrowstar said:

So I ran 100+ cases last night of this MFMS set up and couldn't reproduce the error. Do you have a special bodies file in use or anything else not stock?

Yea I posted by bodies file a page back, try it with this bodies file

I've also started seeing this at the end of the log when the Genetic Algorithm run completes (the legend shows up on the Penalty Value window) but then nothing happens:

Quote

Optimization terminated: average change in the penalty fitness value less than options.TolFun
and constraint violation is less than options.TolCon.

and after that the program lets me click on things without chiming an error & move the windows around but no menus will drop down nor will buttons actually function, including the window close button so I have to task kill it. I've seen this twice and was able to run the same sequence again no problem, currently working on the 2nd sequence that produced this error to see if it will complete.

Link to comment
Share on other sites

30 minutes ago, wile1411 said:

Based on what I was reading in the forum I was seeing 50 a lot. Does it really matter much doing higher number cycles?

All more cycles gives you is a higher probability of more fully exploring the trade space. So run as many as you have time for and leave it at that. 

Link to comment
Share on other sites

7 hours ago, Drew Kerman said:

I've also started seeing this at the end of the log when the Genetic Algorithm run completes (the legend shows up on the Penalty Value window) but then nothing happens:

and after that the program lets me click on things without chiming an error & move the windows around but no menus will drop down nor will buttons actually function, including the window close button so I have to task kill it. I've seen this twice and was able to run the same sequence again no problem, currently working on the 2nd sequence that produced this error to see if it will complete.

I've never seen this before.  Can you show me a GIF or video or something next time it happens?  It's very unusual.

Link to comment
Share on other sites

1 hour ago, Arrowstar said:

Can you show me a GIF or video or something next time it happens? 

like with the atan2 error, I will first see if I can find a situation where I can recreate it. Everytime this has come up I've been able to run the sequence on the next try. It may have something to do with running so many sequences, I don't recall it ever happening the first time after I start up KSPTOT

Link to comment
Share on other sites

1 hour ago, Drew Kerman said:

like with the atan2 error, I will first see if I can find a situation where I can recreate it. Everytime this has come up I've been able to run the sequence on the next try. It may have something to do with running so many sequences, I don't recall it ever happening the first time after I start up KSPTOT

So I think I may have found and fixed the atan2() error... or at least this incarnation of it! :D  Turns out that there is a cosh() (hyperbolic cosine) function in the vectorized Lambert solver that was returning a whole bunch of x + 0i complex numbers that were throwing things off.  I have adjusted the code to discard the 0i imaginary part and that will hopefully rectify the issue. 

Here's a build with the fix included.  Please give it a whirl and let me know what issues you find, if any.  Thanks!

Link to comment
Share on other sites

On 01/10/2017 at 5:23 AM, Arrowstar said:

Finally, a quick announcement looking towards the future.  It's been 2 years since I've updated the MATLAB Compiler Runtime and I think that, with the next version (probably 1.6.0), I'll begin looking into moving to MATLAB R2017b.  If anyone has any comments or concerns about this, please let me know ASAP.  Thanks! :)

Given that the ability to run under Wine seems to vary based on MCR version, and it currently doesn't work (for me, last time I tried), I'd be interested to see if R2017b improves things.

edit:

iirc it actually does "work", but all the graphics are mirrored or something annoying like that. I half wonder if Matlab intentionally broke Wine compatibility to force more sales of Linux  licenses. :/

edit2:

well KSPTOT 158prerelease8 under Wine is more b0rked than last time I tried.

9tyujVW.png

Edited by russm
more detail
Link to comment
Share on other sites

First off, thanks for the tool.  It has been really useful for all sorts of crazy missions - at least when I fail I know I was trying something impossible :)

 

I'm having an issue in the mission architect after enabling Script->Execution Settings->Parallelize Script Optimization.  I have an existing set of constraints which run fine but after enabling parallel optimization I get

"There was an error optimizing the mission script : Subscript indices must either be real positive integers or logicals"

Tested with the latest prerelease linked at the top of the page.

I can upload my .mat file if it turns out to be a unique problem - let me know if you can't reproduce it.

Link to comment
Share on other sites

58 minutes ago, KC_073 said:

First off, thanks for the tool.  It has been really useful for all sorts of crazy missions - at least when I fail I know I was trying something impossible :)

 

I'm having an issue in the mission architect after enabling Script->Execution Settings->Parallelize Script Optimization.  I have an existing set of constraints which run fine but after enabling parallel optimization I get

"There was an error optimizing the mission script : Subscript indices must either be real positive integers or logicals"

Tested with the latest prerelease linked at the top of the page.

I can upload my .mat file if it turns out to be a unique problem - let me know if you can't reproduce it.

Please upload the mat file, yes. There may actually be a bigger problem with that functionality that I need to disable it until I can fix it again, but your mat file will help with that. Thanks! 

Link to comment
Share on other sites

 

Okay, this pre-release should handle these three requests.  Please go ahead and give it an overview.  I had to do a fair bit of work on the code for the options stuff, so if you find anything that doesn't work, please let me know.  Thanks!

Hi, had two of the listed issues and this release fixed them nicely.  Thanks.

I am finally getting the hang of MA, after only two years:rolleyes:.  Have a mission to Otho (GPP) all set up and it looks really good on paper. I wanted to ask what the best practice for using Set State after the initial state. Based on one's piloting skills, the state after burns may not be as close to the planned state as you would like. Is it a good idea to add a Set State after a burn step, import the current orbit of the vessel (which is the result of the burn), set the current step to this step in MA and rerun optimizations?

Thanks

Link to comment
Share on other sites

 

I am finally getting the hang of MA, after only two years:rolleyes:.  Have a mission to Otho (GPP) all set up and it looks really good on paper. I wanted to ask what the best practice for using Set State after the initial state. Based on one's piloting skills, the state after burns may not be as close to the planned state as you would like. Is it a good idea to add a Set State after a burn step, import the current orbit of the vessel (which is the result of the burn), set the current step to this step in MA and rerun optimizations?

After your planned mission is done. use a separate MAT file to track your actual mission with the orbital data you end up with, and re-optimize as necessary to stay on track with your original mission plan, because yea you're not going to be perfect and you can't really be perfect due to KSP floating point errors. You'll always plan with a precision greater than you can operate, but not drastically so

Link to comment
Share on other sites

 

Please upload the mat file, yes. There may actually be a bigger problem with that functionality that I need to disable it until I can fix it again, but your mat file will help with that. Thanks! 

https://drive.google.com/open?id=0B8hPVHrmVeDgNnJWbG9iWGo0ZG8

Hopefully I set sharing correctly on the link.  Using the file as-is I can either ctrl-O, "Optimize Mission" or just ctrl-R when parallel is turned off. Turning it on gives the error.

Link to comment
Share on other sites

 

https://drive.google.com/open?id=0B8hPVHrmVeDgNnJWbG9iWGo0ZG8

Hopefully I set sharing correctly on the link.  Using the file as-is I can either ctrl-O, "Optimize Mission" or just ctrl-R when parallel is turned off. Turning it on gives the error.

File looks like it's 0 bytes... can you confirm there's data in there?

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