Jump to content

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


Arrowstar
 Share

Recommended Posts

6 minutes ago, Drew Kerman said:

ugghgh and you'd think this is easy in KSP but I found out way more often that I would have imagined that somehow I managed to get it wrong either from not properly checking the input I gave KSPTOT or improperly reading numbers from the game myself. Sometimes I couldn't even track down where the hell the mass discrepancy came from even when I thought I was being meticulous. So it's just a PITA no matter what :P

You really would think this would be easy, yep lol.  It does make me kinda happy that it's just as much of a pain in KSP as it is in real life though! ;)

Link to comment
Share on other sites

19 minutes ago, TheUntitledGoose said:

I mean I knew I would need course correction but you'd think in a game with physics that can be semi predicted it could be a lot more accurate.

Oh, the physics can absolutely be predicted, not a problem.  The problem is that the system is extremely sensitive to the assumptions you make.  If you assume that your maneuvers are all impulsive, then error creeps in because in reality they do take a finite, non-zero amount of time to execute.  The fact that you hit Eve's SoI with that assumption means that the error was actually pretty small.  Remember, you're basically trying to make one bullet flyby near another bullet at millions of kilometers away and moving many kilometers per second.  What you were able to achieve with impulsive maneuvers is not a failure, it's a success of the impulsive delta-v assumption!

If you want to get more accuracy out of the LVD tool, it can absolutely be done.  (See this video for me flying a powered ascent from the Mun's surface to orbit using nothing but LVD's steering and a kOS script as controls).  But then you pay the cost for that accuracy: you need to get your mass modeling right, you need to get your engine thrust and Isp right, and you need to execute the maneuver in KSP exactly as you execute it in LVD.  If you can do all that, like I showed the video, then LVD can pretty much fly your vehicle wherever you want, however you want, exactly as you want! :)

Link to comment
Share on other sites

Coming soon to Launch Vehicle Designer (LVD): non-spherical (or "higher order") gravity modeling.  If anyone's familiar with the EGM96 or EGM2008 Earth gravity models, this will let you implement those to get realistic gravitational motion at, for example, geostationary orbit.  It was pretty easy to implement and definitely works!

This image is the longitude time history of a vehicle in geostationary orbit around Earth over the course of about 14 Earth days or so.

TVWNab9.png

Link to comment
Share on other sites

Something I've wanted to do for a while in KSPTOT now is have the ability to model solar radiation pressure (SRP) in Launch Vehicle Designer.  This has two applications.  First, for those interested in long term Kerbin station keeping problems, SRP is a major perturbation to your orbit.  Second, assuming you have a solar sail large enough to make a difference, solar radiation can be used for orbit raising or orbit lowering maneuvers in solar orbit.  (I think it can also be used for plane changes if you steer correctly!)  This new functionality will be available in the next pre-release of KSPTOT.

There are two models of SRP in LVD.  The first is the "spherical" model.  This model assumes your spacecraft is a sphere with a fixed area facing the Sun regardless of attitude.  The material used has a fixed coefficient of reflectivity.

djsqIv0.png

The reference solar flux and solar flux reference distance refer to the power per meter squared emitted from the Sun at some arbitrary reference distance from the Sun.  For our real solar system, that's 1367 W/m^2 at 1 AU.  In the only major solar sail mod I could find, the same reference solar flux was approximately used at Kerbin's SMA distance from Kerbol.

The second SRP model is a solar sail model.  This model works by applying solar radiation pressure to a flat plate that is oriented in some way w.r.t. the Sun.  Notice there are now three coefficients, one each for the three difference ways light can interact with your surface.  Absorption does exactly what it sounds like and all the momentum from the light simply transfers directly to the vehicle.  Specular and diffuse reflection of light are what allow a solar sail to perform orbit raising/lowering maneuvers because, unlike pure absorption, they transmit some force in the direction of the solar sail's normal vector (the direction out of the plane of the sail). 

g9KCjxf.png

You can set your initial solar radiation pressure model from the Edit Initial State menu accessible from the main LVD window (Scenario -> Edit Initial State).  There's a new button available for this.  There's also a new event action to let users modify their SRP properties in the middle of a mission, say to model solar sail deployment or retraction.

zbaRxxY.png

I can't leave without a shot of the new system in action.  Here's a solar sail craft in low solar orbit using SRP to raise its orbit, perhaps to head to Moho.

ZhDaAyj.png

That's all I've got for now!  Any questions or thoughts?

Link to comment
Share on other sites

Just now, Drew Kerman said:

so this requires which mod(s)?

I believe the only solar sail mod I could find for the most recent version of KSP is Photon Sailor.  I don't support the "giant laser from KSC that pushes you along" bit from that mod, but my stuff should handle the actual solar radiation pressure bit just fine.

 

Link to comment
Share on other sites

  • 2 weeks later...
On 8/21/2022 at 12:31 AM, TheUntitledGoose said:

Hello! As I've became a bit more experienced at the game and the tool, I was wondering about how you made your ship look at KSC using kOS. 

I assume you're talking about that video I put up a year or two ago on Vimeo.  It actually was pretty easy.  In Launch Vehicle Designer, I created a custom reference frame with the spacecraft at the center, the X axis pointing from the spacecraft to KSC, and the Y axis pointing from the spacecraft to the Sun.  I then used that reference frame to steer the vehicle, just setting the steering angles to 0 deg right ascent and 0 deg declination.

To get that into KSP, I used the LVD function which creates a special CSV file that is read in by a kOS script that comes with KSPTOT.  That does the steering in KSP.  Let me know if you have any other questions!

Link to comment
Share on other sites

Posted (edited)

Tonight I've built KSPTOT v1.6.10 pre-release 1.  Here's the change log:

  • LVD: kOS control script now also takes with the CSV the orbit elements at the mission time so that it can display orbit element errors as a function of time. 
  • LVD: Now supports spherical harmonics gravity for the central body gravity.
  • LVD: Added solar radiation pressure models (spherical and solar sail).  Added associated UIs.  Added event action to adjust SRP model.  Added solar sail orbit raising example.
  • LVD: Fixed bug with using the camera toolbar stuff causing errors and deleting context menus.
  • LVD: Update initial state dialog to be a bit more compact.
  • LVD: Added ability to view Drag Force in main view area.
  • LVD: Added a Lagrange Point geometric point.
  • LVD: Added height of terrain constraint + GA task, as well as height maps for all default bodies from Sigma Cartographer mod for KSP.
  • LVD: Tons of performance improvements.

Please let me know if you have any questions or find any bugs!  Happy orbiting. :)

Edited by Arrowstar
Link to comment
Share on other sites

On 8/22/2022 at 7:04 PM, Arrowstar said:

I assume you're talking about that video I put up a year or two ago on Vimeo.  It actually was pretty easy.  In Launch Vehicle Designer, I created a custom reference frame with the spacecraft at the center, the X axis pointing from the spacecraft to KSC, and the Y axis pointing from the spacecraft to the Sun.  I then used that reference frame to steer the vehicle, just setting the steering angles to 0 deg right ascent and 0 deg declination.

To get that into KSP, I used the LVD function which creates a special CSV file that is read in by a kOS script that comes with KSPTOT.  That does the steering in KSP.  Let me know if you have any other questions!

A quick question is there any guide on how mission architect works?

Link to comment
Share on other sites

20 hours ago, TheUntitledGoose said:

A quick question is there any guide on how mission architect works?

There should be a tutorial that comes with the main KSPTOT download.  You can check that out.  That said, I would actually recommend trying to learn Launch Vehicle Designer (LVD).  It's basically Mission Architect but way more powerful in literally every way.  Feel free to check that one out too!

Link to comment
Share on other sites

  • 2 weeks later...
3 hours ago, dlrk said:

In the RMS, what is the difference between the orbital epoch and initial epoch?

The orbital epoch is the time at which the orbit's Mean Anomaly is at.  The Initial Epoch is the earliest time that the rendezvous could take place.

Link to comment
Share on other sites

  • 5 weeks later...

Hi everyone,

I've built KSPTOT v1.6.10 pre-release 2.  This is pretty minor but I had some updates pending that I wanted to make sure I pushed out so they weren't forgotten.  On that note, if anyone has any bugs or suggestions to report, please let me know. :)

Here's the change log:

  • LVD: Added new "LVD Console" tool (Tools menu -> LVD Console) that acts like a terminal/console and lets you interact with under underlying LVD data without needing to write a plugin to do it.
  • Some performance improvements due to recompiling some MEX files.

That's all I've got.  Happy orbiting. :)

Link to comment
Share on other sites

I feel like I might be missing something obvious, but I wanted to do a mission with multiple flybys and stumbled across this tool (So still very new to it) and think I've mostly understood the basics.
I've set up a simple Kerbin > Eve > Duna sequence in the Multi-Flyby sequencer, saved it for the LVD and ran the csv with kOs.  It shows the next event and orients the craft, but there is no automatic time warp and if I try to timewarp manually the script seems to stop.

EDIT: There was something I'm missing, my solar panels were rotating into a position that briefly killed the battery.

It would be very nice to have a tutorial on how to do a multi flyby mission starting from kerbin or LKO tho! :)

Edited by 7e21
Link to comment
Share on other sites

  • 4 weeks later...
14 hours ago, Clayel said:

image.png

Trying to calculate a gravity assist chain from Eeloo to Moho and I keep getting stuff like this, can anyone help?

This means that the solver could not find a feasible trajectory.  Your problem is most likely one of two things.  Either your departure window (upper and lower bounds) is too narrow or your trajectory is too complicated with too many way points and needs to be simplified.  It's hard for me to tell with the image you provided unfortunately because I can't see the UI.

------------------------

In other news, with the upcoming release of KSP 2, I have been thinking about how I'm going to support it.  I think, at least initially, all I'm going to work on is a new KSPTOTConnect plugin for KSP 2 that handles making the bodies.ini file and user upload of delta-v nodes.  Any other functionality will have to be evaluated in the future to see if it's worth the time for me to get it into KSP 2.  As always I'm open to suggestions and the like in this regard! :)

Link to comment
Share on other sites

1 hour ago, Arrowstar said:

This means that the solver could not find a feasible trajectory.  Your problem is most likely one of two things.  Either your departure window (upper and lower bounds) is too narrow or your trajectory is too complicated with too many way points and needs to be simplified.  It's hard for me to tell with the image you provided unfortunately because I can't see the UI.

------------------------

In other news, with the upcoming release of KSP 2, I have been thinking about how I'm going to support it.  I think, at least initially, all I'm going to work on is a new KSPTOTConnect plugin for KSP 2 that handles making the bodies.ini file and user upload of delta-v nodes.  Any other functionality will have to be evaluated in the future to see if it's worth the time for me to get it into KSP 2.  As always I'm open to suggestions and the like in this regard! :)

It's probably the second one, I had about 7 or 8 waypoints in a 20 year transfer window. What would you say is a good amount of waypoints for a complicated gravity assist route? (I was doing eeloo to moho but I couldn't find a good one after a lot of searching)

I also have a suggestion, you should allow a full stop of all runs in the multi-flyby maneuver seqeunce in case I notice that I put in something wrong and I have to manually stop all 50 runs before changing it.

Link to comment
Share on other sites

16 minutes ago, Clayel said:

It's probably the second one, I had about 7 or 8 waypoints in a 20 year transfer window. What would you say is a good amount of waypoints for a complicated gravity assist route? (I was doing eeloo to moho but I couldn't find a good one after a lot of searching)

I would bet you could pretty easily do Eeloo to Moho with just a Jool gravity assist: Eeloo -> Jool -> Moho.  Give that a try maybe?

Quote

I also have a suggestion, you should allow a full stop of all runs in the multi-flyby maneuver seqeunce in case I notice that I put in something wrong and I have to manually stop all 50 runs before changing it.

This is a good suggestion.  I'll take a look into adding this functionality. :)  EDIT: Implemented for next release.

Edited by Arrowstar
Link to comment
Share on other sites

On 11/6/2022 at 2:15 PM, Arrowstar said:

I would bet you could pretty easily do Eeloo to Moho with just a Jool gravity assist: Eeloo -> Jool -> Moho.  Give that a try maybe?

With a reasonable amount of delta-v, yes. Not with 3.2 km/s however. :D

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.

 Share

×
×
  • Create New...