Jump to content

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


Recommended Posts

I just downloaded this today and it looks absolutely amazing. I do have a few questions though:

- Probably I am overlooking something, but how do you calculate a Kerbin - Munar trajectory? When I set Kerbin as central body I can only select the Mun and Minmus as starting bodies.

- Is the trajectory always in the plane of the solar system rotation, and the ending orbit always equatorial? I tried to do a polar to polar transfer to save energy for a mapping satellite, but TOT seems to want to do a sideways transfer anyway. It is quite possible that that is the more efficient way to go, but I would like to end up with a polar orbit.

- Is there any chance this will work with the Real Solar System mod? Or do I need to use NASA/ESA tools for that?

Link to comment
Share on other sites

Sorry for all the questions, but I am trying to get a firm grip on matters. I hope you do not mind!

- I found your Orbiter TOT. Am I correct that that one should work with the Real Solar System mod?

- The KSP TOT is giving me burn times. Am I right in thinking you need to assume a certain engine for burn times? Delta-V is the same for any vehicle, but I believe burn times are not.

- Somewhat related, but not totally: I am thinking about learning to work with something like MatLab, but as someone starting a business I am concerned with running legal software and costs. Therefore, I am considering using Octave instead of MatLab, as I read that they are very similar and Octave is free. Do you see any major objections to this and what do you think about this?

Finally, I think I have found a 'bug'. When generating a report, the transfer orbit is displayed in white on a white background, making it seem missing. Just a small detail.

Thanks for all the great work, it all looks and works very nicely!

Edited by Camacha
Link to comment
Share on other sites

Is it possible to get an intercept without a mid-course correction using this? I've found that I always have to play around with the timing of the burn to get the closest approach below 1 Gm. Just want to make sure I'm doing it right. Made sure to plug in all the values Kerbal Engineer is giving me to the nearest certain decimal and was also sure to use the Argument of Periapse (Kerbal Engineer gives Longitude). I'm wondering what others' results are using this.

Link to comment
Share on other sites

The program looks good, but I can't run it and got "error in mclfreestacktrace"

Can you try either the v 0.11 pre release (#2) or the debug build I put up a week ago in this thread? Some one else just had this issue and the debug version worked for them.

Link to comment
Share on other sites

- Somewhat related, but not totally: I am thinking about learning to work with something like MatLab, but as someone starting a bussiness I am concerned with running legal software and costs. Therefore, I am considering using Octave instead of MatLab, as I read that they are very similar and Octave is free. Do you see any major objections to this and what do you think about this?

Octave is a volunteer-maintained open-source attempt to mostly clone the Matlab scripting language. It has almost identical syntax and is designed to allow simple Matlab .m scripts and functions to work with a minimum of changes. It has a lot of deficiencies though: it doesn't have replacements for many of the toolboxes (notably Simulink), there's no official GUI, they don't yet support the revamped object-oriented programming style that Matlab implemented over 5 years ago, etc. Unless you are really attached to Matlab for any reason, I'd say you should avoid Octave. There are better options for free open-source technical computing and general-purpose programming languages. Have a look at either Julia or Python.

Link to comment
Share on other sites

Can this be used to plot a transfer orbit for any time instead of having to wait for the optimal transfer window? I went to Duna and overdid it plenty on the fuel capacity. It has one orange tank and four FL-T800 tanks of fuel it won't need to tap at all for the return. The four orange tanks and four engines on them will be enough for the optimum return. Tested that in an experimenting save.

So I'd love to hurry up the return instead of having the crew twiddle their thumbs for almost 150 more days. Once the return boost stage is tapped out, the ship has a Skipper and four LV-T30 engines to slow down to get into an orbit around Kerbin. Doesn't need to be a particularly good orbit as I have many ways to refuel or just dock a tank to the top of the lander like I did to get back from my very first non-crashing or completely missing the moon Mun trip. ;)

Yes, it can. Generate a porkchop plot for the departure and arrival body you desire. Click the compute departure button. Enter the departure time you want (from KSP/MechJeb/whatever). I think I have a button which finds the optimal arrival time for a given departure, so you can use that if you want. Push go and viola, transfer orbit. :) Let me know how it works for you.

I just downloaded this today and it looks absolutely amazing. I do have a few questions though:

- Probably I am overlooking something, but how do you calculate a Kerbin - Munar trajectory? When I set Kerbin as central body I can only select the Mun and Minmus as starting bodies.

- Is the trajectory always in the plane of the solar system rotation, and the ending orbit always equatorial? I tried to do a polar to polar transfer to save energy for a mapping satellite, but TOT seems to want to do a sideways transfer anyway. It is quite possible that that is the more efficient way to go, but I would like to end up with a polar orbit.

- Is there any chance this will work with the Real Solar System mod? Or do I need to use NASA/ESA tools for that?

1) Use the Rendezvous planner to go from a Kerbin orbit to the Mun. Since you never technically leave Kerbin's SOI (the Mun also being within Kerbin's SOI), you can't use the normal techniques as they require a departure from the SOI.

2) No, the trajectory is not constrained to any plan. However, it happens that those trajectories which do not leave the plane of the solar system are, in general, more efficient, and this is what TOT finds. If you want to enter a polar orbit around a body, use an "equatorial" solar transfer orbit, then just adjust your orbit to polar by burning normal to the orbital plane as soon as you enter the SOI.

3) It can work with Real Solar System, but you'd have to generate the bodies.ini file. Maybe I'll write some code to get the celestial bodies from KSP using the new KSPTOT Connect plugin and have it auto-generate this file... but not for a while. :)

Sorry for all the questions, but I am trying to get a firm grip on matters. I hope you do not mind!

- I found your Orbiter TOT. Am I correct that that one should work with the Real Solar System mod?

- The KSP TOT is giving me burn times. Am I right in thinking you need to assume a certain engine for burn times? Delta-V is the same for any vehicle, but I believe burn times are not.

- Somewhat related, but not totally: I am thinking about learning to work with something like MatLab, but as someone starting a bussiness I am concerned with running legal software and costs. Therefore, I am considering using Octave instead of MatLab, as I read that they are very similar and Octave is free. Do you see any major objections to this and what do you think about this?

Finally, I think I have found a 'bug'. When generating a report, the transfer orbit is displayed in white on a white background, making it seem missing. Just a small detail.

Thanks for all the great work, it all looks and works very nicely!

I definitely don't mind questions! :)

1) It should, but no promises, as I don't know how real solar system is set up. If the planets are in the wrong place at the wrong time, then it won't work.

2) The burn times it's giving you might be either UT times or time past perigee times. Can you give me an example so I can clarify? Screenshots welcome. :)

3) Will respond to this below.

4) Can you take a screenshot for me? Thanks! :)

Is it possible to get an intercept without a mid-course correction using this? I've found that I always have to play around with the timing of the burn to get the closest approach below 1 Gm. Just want to make sure I'm doing it right. Made sure to plug in all the values Kerbal Engineer is giving me to the nearest certain decimal and was also sure to use the Argument of Periapse (Kerbal Engineer gives Longitude). I'm wondering what others' results are using this.

In theory yes. In practice, no. My code makes a few assumptions which are very very good, but not perfect. Some tweaking of departure burns (a few seconds up or down, or a few m/s prograde dv up or down) should be all you need to hit your target. Let me know if you have trouble.

Octave is a volunteer-maintained open-source attempt to mostly clone the Matlab scripting language. It has almost identical syntax and is designed to allow simple Matlab .m scripts and functions to work with a minimum of changes. It has a lot of deficiencies though: it doesn't have replacements for many of the toolboxes (notably Simulink), there's no official GUI, they don't yet support the revamped object-oriented programming style that Matlab implemented over 5 years ago, etc. Unless you are really attached to Matlab for any reason, I'd say you should avoid Octave. There are better options for free open-source technical computing and general-purpose programming languages. Have a look at either Julia or Python.

I would also avoid Octave. Python is great and there are lots of nice numerical and plotting packages for it. Never heard of Julia until today, but it looks fine too. My recommendation is Python, but explore both options. :)

Bit of a note: So my GPU on this laptop is basically dead, so running KSP is a no-go. I'm still going to get some code created, but everything's on hold until first week of January. I'll get something nice and shiny out then. In the mean time, please keep playing with the pre-release #2 and let me know how it works for you. :) If someone wants to try and connect two computers and get TM on both of them from the same KSP session, that would be awesome...

Link to comment
Share on other sites

1) It should, but no promises, as I don't know how real solar system is set up. If the planets are in the wrong place at the wrong time, then it won't work.

I believe there was an issue with that, but it is also supposed to be or get fixed soon. The planets should be fine in respect to each other, it is just that the starting time or Earth rotation is not totally right.

I am also looking into using NASA's GMAT, but it will be some time before I have enough grasp on it to make it useful. Although I do not fully understand it yet, your application does not seem to have a steep learning curve. Very nice!

2) The burn times it's giving you might be either UT times or time past perigee times. Can you give me an example so I can clarify? Screenshots welcome. :)

[...]

4) Can you take a screenshot for me? Thanks! :)

I will, when I have reinstalled Windows on my gaming rig. Currently internet access and KSP are physically seperated, making things like uploading a screenshot a bit of a chore.

Link to comment
Share on other sites

FYI: For v6 of RSS I plan to do as asmi suggested and borrow Orbiter's orbital info (right now it's a bit inconsistent, grabbed from wiki and other places), so RSS darn well better have the same stats as Orbiter. Now, KSP doesn't do >1-body gravity so things will be a little bit wonky, but pretty close I think.

(Also, of course, KSP doesn't support axial tilt. But that shouldn't matter except for launch and landing.)

Link to comment
Share on other sites

I'm a little confused with Rendezvous Maneuver Sequencer..

How does it know my craft's and target's current positions? Is the position calculated from mean anomaly and epoch?

I've checked wiki, but I'm not sure about my understanding about mean anomaly and epoch...

Besides, I may have found a bug:

After loading a SFS file in the Rendezvous Maneuver Sequencer, the Mean Anomaly and Epoch doesn't change!

Edited by airaria
Link to comment
Share on other sites

I will, when I have reinstalled Windows on my gaming rig. Currently internet access and KSP are physically seperated, making things like uploading a screenshot a bit of a chore.

Okay, thanks. Let me know when you are able.

I'm a little confused with Rendezvous Maneuver Sequencer..

How does it know my craft's and target's current positions? Is the position calculated from mean anomaly and epoch?

I've checked wiki, but I'm not sure about my understanding about mean anomaly and epoch...

Besides, I may have found a bug:

After loading a SFS file in the Rendezvous Maneuver Sequencer, the Mean Anomaly and Epoch doesn't change!

Position is calculated from mean anomaly and epoch, yes. :)

I'll take a look at the bug when I get home from vacation, thanks for the report.

Link to comment
Share on other sites

This doesn't seem to work on Windows 8. (Pro 64-bit here). "Could not find version 8.1 of the MCR."

I have installed both the 32-bit and 64-bit R2013a (8.1) MCRs - originally just the 32-bit one (as that worked just fine in Windows 7 64-bit) but tried the 64-bit as well, for lack of anything else to try.

Anyone have a solution?

Link to comment
Share on other sites

I've not seen this before. Are you running the KSPTOT application as an administrator? Does it work with just the 32-bit MCR on Windows 7?

I don't have Windows 8 so I can't really test, but I can try to troubleshoot as best I can...

Link to comment
Share on other sites

Yes, I've tried running as admin, and there was no difference. It did work on Windows 7 with the 32-bit MCR.

I think the MCR is failing to install properly... if I do a search for the DLL nothing is coming up at all on my disk.

Link to comment
Share on other sites

Down the rabbit hole I went... seems I needed to manually start the Windows Installer Module, for some reason. Once done...

"Product: Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.6161. The assembly 'policy.9.0.Microsoft.VC90.CRT,version="9.0.30729.6161",publicKeyToken="1fc8b3b9a1e18e3b",processorArchitecture="x86",type="win32-policy"' for component '{B4606FC1-ADD6-3F4C-B9A7-BEA4CE07951E}' is in use. You must restart to update the assembly."

This dependency is not fully installing because of some pending windows updates... doh! I should be fine once I reboot and let those updates do their thing. The MCR installer was just... closing, with zero feedback - I had to dig around in the windows event viewer to spot this.

(got a backup restoration running for several days, had a system failure recently and part of my picking up the pieces was getting KSPTOT working again :P Only another 10 hours left and I can safely reboot... 100gb of data takes a bit of time to move via the internet.)

Edited by draeath
Link to comment
Share on other sites

Sounds good. Please let me know when you get it working. :)

Yep, all good. Turns out the installer wasn't even running, it was dying before showing the UI. I had just assumed the winzip self extractor was doing all the work :P

As I had thought, rebooting such that the VB Runtime could actually exit with a good status code allowed it to continue on it's merry way.

Link to comment
Share on other sites

Is it normal for the flyby maneuver sequencer to take a very long time? It's been about two minutes and it's at about 10%.

Yep. It's a very computationally intensive operation. You should expect it to take anywhere from 3-10 minutes to complete. Please remember that when the real engineers do this kind of thing, they take days to look for good solutions. A few minutes here for a decent approximation isn't unreasonable. :)

Yep, all good. Turns out the installer wasn't even running, it was dying before showing the UI. I had just assumed the winzip self extractor was doing all the work :P

As I had thought, rebooting such that the VB Runtime could actually exit with a good status code allowed it to continue on it's merry way.

Excellent, so it's all working?

Link to comment
Share on other sites

So good news, everyone! I have a new build of KSPTOT cooking that includes major changes to the real time MCC code. Basically I've done the following since the last test build:

1) Added the Power/Thermal and Propulsion consoles

2) Allowed the KSPTOT Connect server to handle multiple connections

3) Updated the way connecting/disconnecting works on the KSPTOT (matlab) side works

4) Begun planning for a Simulations console that will allow crafty MCCers to throw in failures/problems that the "mission controllers" can then help handle. (Note: not yet implemented or even put down on paper yet. :P)

5) Verified that I can connect my desktop's KSP session with my laptop's build of KSPTOT MCC. It's pretty cool to see your orbit update from across the room! :)

Known issues:

1) Connecting a second client (and probably more) doesn't always connect right away. Just reconnect and it'll work fine.

2) Lots of write failures in the KSPTOT Connect log when disconnecting. Doesn't hurt anything though.

3) General lack of testing with connections other than locally (same PC) and across a network (192.168.0.*).

I'll have a test build out this evening, I think. If someone could give it a run and see how it works, that'd be cool. If it looks good, I'll call this KSP TOT 0.11 and start moving on to 0.12, which will have that Simulations console I mentioned above.

How does that sound? :D

Link to comment
Share on other sites

Arrowstar,

Thanks for making such an awesome tool! It definitely feeds my engineering-side to find elegant solutions.

However, since I play on a Mac, I got tired of running a Windows VM just for this awesomeness. I've managed to take the 0.10 source code and compiled a stand-alone application that I can run on my 64-bit OS X machines. I'd like to share it out, if you'd be willing.

I'd love to help get your 0.11 working on OS X, as well. The KSPTOT Connect sounds very interesting.

-Brian

Link to comment
Share on other sites

Hi there bk2w,

Interesting proposition. Are you just using a Mac version of MATLAB 2013a and using the Matlab compiler? I'd be interested in hearing the process you're using.

Once I know that, then I suspect I'd be interested, yes. I would just have to know that you'd be willing to support the Mac builds (only w.r.t. problems arising directly from building/using the software on a Mac, which it is not designed for at the moment). I'd also need you to perform your own independent testing of the software on Mac, as I don't have a Mac to test it on.

Link to comment
Share on other sites

Arrow,

I used R2013a running on OSX 10.8.5. 'deploytool' targeting a Standalone Application with projectMain.m as the Main File, everything in src/ as Shared Resources. The biggest hurdle is that the Lambert Arc solver (lambert.mexw32) you have in the source directories was compiled for Win32, and not usable on a Mac. I kept running into problems where Matlab would tap the Map Toolbox instead, getting very confused. I grabbed what I believe is the same source code (http://www.mathworks.com/matlabcentral/fileexchange/26348-robust-solver-for-lamberts-orbital-boundary-value-problem) and compiled it into a lambert.mexmaci64 that seems to work with TOT. End result is a script and executable that sure looks like KPSTOT on Windows. The script is needed to set environment variables that point to MCR, which is a bit awkward, but all the functionality of the tool seems to be working as I'd expect.

I'm happy to help out with testing as my time allows. I'm a software/hardware engineer by training and I've used Matlab quite a bit through work for modeling and exploring demodulation schemes, error correcting codes, and DSP chains. Don't have much background with orbital mechanics, sadly, but KSP is so much fun that it's making me learn like crazy.

-Brian

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