Jump to content

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


Recommended Posts

2 minutes ago, gruneisen said:

Hmmm - that's too bad. Like I said, I always able to get it to work eventually...though perhaps when @Arrowstar checks back in he can take a look at your issue.

As soon as I heard your message come through, it picked it up... are you magic or something?:wink: Thanks for the help!

Link to comment
Share on other sites

58 minutes ago, Cdw2468 said:

As soon as I heard your message come through, it picked it up... are you magic or something?:wink: Thanks for the help!

Ha - I've certainly been accused of worse, so I'll take it! :wink:

I'm glad you were able to get it to work - cheers!

Link to comment
Share on other sites

There seems to an incompatibility between the manoeuvre execution assistant in KSPTOT 1.5.7 and KSP 1.3.0. You can see the error occuring here:

tg2LKrf.png

I imported both the orbit and the manoeuvre node using rightclick -> read from vessel (KSPTOT connect plugin) directly from the game. The plugin seems to read values from the game differently than KSPTOT expects. Namely: SMA, ECC and true anomaly of the burn.

Link to comment
Share on other sites

I have another question. Is there a way to salvage corrupted mission architect files? If I try to open this one, I'll just hear the windows default notification sound but the file won't get loaded (no events listed). It would be good to know what caused this corruption so I can avoid it in the future. I'd hate to work on a flight plan for several hours only to lose all of it. :(

https://drive.google.com/open?id=0B6KLmRpYz5AlUnN6SlVfa1MtR3M

Edited by Three_Pounds
Link to comment
Share on other sites

2 minutes ago, Three_Pounds said:

I have another question. Is there a way to salvage corrupted mission architect files? If I try to open this one, I'll just hear the windows default notification sound but the file won't get loaded (no events listed). I would be good to know what caused this corruption to happen in so I can avoid it in the future. I'd hate to work on a flight plan for several hours only to lose all of it. :(

https://drive.google.com/open?id=0B6KLmRpYz5AlUnN6SlVfa1MtR3M

Ill try to take a look after work. What version of the software are you on?

Link to comment
Share on other sites

23 hours ago, Arrowstar said:

Ill try to take a look after work. What version of the software are you on?

1.5.7

The particular file isn't strictly worth saving as it's just 5 events or so. I was just afraid this might happen again so I wanted to investigate it. Can you tell me more about the file format? How can I open it?

EDIT: another corrupted file: moho_flyby2. I'm starting to get worried.

Edited by Three_Pounds
Link to comment
Share on other sites

Another file gone. But I think I have a lead on where the corruption occurs. It seems to happen after I enter the ranges for ground stations and vessels and run a comm analysis. That's the only thing these files have in common so far. I haven't had a file become corrupted before that.

At least now I kind of know when it occurs and work on a duplicate when I do comm stuff.

https://drive.google.com/file/d/0B6KLmRpYz5Alb09oY3JBU04zRkE/view?usp=sharing

Link to comment
Share on other sites

I forgot to include my bodies.ini - since you'll probably need them when you do get around to have a look at these files. 

https://drive.google.com/file/d/0B6KLmRpYz5AlRlpRcnJwZUZncE0/view?usp=sharing

Another issue with the maneuver execution assistent. The "Read next maneuver Node from KSP active vessel" feature seems to be borked. The prograde component seems to end up in the radial field, the radial in the normal and so forth.

h50oZpL.jpg

Versions are the same from above.

Link to comment
Share on other sites

19 hours ago, Three_Pounds said:

Another file gone. But I think I have a lead on where the corruption occurs. It seems to happen after I enter the ranges for ground stations and vessels and run a comm analysis. That's the only thing these files have in common so far. I haven't had a file become corrupted before that.

At least now I kind of know when it occurs and work on a duplicate when I do comm stuff.

https://drive.google.com/file/d/0B6KLmRpYz5Alb09oY3JBU04zRkE/view?usp=sharing

Can I see the KSPTOT log file you have that shows the error?  I opened up both of your MAT files and they loaded up fine to me.

Link to comment
Share on other sites

20 hours ago, Arrowstar said:

Can I see the KSPTOT log file you have that shows the error?  I opened up both of your MAT files and they loaded up fine to me.

That's strange. I reinstalled everything including the matlab runtime just to make sure nothing on my end is messed up. The log is pretty short. This is what is says:

First file (moho_flyby.mat)

Error using cell/ismember
Input A of class cell and input B of class double must be cell arrays of strings, unless one is a string.
Error in ma_updateMAData (line 125)
Error in ma_MainGUI>openMissionPlanMenu_Callback (line 625)
Error in gui_mainfcn (line 95)
Error in ma_MainGUI (line 42)
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)ma_MainGUI('openMissionPlanMenu_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating Menu Callback

moho_flyby2.mat

Error using cell/ismember
Input A of class cell and input B of class double must be cell arrays of strings, unless one is a string.
Error in ma_updateMAData (line 125)
Error in ma_MainGUI>openMissionPlanMenu_Callback (line 625)
Error in ma_MainGUI>openMissionPlanToolbar_ClickedCallback (line 846)
Error in gui_mainfcn (line 95)
Error in ma_MainGUI (line 42)
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)ma_MainGUI('openMissionPlanToolbar_ClickedCallback',hObject,eventdata,guidata(hObject))
Error while evaluating PushTool ClickedCallback

dres_flyby.mat

Error using cell/ismember
Input A of class cell and input B of class double must be cell arrays of strings, unless one is a string.
Error in ma_updateMAData (line 125)
Error in ma_MainGUI>openMissionPlanMenu_Callback (line 625)
Error in ma_MainGUI>openMissionPlanToolbar_ClickedCallback (line 846)
Error in gui_mainfcn (line 95)
Error in ma_MainGUI (line 42)
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)ma_MainGUI('openMissionPlanToolbar_ClickedCallback',hObject,eventdata,guidata(hObject))
Error while evaluating PushTool ClickedCallback

 

Edited by Three_Pounds
Link to comment
Share on other sites

28 minutes ago, Three_Pounds said:

That's strange. I reinstalled everything including the matlab runtime just to make sure nothing on my end is messed up. The log is pretty short. This is what is says:

First file (moho_flyby.mat)


Error using cell/ismember
Input A of class cell and input B of class double must be cell arrays of strings, unless one is a string.
Error in ma_updateMAData (line 125)
Error in ma_MainGUI>openMissionPlanMenu_Callback (line 625)
Error in gui_mainfcn (line 95)
Error in ma_MainGUI (line 42)
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)ma_MainGUI('openMissionPlanMenu_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating Menu Callback

moho_flyby2.mat


Error using cell/ismember
Input A of class cell and input B of class double must be cell arrays of strings, unless one is a string.
Error in ma_updateMAData (line 125)
Error in ma_MainGUI>openMissionPlanMenu_Callback (line 625)
Error in ma_MainGUI>openMissionPlanToolbar_ClickedCallback (line 846)
Error in gui_mainfcn (line 95)
Error in ma_MainGUI (line 42)
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)ma_MainGUI('openMissionPlanToolbar_ClickedCallback',hObject,eventdata,guidata(hObject))
Error while evaluating PushTool ClickedCallback

dres_flyby.mat


Error using cell/ismember
Input A of class cell and input B of class double must be cell arrays of strings, unless one is a string.
Error in ma_updateMAData (line 125)
Error in ma_MainGUI>openMissionPlanMenu_Callback (line 625)
Error in ma_MainGUI>openMissionPlanToolbar_ClickedCallback (line 846)
Error in gui_mainfcn (line 95)
Error in ma_MainGUI (line 42)
Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)ma_MainGUI('openMissionPlanToolbar_ClickedCallback',hObject,eventdata,guidata(hObject))
Error while evaluating PushTool ClickedCallback

 

Okay, give this debug build a try and tell me if it resolves the issue: https://drive.google.com/file/d/0B83Py_-98MhoRkNQblNBVWRoNWM/view?usp=sharing

Link to comment
Share on other sites

Newbie user of the tool and still very much learning it's uses - I've gone straight to the flashy Multi Flyby Maneuver Sequencer thingy to have some fun.  

While mucking around I was wondering if it's feasible to have a step in between the multiple runs and the final calcs that allows you to choose between most efficient (I'm guessing this is lowest score) and something that "slightly" less efficient but has a more appealing lowest second parameter? eg: leave date or travel time. That way you could get the choice of sacrificing a few hundred delta-v to save a month or so on travel time.

Apologies in advance if this has been asked before (or even if this is a silly idea - haven't really though it throuigh other than planning a mission) I went as far back as page 88 to check though.

 

Separate Question - how many runs do people typically use for the MFMS? 5? 25? more?

Edited by wile1411
Link to comment
Share on other sites

On 8/12/2017 at 10:34 PM, wile1411 said:

Apologies in advance if this has been asked before (or even if this is a silly idea - haven't really though it throuigh other than planning a mission) I went as far back as page 88 to check though.

I came up with a similar idea for the Rendezvous Maneuver Sequencer that was implemented and works well, this is probably more complex tho.

On 8/12/2017 at 10:34 PM, wile1411 said:

Separate Question - how many runs do people typically use for the MFMS? 5? 25? more?

I might have an answer for you in a week or so

@Arrowstar I have another wonky possible edge case in an asteroid orbit - mat file. Just try coasting to Next SOI or Periapsis. There's a warning that the trajectory intercepts Kerbin (which it does in the game as well) but I can't get it to show. Also tried bumping the log entries up to 100,000

Also, this didn't really affect me adversely but when I went to close KSPTOT it popped up the message from Mission Architect saying I had unsaved data so curious what that was I clicked "No" when it asked me to continue and everything exited anyways. So to reproduce open KSPTOT, open MA, do something to dirty the save state, close KSPTOT, say yes, close MA, then no, cancel close.

Edited by Drew Kerman
Link to comment
Share on other sites

I normally don't do feature requests, but there really is something I absolutely want. Can you include a panel in the astrodynamics calculator that takes the one of the different anomalies (true, mean and eccentric) and spits out the other ones? I tried implementing my own but it's actually non trivial and I don't want to rely on a random web based tool. :)

Edited by Three_Pounds
Link to comment
Share on other sites

1 hour ago, Three_Pounds said:

I normally don't do feature requests, but there really is something I absolutely want. Can you include a panel in the astrodynamics calculator that takes the one of the different anomalies (true, mean and eccentric) and spits out the other ones? I tried implementing my own but it's actually non trivial and I don't want to rely on a random web based tool. :)

I've already written a JS file to convert True-Mean based on KSPTOT matlab code. It's hard-coded cause I just needed it for when I was building the geogebra dynamic system models, but I could make it into an interactive version with maybe ecc anomaly as well (haven't looked at that):

var ecc = 0.352002569278094;
var truA = 326.959975419144 * .017453292519943295;
if (ecc < 1.0) {
  var EA = (Math.atan2(Math.sqrt(1-(Math.pow(ecc,2)))*Math.sin(truA), ecc+Math.cos(truA)));
  if (truA < 2*Math.PI) {
    EA = Math.abs(EA - (2*Math.PI) * Math.floor(EA / (2*Math.PI)));
  }
  mean = EA - ecc*Math.sin(EA);
  mean = Math.abs(mean - (2*Math.PI) * Math.floor(mean / (2*Math.PI)));
} else {

  //////////////////////////////
  // computeHyperAFromTrueAnom()
  //////////////////////////////
  var num = Math.tan(truA/2);
  var denom = Math.pow((ecc+1)/(ecc-1),(1/2));
  var HA = 2*Math.atanh(num/denom);

  mean = ecc*Math.sinh(HA)-HA;
}
console.log(mean);

It's not really that bad. Check out the KSPTOT source code, the functions are all well-named based on their purpose, this code was taken from computeMeanFromTrueAnom

But yea - all the helper functions are already there in KSPTOT so shouldn't be hard for Arrowstar to add this I don't think

Edited by Drew Kerman
Link to comment
Share on other sites

1 hour ago, Drew Kerman said:

I've already written a JS file to convert True-Mean based on KSPTOT matlab code. It's hard-coded cause I just needed it for when I was building the geogebra dynamic system models, but I could make it into an interactive version with maybe ecc anomaly as well (haven't looked at that):

It's not really that bad. Check out the KSPTOT source code, the functions are all well-named based on their purpose, this code was taken from computeMeanFromTrueAnom

Oh, that's the easy part. Try doing the reverse and you'll quickly see that there isn't a closed-form solution. After I realized that I would have to build some sort of iterative root-finder into the beloved excel spreadsheet that does the usual heavy lifting, I gave up and decided to pray to the Kerbal god of celestial mechanics coliqually known as @wile1411 to expose a function he's most likely already built into the tool to the user interface.

:)

Edited by Three_Pounds
Link to comment
Share on other sites

31 minutes ago, Three_Pounds said:

Oh, that's the easy part. Try doing the reverse and you'll quickly see that there isn't a closed-form solution. After I realized that I would have to build some sort of iterative root-finder into the beloved excel spreadsheet that does the usual heavy lifting, I gave up and decided to pray to the Kerbal god of celestial mechanics coliqually known as @wile1411 to expose a function he's most likely already built into the tool to the user interface.

:)

I think you're praying to the wrong god there :P Blasphemer! I'll pray to mine and try to summon Them...

@Arrowstar Can you here us from the upsidedown?

 

Edited by wile1411
Link to comment
Share on other sites

4 hours ago, Three_Pounds said:

Oh, that's the easy part. Try doing the reverse and you'll quickly see that there isn't a closed-form solution.

Ah, ok then, Well, glad I only need to go this way then :P

3 hours ago, wile1411 said:

@Arrowstar Can you here us from the upsidedown?

He's too busy playing with his space ships, who can blame him? :D

Link to comment
Share on other sites

4 hours ago, wile1411 said:

I think you're praying to the wrong god there :P Blasphemer! I'll pray to mine and try to summon Them...

@Arrowstar Can you here us from the upsidedown?

 

Yes I can!  Sorry life has been busy. I will get to you all in a day or two hopefully. In the meantime, no blasphemy please. :wink:

Link to comment
Share on other sites

It worked! All good - has trying to make the comment as non-religious as possible and opted for the Stranger Things reference. :wink:

 Take you're time - I'd rather watch the results of your work than my poor attempts at getting to Duna with my own designs. :/

Link to comment
Share on other sites

17 hours ago, Three_Pounds said:

Oh, that's the easy part. Try doing the reverse and you'll quickly see that there isn't a closed-form solution. After I realized that I would have to build some sort of iterative root-finder into the beloved excel spreadsheet that does the usual heavy lifting, I gave up and decided to pray to the Kerbal god of celestial mechanics coliqually known as @wile1411 to expose a function he's most likely already built into the tool to the user interface.

:)

For what its worth, if you already have an EXCEL spreadsheet set up for these calcs, there is a very powerful iterative solver built in. You have to enable the SOLVER add-in into EXCEL, and then once that's done, head over to the DATA tab and hit the SOLVER button. This will allow to achieve a target value in a single cell by changing multiple cells and also use constraints to bound the values of other cells. If this applies, you may not need to do too much re-inventing!

Cheers!

Link to comment
Share on other sites

3 hours ago, gruneisen said:

For what its worth, if you already have an EXCEL spreadsheet set up for these calcs, there is a very powerful iterative solver built in. You have to enable the SOLVER add-in into EXCEL, and then once that's done, head over to the DATA tab and hit the SOLVER button. This will allow to achieve a target value in a single cell by changing multiple cells and also use constraints to bound the values of other cells. If this applies, you may not need to do too much re-inventing!

Cheers!

Thanks for the tip. I have used the solver in the past for other purposes and found that it had problems converging but since this is a much simpler task maybe it can stand up to it. I'll give it a another go. This going a bit OT but do you know if there is an equivalent to the atan2 function from the script above? I wasn't able to find it.

EDIT: Never mind. I am using a non English version of Excel and they gave it a really stupid name. So behold, it's actually working. The solver can even handle negative numbers, which I didn't expect. Yellow are the input fields. To convert M to ν, I let the solver find the value for E and it spits out the true anomaly.

H4lpEGR.png

 

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