Jump to content

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


Recommended Posts

Okay, so I have some thoughts on how something like this could work. It would not be general, though. It would require that all intermediate orbits are not hyperbolic and only work with impulsive maneuvers. There would also probably be a maximum number of burns you could create from one burn (~10 or so).

I'll have more details when I get) home from work. Sound okay in the mean time?

All those restrictions are fine with me - as mentioned, I'd really only use it for transfer burns (starting from circular orbit), and more then about 5 burns would be way too annoying anyways :)

Link to comment
Share on other sites

All those restrictions are fine with me - as mentioned, I'd really only use it for transfer burns (starting from circular orbit), and more then about 5 burns would be way too annoying anyways :)

Sneak peak.

ddS5qKi.png

- - - Updated - - -

And update. I've got a very prelim version of the split delta-v maneuver functionality working. It may have some bugs, but I figured you guys might want to play with it before I head to bed tonight (and report any issues you find!).

Some notes:

1) It only works with impulsive maneuvers. You can't split finite duration maneuvers (nor auto-circularization burns, for that matter).

2) You might provide the number of new burns to get out, and that must be between 2-10.

3) Your orbit must remain eccentric (ecc < 1.0) up until (but NOT including) the state after the final burn. If this does not occur, you'll get an error message and nothing will happen.

4) This is easily the most challenging GUI I've ever built, on account of the fact that I have to build each of the components from scratch and there can be a variable number of components in the dialog. If you find issues, please report them.

5) Right click the script list box and select "Split Impulsive Maneuver" to use the functionality.

And without further adieu, the link:

KSP TOT v1.2.0 pre-release 3

Please report any issues you find.


Gaiiden, this build doesn't address your issue. I'll have that fixed tomorrow night. Didn't even get a chance to look tonight between all of this split maneuver work... :)

Link to comment
Share on other sites

Gaiiden, this build doesn't address your issue. I'll have that fixed tomorrow night. Didn't even get a chance to look tonight between all of this split maneuver work... :)

No worries or rush, it's an issue that has an easy work around. I don't have a use for the split burn yet but that looks really cool, good stuff.

Also, is there a way to let us tell the Graphical Analysis tool to do stuff like draw a line on the x/y-axis for a certain parameter? So if I tell it to give me a graph of the spacecraft's altitude over time and I'm looking for any values under 60km. A line at 60km would be nice. Or if I'm trying to see what altitude the ship will be at x seconds, a line at that time would help - mainly because the data pointer would snap to it (you can see this behavior now if you check Pe/Ap options)

I'd also like to know where everyone else stands on the use of Mission Elapsed Time as the default Independent Variable for the Graphical Analysis tool. I find myself using just regular Time far, far more often. 98% of the time I would say. What would be some example use cases for Longitude and True Anomaly? Haven't used those at all but I may have had reason just not thought to do so.

Edited by Gaiiden
Link to comment
Share on other sites

KSP TOT v1.2.0 pre-release 4

This pre-release does two things beyond pre-release 3:

1) It resolves Gaiiden's "can't upload circularization burns" problem; and

2) It allows you to enter the exact delta-v you want for each burn within the Split Impulsive Maneuver box. I changed the read only "labels" that showed delta-v per burn into text boxes that you can enter numbers into.

Let me know what you think! :)

- - - Updated - - -

Also, is there a way to let us tell the Graphical Analysis tool to do stuff like draw a line on the x/y-axis for a certain parameter? So if I tell it to give me a graph of the spacecraft's altitude over time and I'm looking for any values under 60km. A line at 60km would be nice. Or if I'm trying to see what altitude the ship will be at x seconds, a line at that time would help - mainly because the data pointer would snap to it (you can see this behavior now if you check Pe/Ap options)

There isn't, but if you can describe how you might see it implemented, I could think about trying to get it in there, maybe. I can't add any widgets to the plot window itself, though, as that's a MATLAB figure window. The positions of the lines would have to be specified ahead of time, I think.

I'd also like to know where everyone else stands on the use of Mission Elapsed Time as the default Independent Variable for the Graphical Analysis tool. I find myself using just regular Time far, far more often. 98% of the time I would say. What would be some example use cases for Longitude and True Anomaly? Haven't used those at all but I may have had reason just not thought to do so.

Longitude is great if you're in my "real life" engineering job where I have to plan missions for geostationary spacecraft that puts the final state of the vehicle at a certain longitude. Since we don't really do too much stuff like that in KSP, I include it here mostly for completeness. Same for true anomaly: I have the other Keplierian parameters, may as well include it as well...

Link to comment
Share on other sites

There isn't, but if you can describe how you might see it implemented, I could think about trying to get it in there, maybe. I can't add any widgets to the plot window itself, though, as that's a MATLAB figure window. The positions of the lines would have to be specified ahead of time, I think.

Sorry, I meant is there a way for you to make this happen, I already knew it wasn't possible with the current program :P And you're correct, I was imagining that these would be parameters you enter in through the Graphical Analysis tool window prior to plotting the chart. I think for now it just needs to be something simple. Within the "Plotting" section of the GA tool, have two text boxes. One will be for the Y-axis and one for the X-axis. If the boxes are filled when the plots are generated, a line will be drawn at those values - if they exist. Again it would be just like how Maneuvers, SOI Transitions, Periapsis and Apoapsis Crossings appear when they are selected.

On a related note, have you looked into whether it's possible to pass a value into the Legend box? If you plot multiple lines onto the figure, clicking the Legend icon will show all the lines and their colors, but they will all read "data1". Given that these kinds of plots are generally only useful when you are comparing data amongst multiple bodies/craft/stations, depending on what Dependent Variable is chosen to plot you would know which "Reference" dropdown box to take the value from to assign to the plot line. If a Dependent Variable is selected only relating to the current vessel, then the vessel name can be passed along. (the vessel name can come from a craft data import through SFS/KSP but currently I don't think MA cares about this since I don't see a way to set it otherwise).

Longitude is great if you're in my "real life" engineering job where I have to plan missions for geostationary spacecraft that puts the final state of the vehicle at a certain longitude. Since we don't really do too much stuff like that in KSP, I include it here mostly for completeness. Same for true anomaly: I have the other Keplierian parameters, may as well include it as well...

Cool, good to know!

Edited by Gaiiden
Link to comment
Share on other sites

Sorry, I meant is there a way for you to make this happen, I already knew it wasn't possible with the current program :P And you're correct, I was imagining that these would be parameters you enter in through the Graphical Analysis tool window prior to plotting the chart. I think for now it just needs to be something simple. Within the "Plotting" section of the GA tool, have two text boxes. One will be for the Y-axis and one for the X-axis. If the boxes are filled when the plots are generated, a line will be drawn at those values - if they exist. Again it would be just like how Maneuvers, SOI Transitions, Periapsis and Apoapsis Crossings appear when they are selected.

It certainly could happen. Would being able to set only one "x equals" line and one "y equals" line be sufficient?

On a related note, have you looked into whether it's possible to pass a value into the Legend box? If you plot multiple lines onto the figure, clicking the Legend icon will show all the lines and their colors, but they will all read "data1". Given that these kinds of plots are generally only useful when you are comparing data amongst multiple bodies/craft/stations, depending on what Dependent Variable is chosen to plot you would know which "Reference" dropdown box to take the value from to assign to the plot line. If a Dependent Variable is selected only relating to the current vessel, then the vessel name can be passed along. (the vessel name can come from a craft data import through SFS/KSP but currently I don't think MA cares about this since I don't see a way to set it otherwise).

Right, so KSP TOT doesn't do anything with vessel names at the moment. They're neither stored nor collected anywhere. If you want to change the string in the legend entry, though, just double click on the text. I just tried it here and it lets you change it on the fly.

Link to comment
Share on other sites

KSP TOT v1.2.0 pre-release 4

Longitude is great if you're in my "real life" engineering job where I have to plan missions for geostationary spacecraft that puts the final state of the vehicle at a certain longitude. Since we don't really do too much stuff like that in KSP, I include it here mostly for completeness. Same for true anomaly: I have the other Keplierian parameters, may as well include it as well...

No no! I use longitude every time I set up relay satellite networks with Remote Tech and Interstellar Mod, for exactly the reason you describe. It's brilliant!

Link to comment
Share on other sites

No no! I use longitude every time I set up relay satellite networks with Remote Tech and Interstellar Mod, for exactly the reason you describe. It's brilliant!

Awesome. Sounds like you're ready to fly real geostationary communications spacecraft. ;)


Hey, good news everyone! Remember when I added support for finite duration maneuvers the other day? Well I got to thinking that it'd be real neat if I could add "finite duration" aerobraking tonight, too. And since the finite maneuvers proved more than feasible from a CPU time perspective, I figured this would work out okay, too. And guess what, I was right!

I've got all of the math implemented and it compares well to the Trajectories mod you can download on KerbalStuff. I planned an aerobraking maneuver tonight in Mission Architect and my post-maneuver apogee was only off by 5 km (as compared to Trajectories and from an initial Ra of a few thousand kilometers, so I'd say not bad).

I've still got some work to do on the atmospheric model (things get real weird if you don't actually make it out of the atmosphere), but it looks promising.

Cool, huh? :)

EDIT: And by adjusting the error control parameters on my numeric integrator, I actually got the relative difference between MA and Trajectories down to less than 2 km in apogee altitude. Nice!

Edited by Arrowstar
Link to comment
Share on other sites

It certainly could happen. Would being able to set only one "x equals" line and one "y equals" line be sufficient?

Like I said one per axis would be simple. I certainly wouldn't mind having the ability to plot out more than one per axis but the UI for that would be a bit more involved. Not sure how I would suggest you allow for multiple inputs. But if you want to go for it I won't complain ;)

Right, so KSP TOT doesn't do anything with vessel names at the moment. They're neither stored nor collected anywhere. If you want to change the string in the legend entry, though, just double click on the text. I just tried it here and it lets you change it on the fly.

Everything I asked for is moot now that I can just change it myself. Learn something new everyday! Although it did take me a while to realize you have to un-select the data tip tool in order to for the dbl-click to work. And right-clicking lets you change stuff too.

I've got all of the math implemented and it compares well to the Trajectories mod you can download on KerbalStuff. I planned an aerobraking maneuver tonight in Mission Architect and my post-maneuver apogee was only off by 5 km (as compared to Trajectories and from an initial Ra of a few thousand kilometers, so I'd say not bad).

Well, when my kerbals are ready to return from Mun I can definitely test this!

BTW the Mun mission plan I've been showing off recently? There's a Mission Animator video of it dropping early next month. Can't wait to show that off.

Edited by Gaiiden
Link to comment
Share on other sites

Like I said one per axis would be simple. I certainly wouldn't mind having the ability to plot out more than one per axis but the UI for that would be a bit more involved. Not sure how I would suggest you allow for multiple inputs. But if you want to go for it I won't complain ;)

Okay, I'll see what I can do tonight. :)

Well, when my kerbals are ready to return from Mun I can definitely test this!

Awesome. I look forward to it. :) What's the timeline on that, btw?

BTW the Mun mission plan I've been showing off recently? There's a Mission Animator video of it dropping early next month. Can't wait to show that off.

Yay! Please do point me to it when you upload it (post a link here or something). I look forward to seeing it. :)

Link to comment
Share on other sites

loads good, thanks!

Bug report: you fixed the Circularize DV Maneuver so I was able to upload it but there's a conversion error - if the required delta-v is 0.833m/s then the game will import a maneuver of 833m/s

Edited by Gaiiden
Link to comment
Share on other sites

KSP TOT v1.2.0 pre-release 6

Two changes in this update:

1) Fixed Gaiiden's issue with the circularization delta-v upload being completely wrong (had an extra factor of 1000 in there, whoops).

2) Added an initial version of Gaiiden's "draw lines at points" function. See Graphical Analysis, "marker lines" button.

Link to comment
Share on other sites

awesome. Will let you know if the line tool actually comes in handy and is worth putting any more thought into

- - - Updated - - -

Since I suspect you're the only use case for this, I think we'll leave it for now and others can chime in if they think if might be useful. :)

May I propose a compromise for now? If a state is loaded after another state, MA assumes a coast event between the two unless actual events are inserted between them. That would cut down the workload of stringing states together since I wouldn't have to manually insert UT coasts. Unless there's a reason that already isn't a thing?

Link to comment
Share on other sites

May I propose a compromise for now? If a state is loaded after another state, MA assumes a coast event between the two unless actual events are inserted between them. That would cut down the workload of stringing states together since I wouldn't have to manually insert UT coasts. Unless there's a reason that already isn't a thing?

Ah, I think I may have misunderstood then. What you've got there is actually impossible with MA. The fundamental principle behind the propagation engine is that states are connected by well defined events. You can't "assume" a coast between states, there must be a defined coast. But: what are the parameters of the coast? What if there's more than one possible coast between states (How do you choose?)? What if there are no possible coasts between states?

Anyway, don't think that will work, sorry. :-)

Link to comment
Share on other sites

Hi Arrowstar, I have a question / request. Is there any chance we could get Linux build?

Sorry, I can only build KSPTOT executables for the platform I own (win64). If someone who owns MATLAB on Linux would like to try building it for Linux, they're welcome to contact me to set up the process.

Link to comment
Share on other sites

yea I'm bringing this up again - Longitude is just a few degrees off, latitude is still about spot-on though. What I did to ensure a proper MA to KSP comparison was set the ship on rails at x5 time warp, then I imported the orbit and stayed on rails until 4 seconds prior to the time shown so I could nab the screenshot

eSpplwy.png

Link to comment
Share on other sites

Fair warning, I've been editing this post all day...

well if I had an idea I wouldn't be holding it back :P Hopefully you're saying you have an idea but want me to figure it out for myself - in which case sorry to disappoint because I haven't a clue :) I tried to import and screencap at the same time but I wasn't sure at what exact point MA imports the orbital data. So I just took a screenshot a few seconds after the KSPTOTConnect craft list popped up, which gave me data for MA a few seconds before the screenshot. Here are the results from 2 different craft, using SCANsat as well for a second in-game readout (KER and VOID use the same back-end code, SCANsat has different developers behind it):

Emob84a.png

Then I had the bright idea to use Hyperedit and sent the craft in the second screenshot up to keostationary orbit. The game tells me I'm stationed at 92° W and importing the orbit to MA gives me 270° E, which should be 90° W correct? Interesting how that's still 2° off the game but in the other direction 0_o Note that the use of Hyperedit could have messed with the results as well in this case, I don't know but I'd get a second opinion from someone who actually flew a craft up to KSO.

also, note that sometimes (I don't know why, and it's rare) KSP will use a normalized value for its LAN property (I've actually seen it in the SFS file), and KSPTOT isn't able to handle that when importing an orbit.

additionally can you try opening this file and seeing what happens? My VRAM shoots up to 14GB and wants to lock up my computer. The last time I had this open I was simulating Meeny's orbit a hundred days ahead looking for an alignment with Mun.

Aaaannnndddd I used the Launch Window Analysis tool to get started on a new Minmus mission plan:

jFbyCKI.png

First off, I'm surprised we have to define the launch site information - wouldn't it just be better to use the Ground Targets list? Or at least have another drop-down above the planet selection that lets us optionally use a ground target we've pre-defined (like a landing site we're now taking off from). Note the tooltip that appears reads the same for every text box.

I'm unclear as to whether it's a bug that I'm getting such small UT values, or if these are delta-UT values from my Window Search Start. I'm guessing it's the latter, but it would be better to just be straight-up UT values I can just paste directly into the UT fields of the main KSPTOT window to see what the times are. It's not like I'm going to be doing any delta-UT coast event in MA using these values since these are for launch not orbit wait no, these values are too big to be delta-UT. So I guess there's a bug.

New topic: is it possible to make the Edit State windows non-modal? If I use the RMS to get burn time and DV numbers, I have to copy them out to an external notepad so I can copy them back into MA when I have the Edit State window open (modal windows lock out the rest of the application from use)

Edited by Gaiiden
Link to comment
Share on other sites

I'm still looking into the longitude issue. In the mean time, I've got the tooltips and launch window UT issue resolved. See if you can spot what was causing the latter:

windowSearchStartUT = deg2rad(str2double(get(handles.windowStartUTText,'String')));

I'll get a ground site dropdown box for you today as well. Should be easy.

I figured out what was going on with the Minmus case you sent me... kinda. I'm not sure why, but basically it looks like the spacecraft was started inside Minmus (the body itself) but with the starting SoI set as Kerbin. This produced some wierdness that ultimately made MATLAB try to form an array a few hundred billion rows long. I've added a check to prevent that from happening in the future (max number of states per propagation limited to 10000, normally it doesn't exceed 1000).

And no, I'd prefer to keep the edit event dialogs model. I know it's a pain, but if the mission script gets out of sync with the dialog box, serious problems can ensue. Better safe than sorry. :)

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