Jump to content

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


Recommended Posts

Can you make a version for Mac please? This tool looks very useful. I'd appreciate it if you did that for all the Mac users out there.

Also, I had an idea: You could work with the MechJeb devs to integrate this powerful tool into Mechjeb.

Sorry, I'm not able to. I would need a Mac install of MATLAB to work on that, and sadly I don't have that.

As far as mechjeb integration goes, I already have code to generate maneuver nodes in KSP. You can use that to create maneuvers and MechJeb to execute them. :)

Link to comment
Share on other sites

Can anyone tell me how to properly time my burn for a flyby maneuver? I've spent a very long time trying to get it to work but I haven't once gotten close. Are there any tools that let you snap a node to a specific true anomaly? Am I missing something? Any help would be greatly appreciated.

Link to comment
Share on other sites

Sorry, I'm not able to. I would need a Mac install of MATLAB to work on that, and sadly I don't have that.

As far as mechjeb integration goes, I already have code to generate maneuver nodes in KSP. You can use that to create maneuvers and MechJeb to execute them. :)

I think you could try hacking your comp to run on OS X. I've seen my dad do it once, but that's very risky territory.

Link to comment
Share on other sites

Also got one more quick question, for using Mission Architect, is there a way to estimate the orbital elements for the initial orbit before launch?

I can't seem to get orbital information from KSP or upload maneuveur nodes(and was also unable to do so on Windows). Once I connect with MCC, I can get UT time, but it just hangs when I try to get orbital information, except I can get orbital info from the Orb Ops screen.

When I try to upload a maneuveur node, the connection test is OK, but I then get connection refused

Edited by dlrk
Link to comment
Share on other sites

Not sure if I did something wrong but the maneuver nodes are not uploading to KSP anymore, perhaps this is because I am now playing on the 64 bit? Or should this still be working?

Scratch that. I forgot to put the KSPTOTConnect folder back in gamedata. derp :confused:

Link to comment
Share on other sites

finally spent some more time in Mission Architect. I actually designed and built the craft I intend to fly over there so I was able to input proper weight for the initial_state, not that it really matters any besides telling me I can indeed get there with what I'm using :P I suppose I can adjust my fuel weight in the VAB to match the remaining shown in the Final State window to see how much delta-v I will have remaining once I'm in orbit.

Kerbin to Duna mission plan

Again, this was built from the Laythe tutorial. I followed that up to the point where I optimized to hit Duna's SOI and stopped with my Pe a little ways inside Ike's orbit (that's just where I happened to stop the optimizer). Then I added a circularize maneuver and a coast to visualize it. Then I went back and added a coast event to a burn halfway along my travel time from Kerbin to Duna. I optimized the coast at Event 6 using the minimize inclination function with bounds of 78 to 79, as my target inclination is 78.8 for my SAR SCAN instrument. I only used the Central Body and Inclination constraints. By happenstance it dropped my SMA down close to the 1068km I need to be at, but when I tried using the minimize distance function, I added an SMA constraint of 1068 to 1069 (to the existing inc and central body constraints) and the optimizer could do nothing but screw up my inclination and increase my SMA. Not a huge deal tho as once I'm in orbit I can tweak it that little bit - nailing the inclination prior to orbital injection was key for saving me lots of fuel!

I still have a little over an Earth month of in-game time until my TDI Burn date, so just working on getting the rocket built to get up into orbit ahead of time. Wish me luck! Any suggestions on the mission plan are appreciated.

Link to comment
Share on other sites

Honestly, it looks great. I don't see anything else I would do differently. Nice work! And do keep me/us updated as to how the mission goes. Feel free to advertise KSPTOT and MA if you post to another place other than this thread. ;)

Link to comment
Share on other sites

Honestly, it looks great. I don't see anything else I would do differently. Nice work! And do keep me/us updated as to how the mission goes. Feel free to advertise KSPTOT and MA if you post to another place other than this thread. ;)

Will do. It will be exposed through my KSP twitter in November when this mission planning and launch will be. Obviously I will have flown it long before then so I can let you know how it goes sooner.

Also, been playing around with the Multi-flyby sequencer but haven't gotten it to give me anything useful yet. I'm going to mess around a bit more before crying for help tho. Would love to get a Voyager-type mission off soon

Edited by Gaiiden
Link to comment
Share on other sites

Arrowstar,

Your progress on KSPTOT is truly amazing. I love this tool.

I'm trying to compile the source for v1.1.5 on an OS X machine (with Matlab R2013a) so that I don't need a VM just for this tool, but I'm running into some difficulty with a couple of routines that you have compiled up as .mexw32 files. Since I'm running on a Mac, I can't use the Win32 compiled binaries.


./src/KSPTOT_matlab/getKeplerFromState_Alg_mex.mexw32
./src/KSPTOT_matlab/helper_methods/astrodynamics/getKeplerFromState_Alg.mexw32
./src/KSPTOT_matlab/helper_methods/astrodynamics/getStatefromKepler_Alg.mexw32
./src/KSPTOT_matlab/helper_methods/astrodynamics/solveKepler.mexw32
./src/KSPTOT_matlab/helper_methods/math/crossARH.mexw32
./src/KSPTOT_matlab/helper_methods/math/dotARH.mexw32

I suspect the math files are merely compiled versions of the .m files of the same name, but the four Kepler files elude me. It looks like these are your custom vectorized algorithms. Are the source files in the ZIP somewhere of out of the way? Are you willing to share them out?

Thanks,

-Brian

Link to comment
Share on other sites

Give these a try.

Warning: I had to dredge these up from my Recycle Bin of all places. I have no idea why I don't have the original M Files anywhere, but I'm hoping these just got accidentally deleted. Let me know how those work for you. If they don't work, I'll see what I can recover still...

And yes, you are correct about the dot/cross product math functions. I think I included the source for those in any event.

Link to comment
Share on other sites

Those files did the trick. I've been able to build for OSX, and it seems to be running well.

A couple of really bizarre UI quirks (menus always appear at a specific point in the screen, regardless of where I move the KSPTOT window) but the calculations are running without apparent problem.

Thanks!

Link to comment
Share on other sites

Those files did the trick. I've been able to build for OSX, and it seems to be running well.

A couple of really bizarre UI quirks (menus always appear at a specific point in the screen, regardless of where I move the KSPTOT window) but the calculations are running without apparent problem.

Thanks!

How soon before you can get a good Mac build out there?

Link to comment
Share on other sites

Arrow,

One of the minor issues is path delimiters for the splash logo. Windows uses '\' and OSX uses '/'.

A simple solution appears to be replacing line 61 in splashScreenGUI.m


rgb = imread('images\logo500px.jpg');

with


if isunix
rgb = imread('images/logo500px.jpg');
else
rgb = imread('images\logo500px.jpg');
end

-Brian

Link to comment
Share on other sites

How soon before you can get a good Mac build out there?

I'll have to leave it up to Arrowstar. The menu bug that I'm seeing makes the app awkward to use. In addition, the Matlab-compiled script currently knows nothing of where the MCR libraries are located, so right now the app has to be started via a script that informs the app of where MCR is installed; I haven't yet figured out how to bundle this script with the app.

-Brian

Link to comment
Share on other sites

Arrowstar,

It appears that Squad changed the definition of a 'day' in 0.24. KSP 0.24.2 treats 6 hours as 1 day, while KSPTOT treats 24 hours as 1 day. Also, KSP now defines a years as 426 days, while KSPTOT defines it as 365 days. This means there's an ambiguity in a lot of the epoch times and durations that KSPTOT lists. I'm presuming that we still want to follow the UT number, and not the years/days/hours number.

-Brian

Edited by bk2w
Link to comment
Share on other sites

Okay I'm working through a Mun mission at the moment, first one with kerbals so I need extensive planning. This is planned for about 2.5 weeks ahead of the current game time. I used the rendezvous plotter to get my initial Mun burn time and info, circularized and plane-changed to match the orbit of a vessel I want to rendezvous with. From there I went back to the rendezvous plotter with the Final State information from Mission Architect and imported the current orbital information of the target vessel from KSP. However, the red orbit of my kerbed Mun craft seems to be inclined opposite the target vessel. The only thing I notice different in the parameters between the MA and RP is that one has True Anomaly and the other calls for Mean Anomaly. So how do I go about getting the Mean Anomaly for my final orbit?

IW5qD5l.png

DafNXe7.png

Also, it would be helpful if we could select and copy the values from the Final State box for input elsewhere when needed, it's faster and will reduce errors from typing by hand.

Also also, it would be great if the State Log could include << and >> buttons as well, or something similar. Basically, a way to jump straight to the next Event in the log so I can see things like time and remaining fuel weight.

I'm actually starting to feel a little bit competent with this thing....

Link to comment
Share on other sites

Arrowstar,

I was inspired by your improvements of the fly-by planner through vectorization to try my hand at some as well. I aimed to speed up the Porkchop plot through vectorizing the lambert solver. It, uh, works amazingly well. Plotting 2500 points in 0.1622 seconds, versus 44.8668. Plotting 62500 points in 2.0 seconds, versus 437 seconds. 280x faster is kinda nice. And I'm absolutely positive I'm still doing some things inefficiently.

I ended up heavily reworking Oldenhuis's lambert.m into lambert_vector.m to vectorize the solutions. I also used the mtimesx routine to enable multi-dimensional matrix multiplies. Ends up being very handy for storing position and velocity vectors in a higher-order matrix, and still being able to calculate each vector's 2-norm and otherwise manipulate the individual vectors. Finally, computePorkChopData.m had to be modified to marshall all the data in the matrices needed for lambert_vector. It's been a fun weekend exercise. I'm happy to pass the files on to you, if you'd like.

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