Jump to content

[WIN/MAC/LINUX] KSP Trajectory Optimization Tool v1.6.10 [Major LVD Improvements!]


Recommended Posts

@Arrowstar new possible issue - I'm either using the Ground Stations wrong or something is awry. Here is the MAT file. Repo steps:

  1. open Graphical Analysis tool
  2. select Start UT from event 3 and paste into Start Time
  3. select End UT from event 3 and paste into End Time
  4. select Ockr from Ground Stations
  5. select Line of Sight to Ref. Station as dependent variable
  6. generate plot
  7. visibility should always be 1

Here's the problem with that - it shouldn't always be visible during this event. Here's a look at the Mission Animator:

0MryLnS.png

By the time the craft is at the end of coast event 3 it's clearly well below the horizon, I have to pan and tilt to look around the planet and see the ground station. More conclusively here's an in-game shot using kOS to draw a vector to the Ockr ground station, which is clearly going through the planet. This is before the end of the coast event as well:

t2nPqiql.png

Link to comment
Share on other sites

9 hours ago, Drew Kerman said:

@Arrowstar new possible issue - I'm either using the Ground Stations wrong or something is awry. Here is the MAT file. Repo steps:

  1. open Graphical Analysis tool
  2. select Start UT from event 3 and paste into Start Time
  3. select End UT from event 3 and paste into End Time
  4. select Ockr from Ground Stations
  5. select Line of Sight to Ref. Station as dependent variable
  6. generate plot
  7. visibility should always be 1

Here's the problem with that - it shouldn't always be visible during this event. Here's a look at the Mission Animator:

0MryLnS.png

By the time the craft is at the end of coast event 3 it's clearly well below the horizon, I have to pan and tilt to look around the planet and see the ground station. More conclusively here's an in-game shot using kOS to draw a vector to the Ockr ground station, which is clearly going through the planet. This is before the end of the coast event as well:

t2nPqiql.png

Thanks! I'll take a look!

Link to comment
Share on other sites

On 7/17/2018 at 2:18 PM, Arrowstar said:

@Thomas, a Kerbonaut if you need help using KSPTOT or getting it installed, please let me know.  Thanks!

Thanks for helping me. The only problem I have is that my computer runs on windows XP 32bit, so the newest version of the Matlab software I can use is the R2015b, which is quite older than the one you recommended. Do you think it might be a problem ?

Link to comment
Share on other sites

I am encountering an error when attempting to use KSPTOTConnect to generate a new `bodies.ini`. It looks similar to another user's error. I'm playing 1.4.4 with OPM and The World Beyond. I know Kopernicus is version locked to 1.4.3 but I'm a C# dev so that wasn't much of an obstacle (and there were no breaking changes for Kopernicus in 1.4.4). The error message has no advice besides to ensure KSP is running in the flight scene with KSPTOT loaded which I can verify is true. The KSP.log file even reveals that the 2 programs are talking. I can also upload maneuvers fine and use other KSPTOTConnect features.

The KSPTOT.log is here: https://pastebin.com/iJHaTMiZ

The relevant KSP.log statements are here: https://pastebin.com/W8Rg7xUe

Based on the log output and the other user's problem, I'm guessing that setups with multiple stars aren't working but I didn't see any concrete advice on this. I've got the KSPTOT source open and building on my computer so I'm willing to take additional troubleshooting/debug steps. It seems like `Utilities.getAllCelestialBodyDataAndPrepForTransmission` does all of the heavy lifting here, is this correct?

Are there other ways to generate a bodies.ini? Seems like a pretty simple reformatting of orbital information. Is there anything else going on?

Edited by whitespacekilla
Link to comment
Share on other sites

  • 2 weeks later...

hey @Arrowstar, got another possible bug for you. MAT File.

Repro steps:

  1. Script -> Execution Settings -> Set SOI Search Revs = 100
  2. Create coast to Next SOI
  3. Edit coast to Next SOI and change it to UT
  4. Copy the UT and exit without saving
  5. Select event #1
  6. Insert coast to UT, change the time back by 4 hours
  7. Edit coast to Next SOI (event #3) and change the color to green
  8. Note portion of the orbit turns green (I wanted to quickly see whether the SOI entry was at the ascending or descending node. Here it is at the descending node)
  9. With event #3 still selected, add two additional coasts to Next SOI - this takes us past Mun and back around Kerbin to the next intercept
  10. Advance script to the last event. We are now in the same situation as Step 2
  11. Repeat steps 3-7
  12. Note the entire orbit is now green

For some reason this time when you insert the UT coast event the SOI entry point changes. Originally, at Step 10 if you selected to copy the end UT time of the Next SOI state it would be 62271872.6811. After you insert the coast event, the new end UT time for the Next SOI event has advanced to 64908150.0574

Link to comment
Share on other sites

On 7/24/2018 at 7:41 PM, whitespacekilla said:

I am encountering an error when attempting to use KSPTOTConnect to generate a new `bodies.ini`. It looks similar to another user's error. I'm playing 1.4.4 with OPM and The World Beyond. I know Kopernicus is version locked to 1.4.3 but I'm a C# dev so that wasn't much of an obstacle (and there were no breaking changes for Kopernicus in 1.4.4). The error message has no advice besides to ensure KSP is running in the flight scene with KSPTOT loaded which I can verify is true. The KSP.log file even reveals that the 2 programs are talking. I can also upload maneuvers fine and use other KSPTOTConnect features.

The KSPTOT.log is here: https://pastebin.com/iJHaTMiZ

The relevant KSP.log statements are here: https://pastebin.com/W8Rg7xUe

Based on the log output and the other user's problem, I'm guessing that setups with multiple stars aren't working but I didn't see any concrete advice on this. I've got the KSPTOT source open and building on my computer so I'm willing to take additional troubleshooting/debug steps. It seems like `Utilities.getAllCelestialBodyDataAndPrepForTransmission` does all of the heavy lifting here, is this correct?

Are there other ways to generate a bodies.ini? Seems like a pretty simple reformatting of orbital information. Is there anything else going on?

Thanks for letting me know!

15 hours ago, Drew Kerman said:

hey @Arrowstar, got another possible bug for you. MAT File.

Repro steps:

  1. Script -> Execution Settings -> Set SOI Search Revs = 100
  2. Create coast to Next SOI
  3. Edit coast to Next SOI and change it to UT
  4. Copy the UT and exit without saving
  5. Select event #1
  6. Insert coast to UT, change the time back by 4 hours
  7. Edit coast to Next SOI (event #3) and change the color to green
  8. Note portion of the orbit turns green (I wanted to quickly see whether the SOI entry was at the ascending or descending node. Here it is at the descending node)
  9. With event #3 still selected, add two additional coasts to Next SOI - this takes us past Mun and back around Kerbin to the next intercept
  10. Advance script to the last event. We are now in the same situation as Step 2
  11. Repeat steps 3-7
  12. Note the entire orbit is now green

For some reason this time when you insert the UT coast event the SOI entry point changes. Originally, at Step 10 if you selected to copy the end UT time of the Next SOI state it would be 62271872.6811. After you insert the coast event, the new end UT time for the Next SOI event has advanced to 64908150.0574

Thanks for the report!

Sorry I haven't been around much the past 3-4 weeks.  I am seeing the reports here, but I've been busy with another project that is consuming my free time.  I'm hoping to be able to get to some of these things here in the next few weeks.  Sorry for the delay. :)

Link to comment
Share on other sites

@Arrowstar seems likely it's more specific than just multiple stars. GPP + GEP works fine but stock + OPM + TWB doesn't work. Would it be that playing with "The World Beyond" results in a setup with no common/root orbit? I changed my setup so won't be adding TWB back in to debug for awhile (there's a couple multiple star/non-kerbin setups I'd like to patch first) but if you don't beat me to it, I might contribute some source code back to KSPTOTconnect.

I love using this tool, keep up the good work!

 

Link to comment
Share on other sites

3 minutes ago, whitespacekilla said:

but if you don't beat me to it, I might contribute some source code back to KSPTOTconnect.

Please, by all means!  Start with the source code in the download package, whatever is online is out of date.  If you can improve KSPTOTCONNECT, go for it.  I'm not much of a C# dev so I'm happy for the help.  If you do any work on the plugin, send me a PM with the source code and I'll check it out. 

Link to comment
Share on other sites

6 hours ago, Arrowstar said:

Sorry I haven't been around much the past 3-4 weeks.  I am seeing the reports here, but I've been busy with another project that is consuming my free time.  I'm hoping to be able to get to some of these things here in the next few weeks.  Sorry for the delay. :)

no worries - whenever you get around to it is good enough for me. Thanks for the update

Link to comment
Share on other sites

On 8/5/2018 at 7:54 PM, Drew Kerman said:

hey @Arrowstar, got another possible bug for you. MAT File.

Repro steps:

  1. Script -> Execution Settings -> Set SOI Search Revs = 100
  2. Create coast to Next SOI
  3. Edit coast to Next SOI and change it to UT
  4. Copy the UT and exit without saving
  5. Select event #1
  6. Insert coast to UT, change the time back by 4 hours
  7. Edit coast to Next SOI (event #3) and change the color to green
  8. Note portion of the orbit turns green (I wanted to quickly see whether the SOI entry was at the ascending or descending node. Here it is at the descending node)
  9. With event #3 still selected, add two additional coasts to Next SOI - this takes us past Mun and back around Kerbin to the next intercept
  10. Advance script to the last event. We are now in the same situation as Step 2
  11. Repeat steps 3-7
  12. Note the entire orbit is now green

For some reason this time when you insert the UT coast event the SOI entry point changes. Originally, at Step 10 if you selected to copy the end UT time of the Next SOI state it would be 62271872.6811. After you insert the coast event, the new end UT time for the Next SOI event has advanced to 64908150.0574

I had trouble reproducing this one.  The final event, Event 5, which is a coast to SoI transition, was not able to find an SoI transition.

Judging by what you're describing though, I suspect it's yet again another thing with the numerical precision of the SoI transition finder algorithm.  Do you have a more straight forward way of demonstrating the issue?

Oh, you'll be happy to know I believe I've corrected the line of sight bug you reported before.  When I get it posted if you could look and see if it corrects your issue that would be great.  Thanks!

Link to comment
Share on other sites

7 hours ago, Arrowstar said:

I had trouble reproducing this one.  The final event, Event 5, which is a coast to SoI transition, was not able to find an SoI transition.

So you're saying you get to Step #9 and the fifth event can't find an SOI transition? Not sure what to say. I just went through the steps again myself and here's the result:

x55Ajt3.png

As you can see I'm back in Mun's SOI for event 5

Just to make double sure, I also downloaded and used the file I linked you to and was able to get it to work. My only guess is that maybe you messed up the steps on your first try, did a second try but forgot that when you load a new MAT file the SOI rev count gets reset to 3? I know that if the rev count is not increased it won't hit an SOI for event 5

7 hours ago, Arrowstar said:

Do you have a more straight forward way of demonstrating the issue?

This is currently the only situation in which I know it occurs

7 hours ago, Arrowstar said:

When I get it posted if you could look and see if it corrects your issue that would be great

Sure thingy! *sits and starts pressing F5* ;)

Link to comment
Share on other sites

7 hours ago, Drew Kerman said:

So you're saying you get to Step #9 and the fifth event can't find an SOI transition? Not sure what to say. I just went through the steps again myself and here's the result:

x55Ajt3.png

As you can see I'm back in Mun's SOI for event 5

Just to make double sure, I also downloaded and used the file I linked you to and was able to get it to work. My only guess is that maybe you messed up the steps on your first try, did a second try but forgot that when you load a new MAT file the SOI rev count gets reset to 3? I know that if the rev count is not increased it won't hit an SOI for event 5

This is currently the only situation in which I know it occurs

Sure thingy! *sits and starts pressing F5* ;)

Okay, maybe I just need some clarification as to when you're restarting MA or creating a new mission plan or reloading the mission plan file or whatnot. That was not clear to me when going through the instructions. 

Link to comment
Share on other sites

59 minutes ago, Arrowstar said:

... when you're restarting MA or creating a new mission plan or reloading the mission plan file or whatnot

I am doing none of these things :) Well, okay technically Step 0 would be load the mission plan file I linked to you. But after that there is no restarting/reloading/redoing anything. I'm just suggesting that maybe you did that if you thought you messed up partway through.

Interesting debacle. You can't recreate it and I can't not recreate it :D

Let me know if there's anything else about the repro steps you think needs clarifying

Edited by Drew Kerman
Link to comment
Share on other sites

5 hours ago, Drew Kerman said:

I am doing none of these things :) Well, okay technically Step 0 would be load the mission plan file I linked to you. But after that there is no restarting/reloading/redoing anything. I'm just suggesting that maybe you did that if you thought you messed up partway through.

Interesting debacle. You can't recreate it and I can't not recreate it :D

Let me know if there's anything else about the repro steps you think needs clarifying

So... I did what you instructed and here's what I ended up with:

Yfmqugi.png

Here's a link to the MAT file shown above so you can take a look and tell me what I did wrong lol. :)

Once we get this sorted I'll compile the next pre-release and you can test out the fix(es).

Link to comment
Share on other sites

10 hours ago, Arrowstar said:

take a look and tell me what I did wrong lol. :)

Well, for one thing the last event is supposed to be a coast to SOI - you even named it coast to SOI but it's just a coast to TA. If I change it to a coast to SOI then I get a complete green orbit like I would expect :P However the UT for the end of the state is wrong so you didn't complete the last step or two. Here, have a video! :) 

EDIT: wait - see next post first

Spoiler

Ok now, when you get to the end with the complete green circle, here's how to look at what is wrong. Click the last event and get the end UT time. It should be 64908150.0574172. Now undo two steps which will remove the second event. Click again on the last event, the SOI coast, and get the end UT time. It should have changed to 62271872.6810975

So sticking that coast to UT event 4 hours prior to the original SOI intercept causes MA to skip it and find another, later one

 

Edited by Drew Kerman
Link to comment
Share on other sites

Okay, looks like it's not the Advance Coast that is the problem, since I've reached the next encounter in the game and I have the new orbit state that you would have gotten to after Step 10. So download this MAT file and do the following:

  1. Set SOI Search revs to 100
  2. Add coast to next SOI
  3. Get UT time for end of event 2 - it should be 62271885.4086678
  4. Select event 1 and insert a coast to UT
  5. Paste the end UT (62271885.4086678) and set it back 4 hours
  6. Get UT time for end of event 2 - it should now be 64908176.2437179

Ok, that's the problem right there - creating that intermediate coast event to a point 4 hours prior to the original SOI intercept time produces a different SOI intercept time

Were you up watching Parker launch? Of course the one launch I remember to watch after missing like the last 3 or 4 SpaceX/Ariane launches gets scrubbed. Of course

Edited by Drew Kerman
Link to comment
Share on other sites

Another issue to look at, this time with the MA mission animator. Use this MAT file, which is the same as the one in the last post but in this one I'm just hopping ahead a few times in and out of Mun's SOI. Open the animator and use the >> event jump button. You'll see the orbit for the Mun SOI pass appear around Kerbin but the Kerbin orbit never appears even after you start the animation. In fact it never seems to really transition to Mun frame of reference

Link to comment
Share on other sites

10 hours ago, Drew Kerman said:

Okay, looks like it's not the Advance Coast that is the problem, since I've reached the next encounter in the game and I have the new orbit state that you would have gotten to after Step 10. So download this MAT file and do the following:

  1. Set SOI Search revs to 100
  2. Add coast to next SOI
  3. Get UT time for end of event 2 - it should be 62271885.4086678
  4. Select event 1 and insert a coast to UT
  5. Paste the end UT (62271885.4086678) and set it back 4 hours
  6. Get UT time for end of event 2 - it should now be 64908176.2437179

Ok, that's the problem right there - creating that intermediate coast event to a point 4 hours prior to the original SOI intercept time produces a different SOI intercept time

Were you up watching Parker launch? Of course the one launch I remember to watch after missing like the last 3 or 4 SpaceX/Ariane launches gets scrubbed. Of course

Alright, want to know what the problem was?  This is a plot of the distance of your spacecraft to the Mun SoI over time (horizontal axis is universal time, vertical is distance to SoI).

v9g5GXv.png

See all those local minima (the bottoms of the valleys)?  The SoI transition code was getting stuck in one of them, namely the middle valley.  Because that valley is nowhere near the SoI, it was rejecting the whole solution.

Luckily, I have a solution.  I have added an option to the Mission Architect script execution settings called "Number of SoI Transition Search Attempts" (Settings -> Execution Settings -> Set Num. SoI Search Attempts).

Here's what this does.  See the plot above?  That's a portion of one rev that the code pre-computes in such a way that, if the Mun was going to be intersecting your spacecraft orbit, it would be somewhere in there.  We see that it is, in fact.  There's margin on those bounds, though, so that nothing gets missed, and for fast periods, like the Mun and your spacecraft here, you will probably get a few local minima.  The new setting divides that plot up into a number of equally-sized slices and then attempts to find an SoI transition in each slice, from left to right.  The number you provide dictates the number of slices.  So, if you say 1 (which is the default), the behavior is unchanged from before.  If you say 2, then the first half of that plot gets searched, and then the second half gets searched (so long as an SoI transition was not found in the first half).  If you say 10, then the first tenth gets searched, and then so on... 

Now, one caveat.  This will definitely improve search functionality in cases where the solver was running into bad local minima.  However, it also involves calling that solver more times, which means that setting this new setting to a number greater than 1 will slow down execution speed. Setting it to the maximum of 100 will probably slow down run time by a factor of at least 10x-20x.

Anyway, this new function solves the issue you were seeing.  It, as well as the fix for the line of sight issue you reported, are in a new pre-release: KSPTOT v1.5.11 pre-release 2.

Please test these fixes out and see if they help!  Thanks. :)

(I will take a look at the mission animator stuff you mentioned later!)

Link to comment
Share on other sites

10 hours ago, Drew Kerman said:

Another issue to look at, this time with the MA mission animator. Use this MAT file, which is the same as the one in the last post but in this one I'm just hopping ahead a few times in and out of Mun's SOI. Open the animator and use the >> event jump button. You'll see the orbit for the Mun SOI pass appear around Kerbin but the Kerbin orbit never appears even after you start the animation. In fact it never seems to really transition to Mun frame of reference

Can you take a few pictures of what you mean?

Link to comment
Share on other sites

4 minutes ago, Arrowstar said:

Can you take a few pictures of what you mean?

Ok here's one that shows the gist of it - you can match the settings shown on the left and then just click the >> button once and it will end up like this

FEAQDIW.png

But I mean, regardless even if you just load the Mission Animator straight up and start paging forward events things get messed up straight away it seems

Edited by Drew Kerman
Link to comment
Share on other sites

26 minutes ago, Drew Kerman said:

Both fixes look good, however it seems the default for the SOI search option is 2 not 1

Oh, so I just forgot to update the post about that.  At the last second, after doing some more testing, I decided that 2 was better because it really seemed to improve the odds of finding the SoI transition, but didn't cost that much more time.  So I left it at 2 instead of 1. :)

Anyway, I believe I found the bug in mission animator it was plotting the orbit from one part of the state log, but at the boundary between two SoIs, grabbing the wrong spacecraft position.  I have adjusted the code to correct this. I updated the v1.5.11 pre-release 2 ZIP file with the build that has the fix in it.  Please test at your convenience. :)

 

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