Jump to content

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


Recommended Posts

Got it, thanks for bringing it to my attention. I'll investigate.

Are you both using stock KSP + KSPTOTConnect only? Does it only happen after creating a maneuver node?

In the test install I use and still had one of those "broken" vessels after uploading a maneuver for with KSPTOT Connect, I also have MechJeb 2.2.1 (build 255) (needed to compare data for the maneuver) and few mods I don't think have any relationship to the issue (Toolbar, ModuleManager, Ferram_Aerospace_Research, Action_Groups_Extended, RCS_BuildAid).

Yes, happens only for vessels that had a maneuver created by uploading it from KSPTOT. And they seem fine after creating the node, game shows no problem with them. When you reload the game, that vessel is "broken".

Note, also, I had that with vessels keeping the maneuver node stored: I had not actually made the required burn.

Have a suspect the issue is due to something very small and almost unnoticeable, that KSP is unable to detect at runtime but does while loading. Maybe sometimes a type mismatch occurs with the "Maneuver" block of data, though why that could bring to breaking vessels is unknown.

Link to comment
Share on other sites

First of all, thank you for this excellent tool.

One noobish question: is there a way to set a minimum fly-by distance in the multi-flyby maneuver sequencer? I'm trying to create something like the TMK-MAVR mission in RSS, but as I'm playing career mode, it would be swell if I could get "in space near" for both planets.

Link to comment
Share on other sites

OK, decided to do testing more seriously on this KSPTOT Connect issue. And I found something weird.

Clean KSP 0.23.5, install, with KSPTOTConnect, Toolbar, plus VOID and PreciseNode to evaluate maneuvers (those mods don't add anything to savegames).

I made a very simple scenario, just one vessel in orbit. Made a manual node just to have a reference save with a maneuver in it; then used KSPTOTConnect with the vessel, and saved. Then compared saves. Please find saves here to compare.

The result is that, just with connecting to the vessel, its parts are scrambled. It has nothing to do with the uploaded maneuver, I had the "broken" ship (and the scrambled parts) without uploading any maneuver, just by connecting that vessel. In those saves, the first part in the vessel is @ line 692 (should be the root part). The quicksave has it correctly (a "probeStackSmall"), the save after connecting has a different part (one of those still visible with the broken vessel).

Before...

8PJO62I.png

and after...

2j9HkjO.png

EDIT: The scrambling of parts seems to happen for the vessel that is selected through the list that appears in the MCC "Select Vessel" dialog, after that list is populated by selecting "Test Connect to Remote Host". It is possible to upload a maneuver without trouble for a vessel, is that vessel is not selected through that list, and the orbital parameters required to compute burns are instead obtained from the "Compute Departure Burn" dialog (right-click on orbital params, select "Get Orbit from KSP" and then select the desired vessel from the list in the "Import Orbit from.." dialog.

Edited by diomedea
more info added
Link to comment
Share on other sites

So in retrospect, the issue with the parts going all wonky as shown in the above screenshots was actually pretty stupid on my part. :) Can anyone see the issue in my code that generates the list of part temperatures for the MCC code?

            
List<Part> parts = vessel.Parts;
parts.Sort(new PartSortByTempLimit());

The issue is that the "parts" List is not a new List, but instead a referenceto the same List that KSP uses to sort parts. So when I sorted it, I sorted the same list that's used to generate the SFS files, and that apparently screws things up in the save/load of those same SFS files.

Frankly, I think this is a bug with KSP, but I'm not going to worry to much about it for the time being. Good to know though anyway.

The fix is essentially done (and tested, I don't get the issue any more over here), but I don't have time to release tonight, so I'll get it out tomorrow. Hang time in the mean time. :) Thanks diomedea and Kobymaru for the reporting and investigation!


Oh, diomedea, I also removed asteroids from the list of selectable vessels in KSPTOT's MCC Vessel Select dialog. Hopefully that resolves the issue you reported. Please let me know if it doesn't. :)

Link to comment
Share on other sites

Unfortunately, the original part order is lost upon sorting as I did. The best I can recommend is to copy/paste the root part back to the top of the vessel's part tree in your persistent.sfs or quicksave.sfs file (root parts have the line parent == 0 in them I think). I haven't tried it myself, but that may actually resolve the problem. Please give that a try and let me know how it works.

Link to comment
Share on other sites

Is there a way to write a small tool that fixes up the original part order?
Unfortunately, the original part order is lost upon sorting as I did. The best I can recommend is to copy/paste the root part back to the top of the vessel's part tree in your persistent.sfs or quicksave.sfs file (root parts have the line parent == 0 in them I think). I haven't tried it myself, but that may actually resolve the problem. Please give that a try and let me know how it works.

Eh, I did try just switching back the root part to be first in the vessel definition. Works for that part, but not for the other parts missing. So, probably every single part has to be switched back to where it belongs.

So, it is needed to know where those parts actually were before the scramble. To help, the .craft file holds a lot of useful info about those parts, but parts there are in the order they are created in VAB, unfortunately a .craft is parsed when entering flight mode, each part to be ordered based on the stage it belongs. I know of no tool designed to reorder a vessel parts. With a simple enough vessel (certainly less than 50 parts), applying some simple rules with the info from the .craft file, should be possible to have the correct order back just by editing the savegame (warning: easily worse problems may arise from unproper editing). With the very simple vessel I used for those tests, I can see the correct order of parts is, starting from the root part, every part as it connects to the down node of the previous part; then (probably in no specific order), parts connected to the top node (again starting from the root part) and radially attached parts. If more than one stage is present, parts with following stages will go afterwards (direct stage order).

Kobymaru, hope the above helps in case you want to try manual editing. I am not a specialist with KSP savegames, but generally know my way with most of the information included; if you want, I may try to have a look at your savegame and (also with a .craft file of the vessel and a list of mods used) possibly try to reorder it for you.

Link to comment
Share on other sites

Thanks diomedea for your thoughts :)

I think since I can recover half the ship in another way, I will just launch it again. No biggie, and definitely less hassle then going throug .craft/.sfs files.

Link to comment
Share on other sites

I am having the problem with then mclFreeStackTrace as well. I am running windows 8.1 and deleting the folder then reextracting the zip does fix the problem for a single run. After that, I go back to the mcl error. I also am enjoying the plugin, though I am still trying to master using it. I really want to plan some multi-planet flybys with a probe, but It is not going to happen with the current problem.

Link to comment
Share on other sites

Hi everyone,

I'm pleased to announce the release of KSP TOT v1.1.5. This is a bugfix release that corrects the following issues:

  • Vessels no longer have parts disappear upon loading a save when using the KSP TOT MCC suite.
  • Asteroids are no longer selectable from the MCC Vessel Selection dialog box.

Please see the first post in this thread for the download link. I highly recommend that everyone update, as the first issue corrected by this fix is a major one.


Thanks diomedea for your thoughts :)

I think since I can recover half the ship in another way, I will just launch it again. No biggie, and definitely less hassle then going throug .craft/.sfs files.

Okay, sounds good. Sorry about destroying your ship! :)

I am having the problem with then mclFreeStackTrace as well. I am running windows 8.1 and deleting the folder then reextracting the zip does fix the problem for a single run. After that, I go back to the mcl error. I also am enjoying the plugin, though I am still trying to master using it. I really want to plan some multi-planet flybys with a probe, but It is not going to happen with the current problem.

Out of curiosity, where are you unzipping the KSPTOT ZIP file to? Have you tried restarting after installing the MCR? Have you tried unzipping the KSPTOT ZIP file to somewhere that you definitely have write privs, such as a folder on the desktop?

I'm glad you like using KSP TOT! Hopefully we can get these issues resolved quickly. :)

Link to comment
Share on other sites

I'm pleased to announce the release of KSP TOT v1.1.5. This is a bugfix release that corrects the following issues:

  • Vessels no longer have parts disappear upon loading a save when using the KSP TOT MCC suite.
  • Asteroids are no longer selectable from the MCC Vessel Selection dialog box.

...

Can confirm both fixes work on my end. Good job :D!

Just a minor note, now that asteroids can't be selected anymore, I find with the MCC RTS "Select Vessel" dialog this "Warning: Selecting asteroids may cause issues when using the RTS". Certainly a temporary solution, but now no more required.

In the hope that all major bugs are now sorted so you may have time and will to go about minor things again, I'd like to bring attention back on those two I mentioned few days ago (sorry for the self-reference :blush:), possibly lost in the clamor:

1) Again using orbital data in MCC from one ship while flying another in KSP. Orbital data is retrieved fine, but then when I want to upload the maneuver found by KSPTOT back to KSP, it is uploaded with the vessel being flown, not the one the data retrieved was about (of course I notice there is no way to select a specific vessel while uploading a maneuver to KSP, so probably this is just another thing to warn the users about, and nothing more).

2) A word from you about how to set-up the upload maneuver correctly may be a blessing. The "Upload Maneuver to KSP" window has the option to select the Time Type (UT or Time past Periapsis). It defaults to UT. I found the uploaded maneuvers being wildly wrong in KSP if that option is "UT", but closer if "Time past Periapsis" (afterwards, noticed the DV Maneuver Information panel in the Departure Burn window actually uses "Time past Periapsis"). Still, the uploaded maneuver in KSP is not exactly right (KSP does not show a rendezvous), so I may be missing something else.

Link to comment
Share on other sites

Hey guys, I have a question: how can I plan a mission to an asteroid (that's going to cross Kerbin SOI) using KSPTOT? Thanks!!!

Excellent question! KSPTOT computes trajectories with planetary bodies in its "bodies.ini" file, and of course it includes by default the standard planets and moons in KSP (with an option now to make a new file from what bodies are defined in KSP at runtime). Asteroids are not among those bodies, so to compute trajectories with them, their orbital parameters must be inserted (by hand) in the bodies.ini file.

Orbital parameters for any "vessel" (including asteroids) are found in all savegames, within the "ORBIT { ...}" section; the parameters shown are:

SMA (semi-Major Axis of the orbit), in meters

ECC (Eccentricity of the orbit)

INC (Inclination of the orbit), in degrees

LPE (Longitude of Periapsis), in degrees

LAN (Longitude of Ascending Node), in degrees

MNA (Mean Anomaly), in degrees

EPH (Epoch), Time in seconds (UT) when the above parameters were given (Mean Anomaly changes with time)

REF (Reference Body) is the numerical identifier of the parent body the asteroid is orbiting (0 = Sun; 1 = Kerbin...).

With the bodies.ini used by KSPTOT, some changes are required to fit those parameters.

First, create a new section (or copy another one) within bodies.ini, and change the name of the body to fit our asteroid (e.g. "[Ast_XXX]", beware KSPTOT does not accept spaces); then modify the following lines with the parameters from the savegame:

EPH must be copied to "epoch = "

SMA must be converted in Km and then copied to "sma = "

ECC must be copied to "ecc = "

INC must bo copied to "inc = "

LAN must be copied to "raan = " (Right Ascension of the Ascending Node, is the same as the LAN when referenced to a geocentric orbit)

LAN must be subtracted from LPE, the result (always within 360°) be copied in "arg = " (Argument of Periapsis)

MNA must be copied to "mean = "

REF must be copied to "parentID = "

Also, the name of the parent body (initially, Sun), must be copied in "parent = "

the name of the asteroid to be copied with "name = "

and a new ID to be created, unique for the planetary system, and copied in "id = " (note: currently Eeloo is the standard body with the highest ID = 16, so any asteroid must have ID > 16)

Following fields in bodies.ini are not really relevant with asteroids:

"gm = " is the gravitational parameter (practically = 0 for asteroids);

"radius = " the radius in Km of the body (any suitable value here, as the size of the asteroid is not defined initially in KSP)

"atmoHgt = " the atmospheric Height, = 0 for asteroids

"rotperiod = " the rotation period in seconds, any big value here (initially undefined in KSP)

"rotini = " the initial rotation angle has no purpose: = 0

"bodycolor = " is used to draw the body and orbit in KSPTOT, "= gray" is generally a good choice

"canBeCentral" to be = 0

"canBeArriveDepart" to be = 1

Hope to not have put anything wrong...

Link to comment
Share on other sites

...so to compute trajectories with them, their orbital parameters must be inserted (by hand) in the bodies.ini file.

Given that this can be generated now by KSPTOT for alternate planetary systems, maybe an option to include asteroids could be included in a later version

Link to comment
Share on other sites

Now, KSP is able to compute the new orbital parameters, but I am not and have no knowledge of a tool that provides orbital elements for a different SoI than the one the vessel is in at the moment.

Hey, the Mission Architect does!

I could put the asteroid orbit into the MA and let it compute everything, and use the RV tool to calculate the RV opportunities for each orbit.

EDIT Diomedea, I've tried what you said about adding bodies, but angle values was quite messed. I solved importing orbital datas with the RV tool from the persistent, then copied exactly what was shown into the bodies.ini. It works...

Edited by PlonioFludrasco
Link to comment
Share on other sites

Can you make a version for Mac please? This tool looks very useful. I'd appreciate it if you did that for all the Mac users out there.

Also, I had an idea: You could work with the MechJeb devs to integrate this powerful tool into Mechjeb.

Edited by AppleDavidJeans
Link to comment
Share on other sites

Hey, the Mission Architect does!

I could put the asteroid orbit into the MA and let it compute everything, and use the RV tool to calculate the RV opportunities for each orbit.

EDIT Diomedea, I've tried what you said about adding bodies, but angle values was quite messed. I solved importing orbital datas with the RV tool from the persistent, then copied exactly what was shown into the bodies.ini. It works...

Yes, interesting. The state log with Mission Architect indeed provides orbital parameters for every part; it just requires to define a sufficiently long coast maneuver with the initial orbit and see where it brings.

About adding bodies, could you tell if adding to the bodies.ini with "arg = LPE" (LPE from persistent.sfs) works? I noticed those two values often match (though, argument and longitude of periapsis are different, so that may mean KSP abbreviation is uncorrect if the value used is actually the argument). Also, when importing data via KSPTOT Connect, you get updated mean anomaly and epoch, and those are certainly different from the ones shown in a savegame, however those just define a different position at a different time along the same orbit. So, I don't expect mean anomaly and epoch to be mistaken, and probably the error is really about the LPE.

EDIT: Found it (so I believe). KSP seems to be using values for MNA in radians, not in degrees. All other angular values are given in degrees, why this one is diifferent?

Anyway, convert that value from radians in degrees (multiply by 57.2957795) before inputting in bodies.ini as "mean = ".

Edited by diomedea
Link to comment
Share on other sites

EDIT: Found it (so I believe). KSP seems to be using values for MNA in radians, not in degrees. All other angular values are given in degrees, why this one is diifferent?

Anyway, convert that value from radians in degrees (multiply by 57.2957795) before inputting in bodies.ini as "mean = ".

Interesting. I will get a look on the new save, because old ones got corrupted and deleted :(

Link to comment
Share on other sites

When I try to get an orbit from KSP, it seems to hang on Retrieving Data from KSPTOT Connect. I have KSPTOT connect installed, and I can connect fine with the MCC realtime system

Link to comment
Share on other sites

When I try to get an orbit from KSP, it seems to hang on Retrieving Data from KSPTOT Connect. I have KSPTOT connect installed, and I can connect fine with the MCC realtime system

If it takes a few seconds to get data from KSP, is the same behaviour I have; I consider that normal.

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