Jump to content

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


Recommended Posts

4 hours ago, trinimac said:

Hi, I seem to be running into an issue starting the Launch Vehicle Designer for some reason. Shortly after clicking on it, the window pops up, then closes, and the program presents an error window "An error occured while opening Launch Vehicle Designer. Please see the ksptot.log for more details." Looking at the log it gives this

 

"Invalid default value for property 'genericSelectableModels' in class 'SteeringModelsSet':
Invalid default value for property 'gammaAngleFitNet' in class 'GenericSelectableSteeringModel':
Unrecognized function or variable 'simplefit_dataset'."

 

I've tried running the program as administrator, and reinstalling it. Everything else seems to work fine, so I'm not entirely sure what the issue is.

I've got it fixed.  Go ahead and redownload the KSPTOT v1.6.9 release.

The issue was that the simplefit_dataset file apparently doesn't deploy in MATLAB R2022a, though it did in R2021a.  Thanks for catching this!  I would not have known about this issue otherwise.

Link to comment
Share on other sites

KSPTOT noob question alert!!! ;)

But first things first:  Thank You @Arrowstarfor your amazing work.

Not 100% noob tried 1.5.0 with RSS/RO-RP1/Principia with dissapointing results.

I see very impressive changelog including n-body support.

I'm reding trough LVD tutorial and my question is:

How do I transfer that gloriously optimised flight path into KSP?

kOS script export?

I'm looking for a tool to plan and execute luna style direct ascent moon transfer. KSPTOT seems perfect for planing, execution however is where I'm lost at.

 

I'm still playing RSS/RO-RP1/Principia - yes I'm a masochist ;)

 

Update:

loading bodies.ini generated from my RSS+principia save fails

logfile:

Unrecognized function or variable 'p99'.

Error in KSPTOT_BodyInfo/setBaseBodySurfaceTexture (line 470)

Error in processINIBodyInfo (line 114)

Error in mainGUI_App/loadBodiesFromFile_Callback (line 538)

Error in appdesigner.internal.service.AppManagementService/executeCallback (line 138)

Error in matlab.apps.AppBase>@(source,event)executeCallback(appdesigner.internal.service.AppManagementService.instance(),app,callback,requiresEventData,event) (line 63)

Error using matlab.ui.internal.controller.WebMenuController/fireActionEvent
Error while evaluating Menu Callback.

there is no p99 in the bodies file - it loads after reducing bodies count to 30(there is 32)

Am I right thinking that i should add "propType = numerical_integration" to each body to make them true principia compatible?

if so it fails same way as supplied bodies_stockprincipia.ini file. loading it produces "integrating trajectories" dialog and then hangs

logfile:

Unable to resolve the name 'obj.getAngVelWrtOriginAndRotMatToInertial'.

Error in GlobalBaseInertialFrame/getOffsetsWrtInertialOrigin (line 21)

Error in AbstractElementSet/convertToFrame (line 67)

Error in CelestialBodyIntegration/integrateCelestialBodies (line 72)

Error in CelestialBodyData (line 58)

Error in mainGUI_App/loadBodiesFromFile_Callback (line 539)

Error in appdesigner.internal.service.AppManagementService/executeCallback (line 138)

Error in matlab.apps.AppBase>@(source,event)executeCallback(appdesigner.internal.service.AppManagementService.instance(),app,callback,requiresEventData,event) (line 63)

Error using matlab.ui.internal.controller.WebMenuController/fireActionEvent
Error while evaluating Menu Callback.
 

 

 

 

 

Edited by ZAJC3W
Link to comment
Share on other sites

1 hour ago, ZAJC3W said:

KSPTOT noob question alert!!! ;)

But first things first:  Thank You @Arrowstarfor your amazing work.

Not 100% noob tried 1.5.0 with RSS/RO-RP1/Principia with dissapointing results.

I see very impressive changelog including n-body support.

I'm reding trough LVD tutorial and my question is:

How do I transfer that gloriously optimised flight path into KSP?

kOS script export?

I'm looking for a tool to plan and execute luna style direct ascent moon transfer. KSPTOT seems perfect for planing, execution however is where I'm lost at.

 

I'm still playing RSS/RO-RP1/Principia - yes I'm a masochist ;)

 

Update:

loading bodies.ini generated from my RSS+principia save fails

logfile:

Unrecognized function or variable 'p99'.

Error in KSPTOT_BodyInfo/setBaseBodySurfaceTexture (line 470)

Error in processINIBodyInfo (line 114)

Error in mainGUI_App/loadBodiesFromFile_Callback (line 538)

Error in appdesigner.internal.service.AppManagementService/executeCallback (line 138)

Error in matlab.apps.AppBase>@(source,event)executeCallback(appdesigner.internal.service.AppManagementService.instance(),app,callback,requiresEventData,event) (line 63)

Error using matlab.ui.internal.controller.WebMenuController/fireActionEvent
Error while evaluating Menu Callback.

there is no p99 in the bodies file - it loads after reducing bodies count to 30(there is 32)

Am I right thinking that i should add "propType = numerical_integration" to each body to make them true principia compatible?

if so it fails same way as supplied bodies_stockprincipia.ini file. loading it produces "integrating trajectories" dialog and then hangs

logfile:

Unable to resolve the name 'obj.getAngVelWrtOriginAndRotMatToInertial'.

Error in GlobalBaseInertialFrame/getOffsetsWrtInertialOrigin (line 21)

Error in AbstractElementSet/convertToFrame (line 67)

Error in CelestialBodyIntegration/integrateCelestialBodies (line 72)

Error in CelestialBodyData (line 58)

Error in mainGUI_App/loadBodiesFromFile_Callback (line 539)

Error in appdesigner.internal.service.AppManagementService/executeCallback (line 138)

Error in matlab.apps.AppBase>@(source,event)executeCallback(appdesigner.internal.service.AppManagementService.instance(),app,callback,requiresEventData,event) (line 63)

Error using matlab.ui.internal.controller.WebMenuController/fireActionEvent
Error while evaluating Menu Callback.
 

Right, there's a few things here.  First, yes, if you want an open loop guidance solution to execute your trajectories, you can use the kOS execution script.  It works a lot better in-space because drag modeling is a pain in the neck, but you can use it with reasonably good results in atmosphere too.  There are some caveats.

  1. You need to get your mass properties right exactly to have any sort of reasonable chance of success using the kOS script.  Because there's no closed loop guidance to adjust steering and throttle to hit targets, if your masses are off in your vehicle configuration, all of your burns will also be off.
  2. The same note goes for the engine characteristics.  If your thrust and isp curves don't match what's in game, your burns will also all be off.
  3. I'm not sure if you're leaving from Earth and going to the moon or just ascending from the moon's surface, but if it's the former, you'll need to create high quality drag profiles for your vehicle for each configuration it could be in (so basically after staging bits).  There's another script in the kOS scripts folder in the KSPTOT download ZIP file that does this.  Pop it open and read the header content to see what it does.  Just run it on the launch pad and set aside a few hours for it to do its thing (kOS is slow).  Then you'll use the kOS drag model in LVD to read in those drag profiles and use them.
  4. You'll want to advance your script and re-optimize your mission after each major maneuver to account for the minor differences in steering and modeling between LVD and KSP.  We even do this in real life so it's not too crazy. :)

Regarding the error messages, can you please send me the bodies.ini file so I can take a look?  I'm guessing you found at least one bug.  If so I'll get a fix out ASAP, but I need the bodies file to reproduce the issue.

Thanks!

Link to comment
Share on other sites

14 minutes ago, ZAJC3W said:

bodies.ini is linked in my previous post above.

and again in  HERE

BTW bodies_StockPrincipia.ini    included in KSPTOT distribution zip won't load either.

 

No worries, thanks for the info.  I've got a fix and I'm rebuilding it now.  I'll have it uploaded in a few hours!

And to answer the previous question, yes, you would want to use the numerical integration mode on the celestial bodies to reproduce what Principia does.

Link to comment
Share on other sites

:0.0::confused:fastest bugfix I've ever seen!!!!

 

just thinking now...

What if pulling vessel data was done through KSPTOT_connect plugin?

load rocket to launchpad, then read launch vehicle stats in KSPTOT?

Mammooth job i guess?
 

 

Edited by ZAJC3W
Link to comment
Share on other sites

53 minutes ago, ZAJC3W said:

:0.0::confused:fastest bugfix I've ever seen!!!!

Go redownload KSPTOT from the first post in this thread and let me know if that works for you.  Should be fixed now.

Quote

just thinking now...

What if pulling vessel data was done through KSPTOT_connect plugin?

load rocket to launchpad, then read launch vehicle stats in KSPTOT?

Mammooth job i guess?

Yeah, that would probably be impossible to implement in a way which is satisfactory to everyone.  But I'll think about it some more, it's a good idea, even if it'd be a ton of work!

Link to comment
Share on other sites

3 hours ago, eggpusheen said:

So idk but i just dont know how the Multi-Flyby Maneuver Sequencer works because everytime it seems to just not work.

Can you give me a description of what you're trying to do?  A screenshot of the MFMS window before you tap the compute button would be super helpful too.

Link to comment
Share on other sites

So im trying to do is from kerbin to eve to duna. idk what i did wrong

8 hours ago, Arrowstar said:

Can you give me a description of what you're trying to do?  A screenshot of the MFMS window before you tap the compute button would be super helpful too.

 vufrAm3.pngkzDlyEA.png

Link to comment
Share on other sites

2 hours ago, eggpusheen said:

So im trying to do is from kerbin to eve to duna. idk what i did wrong

 vufrAm3.pngkzDlyEA.png

Okay, this is a bug that showed up from the new MATLAB version.  I thought I fixed it a while back.  I'll take a look today.  Thanks for the report! 

Link to comment
Share on other sites

6 hours ago, eggpusheen said:

So im trying to do is from kerbin to eve to duna. idk what i did wrong

 vufrAm3.pngkzDlyEA.png

I've got a fix worked out and I'm rebuilding the application now.  I'll edit this post when I've got it uploaded for you to try out!

EDIT: New build with fix is uploaded.

Edited by Arrowstar
Link to comment
Share on other sites

19 hours ago, Arrowstar said:

Go redownload KSPTOT from the first post in this thread and let me know if that works for you.  Should be fixed now.

Thank You, it works as intended now.

How do I extend bodies trajectories integration cache past 86400000s(just over 3.5years)?

I could work with short cache just adjusted to revelant time span, currently past  200000000s(just over 7 years).

19 hours ago, Arrowstar said:

Yeah, that would probably be impossible to implement in a way which is satisfactory to everyone.  But I'll think about it some more, it's a good idea, even if it'd be a ton of work!

Don't think too much on my account, it wont be very useful for RSS since drag model kOS script works only for stock system(maybe upscaled too), and I doubt id would work for FAR either.

Anyways, the LVD automation could be easier trough kOS rather than KSPTOT_connect plugin, but i have to admit my programming knowlege is very limited.

 

For anyone looking for direct moon ascent solution HERE is kOS script collection by RCrockford. "Polar direct ascent.ks" is the one, it won't work with Atlas style 1/2 stage LV though, and won't work unless it's invoked manually.

Edited by ZAJC3W
I was wrong
Link to comment
Share on other sites

5 minutes ago, ZAJC3W said:

How do I extend bodies trajectories integration cache past 86400000s(just over 3.5years)?

I could work with short cache just adjusted to revelant time span, currently past  200000000s(just over 7 years). 

On the main KSPTOT window: Edit menu -> Configure Celestial Body State Cache.  Enter the start and end times you wish to create the cache between and push the button.  It will do its things and then close the window.  You're all set at that point.

Link to comment
Share on other sites

4 minutes ago, Arrowstar said:

On the main KSPTOT window: Edit menu -> Configure Celestial Body State Cache.  Enter the start and end times you wish to create the cache between and push the button.  It will do its things and then close the window.  You're all set at that point.

Thanks, how did i miss that is beyond me :blush:

Link to comment
Share on other sites

On 6/5/2022 at 2:12 PM, eggpusheen said:

Can some one make a tutorial for Multi-Flyby Maneuver Sequencer or Rendezvous Maneuver Sequencer. It would be very thankfull.

If you look at the tutorial for Mission Architect called "Solar System's Edge", the first part of it talks about using MFMS.  The application has changed a bit since this tutorial was written but I think it'll point you in the right direction if nothing else.

Link to comment
Share on other sites

Ok, first of all, this tool is absolutely awesome.  Thanks for all your work Arrowstar.

I've been going through the tutorials and tinkering around with the mission architect.  Is there a way to create a delta-v maneuver with a user-defined delta-v magnitude, and let TOT determine the direction to attempt to satisfy constraints or optimize some variable?

For example, say I have some solid kick motor on a satellite that is coasting on a transfer orbit from LKO to some higher orbit.

Could I tell TOT to do a burn at apoapsis with, say, X km/s delta-v in order to enter a final state orbit with a period of Y hours, but with eccentricity allowed to vary freely because I don't care about that as much as the period and it gives a place to dump excess delta-v? 

Link to comment
Share on other sites

1 hour ago, EpicSpaceTroll139 said:

Ok, first of all, this tool is absolutely awesome.  Thanks for all your work Arrowstar.

Thank you!  Make sure you've got the latest (and just released) v1.6.9 if you haven't downloaded that already. :)

Quote

I've been going through the tutorials and tinkering around with the mission architect.  Is there a way to create a delta-v maneuver with a user-defined delta-v magnitude, and let TOT determine the direction to attempt to satisfy constraints or optimize some variable?

For example, say I have some solid kick motor on a satellite that is coasting on a transfer orbit from LKO to some higher orbit.

Yes, you can absolutely do this.  If you want to use Mission Architect, insert a Delta-V Maneuver and use one of the "Spherical" element sets.  Then fix the "DV Mag" to whatever you need it to be and optimize the azimuth ("Az") and elevation ("El") quantities.

Quote

Could I tell TOT to do a burn at apoapsis with, say, X km/s delta-v in order to enter a final state orbit with a period of Y hours, but with eccentricity allowed to vary freely because I don't care about that as much as the period and it gives a place to dump excess delta-v? 

Set a constraint to constrain the period to Y hours (in seconds) and minimize the eccentricity as the objective function.

 

This all said, I wouldn't actually use Mission Architect.  Launch Vehicle Designer is far more fully featured and much closer to a professional trajectory design tool.  MA is fine for simple things (like what you're talking about here), but LVD opens up so much more possibilities and is much more powerful.

Let me know if you have any more questions!

Link to comment
Share on other sites

Thanks!  I felt sure there had to be a way to do it, given how flexible your program is.  Not sure why I didn't think of the spherical elements set honestly.  I've used them recently in classes, should have been fresh in my brain. :P

 

Anyways, I wanted to work on training myself in LVD, so I read through the "Eve: The Final Frontier" tutorial.  I thought it made sense, so I opened LVD and started tinkering.  I thought I'd start off simple.  No atmosphere.  No dropping stages.  Just a small, single stage vehicle with a single engine and single tank taking off from the surface of Vall and going into orbit.  

I was able to configure my little vehicle with the stage, engine, tank, and a battery just fine.  I was also able to set up most of my initial state,* create events with specified durations/termination triggers and actions too.  But for some reason I can't seem to save any changes I make to the steering or throttle models.  That goes both for events using actions, and just setting their values at the initial state.

At first, I assumed it was something I was doing wrong, so I spent quite some time troubleshooting, but eventually I went and looked in the ksptot.log.  There's this 7 line error message that pops up every time I click the Save and Close button.  The first line "Dot indexing is not supported for variables of this type" stood out to me because I have gotten smacked with that bug so many times  in my own MATLAB work.  :confused:

I've linked the log and LVD files here in my google drive.

Perhaps this is some issue that came with the new MATLAB Runtime version?  My install of MATLAB Runtime and TOT are both just 2 days old, so they should have all the proper updates.

 

Link to comment
Share on other sites

7 minutes ago, EpicSpaceTroll139 said:

Anyways, I wanted to work on training myself in LVD, so I read through the "Eve: The Final Frontier" tutorial.  I thought it made sense, so I opened LVD and started tinkering.  I thought I'd start off simple.  No atmosphere.  No dropping stages.  Just a small, single stage vehicle with a single engine and single tank taking off from the surface of Vall and going into orbit.  

I was able to configure my little vehicle with the stage, engine, tank, and a battery just fine.  I was also able to set up most of my initial state,* create events with specified durations/termination triggers and actions too.  But for some reason I can't seem to save any changes I make to the steering or throttle models.  That goes both for events using actions, and just setting their values at the initial state.

At first, I assumed it was something I was doing wrong, so I spent quite some time troubleshooting, but eventually I went and looked in the ksptot.log.  There's this 7 line error message that pops up every time I click the Save and Close button.  The first line "Dot indexing is not supported for variables of this type" stood out to me because I have gotten smacked with that bug so many times  in my own MATLAB work.  :confused:

I've linked the log and LVD files here in my google drive.

Perhaps this is some issue that came with the new MATLAB Runtime version?  My install of MATLAB Runtime and TOT are both just 2 days old, so they should have all the proper updates.

 

You found a bug!  I've got a fix implemented but it's going to take some time rebuild the executable.  In the mean time, if you go into each of the steering models and just open and close each of them (like you were editing them), that should work around the issue.  I'll try to get a new build up either late tonight or tomorrow.

Link to comment
Share on other sites

15 hours ago, EpicSpaceTroll139 said:

Thanks!  I felt sure there had to be a way to do it, given how flexible your program is.  Not sure why I didn't think of the spherical elements set honestly.  I've used them recently in classes, should have been fresh in my brain. :P

 

Anyways, I wanted to work on training myself in LVD, so I read through the "Eve: The Final Frontier" tutorial.  I thought it made sense, so I opened LVD and started tinkering.  I thought I'd start off simple.  No atmosphere.  No dropping stages.  Just a small, single stage vehicle with a single engine and single tank taking off from the surface of Vall and going into orbit.  

I was able to configure my little vehicle with the stage, engine, tank, and a battery just fine.  I was also able to set up most of my initial state,* create events with specified durations/termination triggers and actions too.  But for some reason I can't seem to save any changes I make to the steering or throttle models.  That goes both for events using actions, and just setting their values at the initial state.

At first, I assumed it was something I was doing wrong, so I spent quite some time troubleshooting, but eventually I went and looked in the ksptot.log.  There's this 7 line error message that pops up every time I click the Save and Close button.  The first line "Dot indexing is not supported for variables of this type" stood out to me because I have gotten smacked with that bug so many times  in my own MATLAB work.  :confused:

I've linked the log and LVD files here in my google drive.

Perhaps this is some issue that came with the new MATLAB Runtime version?  My install of MATLAB Runtime and TOT are both just 2 days old, so they should have all the proper updates.

 

Issue's been resolved and new builds are uploaded.  Please go ahead and redownload.  Thanks!

Link to comment
Share on other sites

4 hours ago, Arrowstar said:

Issue's been resolved and new builds are uploaded.  Please go ahead and redownload.  Thanks!

Thanks!  LVD is working wonderfully now!  Next time I if find a bug, I'll post it on the Github since I see now that was where you wanted them lol :confused:

Link to comment
Share on other sites

First off, I want to say thank you Arrowstar for being so quick to fix the bugs I found!  

 

Secondly, while using LVD, I had an idea for a (hopefully) simple feature that I think anyone using LVD regularly would find useful.  No pressure on adding it (this is already an amazing tool that you're providing free of charge lol), just wanted to share the idea.

 

Context:

Using LVD, I've realized that a significant amount of my setup time for each mission is spent looking back and forth between KSP (or the wiki, or part config files), a calculator, and LVD just entering in isp and thrust profiles for engines on each stage (fortunately nothing I've done has needed the throttle modifier profile yet).  At the same time, I find I'm often using the same 4-5 engines, just in different clusters* and staging orders for each mission.

 

Idea:

Import and export of (or perhaps some kind of "favorites" bar for) engines with saved specifications.

A user could go through the various settings found in the "edit engine" window to create an engine to the specs of, for example, a Raptor 2.0.  The user could then optionally click a button to save the engine configuration for later use outside the current mission.  Later, setting up another mission, when the user is in the "edit engines" window, there would be an option (perhaps as a dropdown when hovering the mouse over the "add engine" button) to select one of the saved engines to add, and then to enter a number for how many of it to add,** what stage to put it in, and a name.  Upon hitting confirm, an engine with the desired name would be added to the stage with the same throttle limit, isp profile, and throttle modifier profile settings as the saved engine, and with the same thrust profile and EC charge/drain settings, but scaled by the number the user entered.

*I'm aware of the duplicate engine button, but usually I model a cluster of engines as a single big one in LVD, so I don't have to activate/deactivate them individually.

**I presume nobody wants to actually deal with adding 33 individual raptors for a Superheavy and editing their corresponding events  :confused:

 

Thanks for reading, and again, no pressure on adding this.  I just wanted to kind of throw it out there.

Edit:  I might actually be willing to try helping out with coding it if you think it's a decent idea, as I do have MATLAB installed and have experience with it.  Not guarantees on timeliness or it working tho lol.  I've never used the app designer before.

Edited by EpicSpaceTroll139
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...