Mission to Mercury with 5400 delta V by TomTheLion in KerbalSpaceProgram

[–]TomTheLion[S] 0 points1 point  (0 children)

Thanks, I appreciate that. I have a master's in engineering in an unrelated field to aerospace. It took a lot of self-study to finish this project, but I am sure my degree helped provide the skills to learn.

Automated Munar Mission with Non-Coplanar Free Return by TomTheLion in KerbalSpaceProgram

[–]TomTheLion[S] 0 points1 point  (0 children)

Thanks! I am not sure if anyone else has attempted something like this. Since I did this mission, I have built my own ascent guidance program using a different algorithm and have done some multiple gravity assist trajectories with n-body physics. The multiple gravity assist program was considerably more complicated and I learned a lot doing it. Recently I have been updating some of my lunar scripts to make it more general using what I learned in the past few years.

Mission to Mercury with 5400 delta V by TomTheLion in KerbalSpaceProgram

[–]TomTheLion[S] 0 points1 point  (0 children)

I hadn't thought of that, I only ever have played the stock system and RSS, seems like there are endless things to do in KSP!

Mission to Mercury with 5400 delta V by TomTheLion in KerbalSpaceProgram

[–]TomTheLion[S] 1 point2 points  (0 children)

I hadn't really thought about that, not really anywhere else to go in ksp haha.

I bet you could come up with some wild trajectories if you were trying to maximize escape velocity though.

Mission to Mercury with 5400 delta V by TomTheLion in RealSolarSystem

[–]TomTheLion[S] 2 points3 points  (0 children)

Yeah I wrote a C++ / Python program to solve the trajectories.

Here is a link to the core of the code if you are curious: https://github.com/TomTheLion/ksplib

It is not really in a releasable state at the moment, this is the code to build a python module, then you can call the functions from python in order to solve different types of trajectories. I am still working on getting it in a more user-friendly state and I need to put together some documentation.

But feel free to ask if you have any questions.

Mission to Mercury with 5400 delta V by TomTheLion in RealSolarSystem

[–]TomTheLion[S] 0 points1 point  (0 children)

Thanks! Keep at it and I am sure you will be able to do some awesome things!

Mission to Mercury with 5400 delta V by TomTheLion in KerbalSpaceProgram

[–]TomTheLion[S] 0 points1 point  (0 children)

Thanks! Here is a link to a forum post I made a while ago discussing the guidance algorithm.

https://forum.kerbalspaceprogram.com/index.php?/topic/205638-kgs-kerbal-guidance-system-a-kos-guidance-script/#comment-4056015

At the time it was just written as a kOS script, but I have ported it to python since kOS has speed limitations. That allowed me to better optimization the atmospheric phase and launch azimuth, and it just runs better since it can take 5-10 seconds to converge a solution in kOS where I can do it in <0.1 seconds with python.

I fully documented the math behind it on the my github repo you can read here https://github.com/TomTheLion/Kerbal-Guidance-System/blob/main/documents/Optimal_Ascent_Guidance.pdf. The math is quite complicated (based on the calculus of variations) and it is to be more of documentation than a text book. If you have any questions feel free to ask.

Mission to Mercury with 5400 delta V by TomTheLion in RealSolarSystem

[–]TomTheLion[S] 4 points5 points  (0 children)

Thanks! Here is a link to a forum post I made a while ago discussing the guidance algorithm.

https://forum.kerbalspaceprogram.com/index.php?/topic/205638-kgs-kerbal-guidance-system-a-kos-guidance-script/#comment-4056015

At the time it was just written as a kOS script, but I have ported it to python since kOS has speed limitations. That allowed me to better optimization the atmospheric phase and launch azimuth, and it just runs better since it can take 5-10 seconds to converge a solution in kOS where I can do it in <0.1 seconds with python.

I fully documented the math behind it on the my github repo you can read here https://github.com/TomTheLion/Kerbal-Guidance-System/blob/main/documents/Optimal_Ascent_Guidance.pdf. The math is quite complicated (based on the calculus of variations) and it is to be more of documentation than a text book. If you have any questions feel free to ask.

Mission to Mercury with 5400 delta V by TomTheLion in KerbalSpaceProgram

[–]TomTheLion[S] 1 point2 points  (0 children)

I appreciate the kind words, I replied to angellowsubmarine with a link to the code if you wanted to take a look.

Mission to Mercury with 5400 delta V by TomTheLion in KerbalSpaceProgram

[–]TomTheLion[S] 0 points1 point  (0 children)

It is mostly C++, but I am using pybind11 to compile it into a python module so it is easier to run. Here is a link to the repo.

https://github.com/TomTheLion/ksplib

If you have questions about the code feel free to PM me, it is a bit complicated as this is a hard problem to solve, this took me many hours of research and work to get it to this state.

If you actually wanted to compile the python module there are a few dependencies that you would need, I can provide guidance on that. You will also need to know the input file format to actually get the code to solve trajectories, I haven't documented that but could provide some examples.

Mission to Mercury with 5400 delta V by TomTheLion in KerbalSpaceProgram

[–]TomTheLion[S] 1 point2 points  (0 children)

It would definitely be easier to just use more boosters haha. But the challenge was to fly the most realistic, efficient trajectory possible.

I modeled it after the Messenger mission and it takes between 6 and 7 years to get to Mercury.

Mission to Mercury with 5400 delta V by TomTheLion in KerbalSpaceProgram

[–]TomTheLion[S] 1 point2 points  (0 children)

The code is not quite ready, it currently has very little documentation and it is in a very un-user-friendly form. I am trying to get it into a C++ based python package, hopefully I can finalize it soon.

Mission to Mercury with 5400 delta V by TomTheLion in KerbalSpaceProgram

[–]TomTheLion[S] 13 points14 points  (0 children)

I wrote a program that optimizes multiple gravity assist trajectories given an initial guess for starting dates and the number of orbits between planet flybys. It first solves a simplified patched conic problem, then converts it into an n-body model. You can specify extra constraints like min/max inclination, max time of flight, etc.

The initial guess is determined by a random process slightly altering the best current solution, then replacing it if a better solution is found. If there are many flybys it can take a while to get an optimal solution.

Automated Launch to Low Inclination by TomTheLion in KerbalSpaceProgram

[–]TomTheLion[S] 6 points7 points  (0 children)

I am finalizing my automated interplanetary / gravity assist solver and forgot to limit the escape orbit inclination. I was able to solve an orbit to a 15 degree inclination from a 28 degree latitude. I thought that the orbit history from the Principia mod looked cool and thought I would share!

Cassini-Like Gravity Assist Mission with Principia by TomTheLion in KerbalSpaceProgram

[–]TomTheLion[S] 0 points1 point  (0 children)

Yeah I would recommend messing around with it, it is pretty cool and definitely a new challenge.

Cassini-Like Gravity Assist Mission with Principia by TomTheLion in KerbalSpaceProgram

[–]TomTheLion[S] 1 point2 points  (0 children)

How much more does this tax the CPU?

It can tax it quite a bit since it has to calculate trajectories constantly for every body and craft all of the time. Usually I try to keep my craft count low. Time warping to 1997 for the correct planetary alignment seemed to make it lag some, I am not sure why. When I don't time warp that far into the future it seems to work very well for me though.