magico13

[1.4] StageRecovery - Recover Funds+ from Dropped Stages - v1.8.0 (March 11, 2018)

Recommended Posts

There are likely two things at play here. The first is that since the periapsis was above ~22km the debris wasn't destroyed by the atmosphere (it will remain in orbit and won't ever aerobrake unless you switch to it in the tracking station). Therefore SR won't activate, since it wasn't destroyed. Secondly, even if it was destroyed there is a possibility it wouldn't get recovered by this as StageRecovery only recovers things that are "Flying" or "Sub-Orbital" but not things that are "Orbiting". I don't know precisely what the cutoff is, but I believe the periapsis can be no higher than 18 km to be considered Sub-Orbital.

If you aim to drop the stage with a periapsis of 18km or lower, it should be recovered just fine. You can check the status of debris by opening the map and clicking the debris icon at the top. Doing that lets you see the orbits and icons for debris.

Share this post


Link to post
Share on other sites

New version up! (Hopefully with less bugs off the bat than last time) This version required an almost total rewrite, or at least reorganization. There are two primary features and a bug fix.

1st Feature: The Flight GUI. This window, accessible by clicking the StageRecovery icon on the toolbar (Blizzy's or stock) shows a detailed, but simple to use, GUI for viewing ALL Stages recovered or destroyed since the Flight Scene was started (aka, starting a flight or switching to a vessel from the tracking station). This GUI is far less annoying and intrusive than the messages popping up for every single stage (with all the information crammed into a tiny space) so you will likely want to disable those, but they are still available if you want them. When you leave the flight scene (go to VAB/SPH or Space Center or Tracking Station) the lists get reset. To close it, just click the button that you used to open it.

Using it is simple. Just click on either "Recovered" or "Destroyed", then the name of the Stage you want to view information about. Then you can easily view information about the Parts recovered, Crew, Science, or additional Info like distance from KSC or terminal velocity.

2nd Feature: Editor Helper. Clicking on the StageRecovery icon while in the editor will calculate the terminal velocity of the ENTIRE vessel (including fuel) with ALL of the parachutes deployed and display it in a stock message. Build a replica of the stage you want to drop, drain out the fuel with tweakables (unless you want to use the maximum mass), and click the button. If the message is red, no recovery, if it's blue then it at least partially recover. Click the message to see the terminal velocity and the percentage recovered.

Bug fix: I had a bug in calculating the terminal velocities of stages. I was missing a square root, which caused all the calculated velocities to be smaller than they really were. You likely will need more parachutes if you were only using this for determining a good mix of parachutes.

If you have questions, please feel free to ask! The next feature I plan on working on is Powered Recovery (aka, rockets and jets) using the code Malkuth donated to StageRecovery.

Share this post


Link to post
Share on other sites

"The file you requested has been blocked for a violation of our Terms of Service."

:(

Share this post


Link to post
Share on other sites
"The file you requested has been blocked for a violation of our Terms of Service."

:(

Are you sure that's not some unrelated ad on mediafire? I'm not seeing that message when I try to download it. Either way, I'll provide an alternative download through google drive.

On unrelated terms, does anyone have any comments/suggestions for the new features? Do you like the GUI in flight? Is the Editor Helper actually helpful?

Share this post


Link to post
Share on other sites

I'm positive that it wasn't an ad but was something mediafire was serving (it even redirected me to a separate error URL), it doesn't seem to be having the issue anymore though, so it must have just been a mediafire glitch.

Share this post


Link to post
Share on other sites

Just wanted to post a quick update to my earlier post regarding not getting a refund for stages dropped outside the atmosphere. It's funny, because since I first posted that message, I've been consistently getting refunds for stages dropped pre-orbit, no matter how high. So far the highest I've dropped a stage and gotten a refund was about 100k in altitude. [noparse]:)[/noparse]

Share this post


Link to post
Share on other sites

Since using the newer versions with toolbar support I've had problems in the VAB. The SR icon in there does nothing, I get NREs in the KSP.log and can't load, launch or exit after a while. I removed stagerecovery and the problems have disappeared in the VAB at least.

Share this post


Link to post
Share on other sites

Hmm, could you send me the output_log.txt file from the KSP_Data (or KSP_x64_Data if you use 64 bit) folder (after loading up the game and causing the issue)? The SR icon should cause a message to appear stating whether or not the current ship would be recovered. If you're using RealChute then I'm curious if that's related, as someone previously had issues with accidentally having two versions of RealChute installed. At the very least, if it's working elsewhere then just not using the Editor Helper should avoid the VAB problems, as a temporary solution.

Thanks in advance if you can get me the output_log. Is anyone else experiencing similar issues?

Share this post


Link to post
Share on other sites
-icons-

These are awesome! For a first post, I'd say that's a pretty awesome one ;) Thank you! I'll be using these for the next time I release a new version.

Share this post


Link to post
Share on other sites

I'm finding that with this mod, sometimes if I recover a flight after stages have already "landed", my save becomes corrupted. It may be an incompatibility with another mod, I run about 63 addons. When I say corrupted, I mean sometimes the ship will disappear, sometimes it will end up in null space, with no location. This last time, my entire Kerbal Space Center disappeared. If I have time, I'll try to figure out what it might be conflicting with.

Share this post


Link to post
Share on other sites

I just did a little bit of testing in a mostly stock game and wasn't able to cause any problems that sound like that. If you're able to get me the output_log.txt file form the KSP_Data or KSP_x64_Data (if using 64 bit) folder from a play session where it happens I might be able to help you track down the issue (and if it is indeed a problem with SR then I should be able to fix it).

Share this post


Link to post
Share on other sites
I just did a little bit of testing in a mostly stock game and wasn't able to cause any problems that sound like that. If you're able to get me the output_log.txt file form the KSP_Data or KSP_x64_Data (if using 64 bit) folder from a play session where it happens I might be able to help you track down the issue (and if it is indeed a problem with SR then I should be able to fix it).

If I get a chance, I'll reinstall the mod and see if I can catch the bug for you. It does seem to be related to the mod in some way, though. With it installed, I wasn't just having problems with an occasional corrupted save, but other times after a mission recovery I'd get weird behavior trying to switch into or out of the VAB, trying to launch from VAB, etc... Since I uninstalled it, no issues like that at all. I'm wondering if it might be related to when/how it writes to the persistent save file? I have no idea how the game handles data related to a flight that you revert out of. If no one else is having this issue, it's likely a mod conflict, I am running a ton of them. :)

Sorry for not jumping right back into troubleshooting this. Lost a lot of play time having to start a fresh save and I'm trying to get some relaxing/fun/productive play time in for a bit before going into troubleshooting mode again. (It took a lot of mod swapping to narrow the issue down to this one).

Share this post


Link to post
Share on other sites

screenshot498.jpg

When I say things starting acting weird when changing between the VAB and launch pad, this is an example of what I mean. Not long after the persistent save was corrupted. I had a lot of similar, though less severe issues, in previous days and with another save.

I'm running 32 bit OpenGL WIndows 8.1

Share this post


Link to post
Share on other sites

I've seen issues like that before when working on KCT. There's definitely a Null Reference Error happening somewhere, but without logs I have no idea where to look. StageRecovery doesn't directly touch the save file at all, so I'm really interested in figuring this out. If you can get me the logs I can probably help, without them though I can only speculate.

Share this post


Link to post
Share on other sites

I managed to corrupt two savegames with quite a list of addons and my hunch says it might happen during the recovery of stages. I believe your mod might delete the stages debris while the game tries to save or something like that. Interestingly enough one savegame uncorrupted itself after waiting a few seconds. I launched a spaceplane which was obliterated with pieces flying around and at that point I reverted. This seems to have caused quite a few problems including that I couldn't leave menus and I couldn't select any of the crafts in the tracking station. When loading the game and timewarp x5, I got new messages for me including that a delta winglet has been recovered and suddenly all the issues are gone.

Anyway, since you suggested that log files would be helpful to find possible NullReferences and such:

http://pastebin.com/nv3zsk59

http://pastebin.com/nmD74Jpt

http://pastebin.com/6AN9a1MD

http://pastebin.com/xczPw6KG

http://pastebin.com/tq4csFNX

http://pastebin.com/8k4m066R

These links are the same output_log.txt. They are 6 links as pastebin limits files to 500kB. If you like I can upload the still corrupted game and other files to mediafire or some other provider.

Hope this helps!

Share this post


Link to post
Share on other sites

Unfortunately your particular problem looks to be with Haystack Continued, which the developer is aware of and is planning an update for, per this post: http://forum.kerbalspaceprogram.com/threads/89920-0-24-2-2014-08-11-Haystack-Continued-%28v0-3-1-0%29?p=1357712&viewfull=1#post1357712 I say unfortunately since it doesn't specifically help me, but thank you very much for posting it anyway! Logs that may not directly help me are still better than no logs at all, because then I know what the problem is and can do more than just say "Sorry, can't help you."

FYI, I don't do anything to the stages themselves. I get access to them when the game deletes them, but I don't change anything on them because other mods also get access to them at the same time (when listening to the OnVesselDestroy event). The next update will change things in the stage though, since powered recovery requires using fuel. Just informing you, in case you were curious.

I have an idea of what may be a related issue that someone reported in the KCT thread and should be fixed in the next version. I'll hopefully have a new version out later today which will include a preliminary version of powered recovery and that fix (along with a couple other fixes).

Currently powered recovery takes all the fuel, instead of just what it needs, because that's what Malkuth's code originally did and calculating how much fuel you need to burn with an arbitrary number of propellants isn't a simple task (Pretty sure it involves a series and I need to solve for every element. I'll likely do explicit calculations for special cases of 1 (planes), 2(stock rockets), or 3(nothing stock that I know of) propellants, and anything higher will just take all the applicable fuels). Or I can solve it with a simulation, "burning" a small number of each propellant at the correct ratio until I hit the mass required, but that would be more computationally heavy.

Edited by magico13

Share this post


Link to post
Share on other sites

Hmm, I don't know.

When I looked through the log myself, I removed Haystack Continued. Now without it I managed to get the same screen now as Fiontar had as life wants it. According to the messages I got, I have recovered the launching stage twice. I was switching around my probes and ships, so perhaps that's related.

I do have some NullReferenceExceptions belonging to stage recovery like this one below. I had them in the other log too, so I am not sure if you've seen that and considered fixed already or not. But I am sure it can't hurt to post them.

This is about the exact time my save just now corrupted:


NullReferenceException: Object reference not set to an instance of an object
at StageRecovery.RecoveryItem.DetermineTerminalVelocity () [0x00000] in <filename unknown>:0
at StageRecovery.RecoveryItem..ctor (.Vessel stage) [0x00000] in <filename unknown>:0
at StageRecovery.StageRecovery.VesselDestroyEvent (.Vessel v) [0x00000] in <filename unknown>:0
at EventData`1[Vessel].Fire (.Vessel data) [0x00000] in <filename unknown>:0
at Vessel.OnDestroy () [0x00000] in <filename unknown>:0

This exception shows up in some variations with the StageRecovery.StageRecovery.Awake method in the middle of such a block:


NullReferenceException: Object reference not set to an instance of an object
at RenderingManager.AddToPostDrawQueue (Int32 queueSpot, .Callback drawFunction) [0x00000] in <filename unknown>:0
at StageRecovery.StageRecovery.Awake () [0x00000] in <filename unknown>:0
UnityEngine.GameObject:Internal_AddComponentWithType(Type)
UnityEngine.GameObject:AddComponent(Type)
AddonLoader:StartAddon(LoadedAssembly, Type, KSPAddon, Startup)
AddonLoader:StartAddons(Startup)
AddonLoader:OnLevelWasLoaded(Int32)

If things are already fixed then the better. And thank you for your efforts. :)

Share this post


Link to post
Share on other sites

Oh, you're right I didn't see that! I'll take a look again. I was on my tablet before, so it's not always easy to debug on there (yay, 10 inch screens) but now that I'm on my desktop I'll take a look again. I also realized that the fix I was talking about before is a fix for something I haven't changed yet, meaning it won't really help the existing bugs. I'll let you know what I find, if anything.

Edit: My guess is that because you're using stock parachutes, it's an issue with trying to reference the ModuleParachute without the module being loaded. I should be able to get around that by looking at the ConfigNode instead of the loaded module. Hopefully that's all the issue is. If so, it'll be fixed later today. That problem doesn't manifest with RealChute because of how I have to deal with that module.

Edit2: Hmm, harder than I thought since the ConfigNode doesn't seem to store the fullyDeployedDrag (for some unknown reason). I'm going to have to just assume that the parachute has 500 drag if the PartModule is null. Luckily that only occurs in rare cases.

Edited by magico13

Share this post


Link to post
Share on other sites

This mod is SPECTACULAR! It works in SANDBOX and therefore, IMHO, it is a bit better than debrefund PLUS it is designed to work with constructiontime (another mod that is SPECTACULAR!) Keep up the awesome work!

Share this post


Link to post
Share on other sites

New update, 1.4.0.0. This update should fix several bugs (specifically with an error calculating terminal velocity in flight, and hopefully the issues Vult was having). In addition, it adds Powered Recovery thanks to Malkuth from Mission Controller Extended! I've added a section discussing how Powered Recovery works on the first post, so you should check that out.

Be warned that it is still in development, so if you encounter any serious bugs, try disabling powered recovery from the settings menu. It might make your problems disappear. Also, I've left a decent amount of debugging code in, I'll remove that next version but I'd like to see it if people have issues. With that said, if you encounter any bugs, please include the output_log.txt file with your bug report and I'll gladly take a look!

Basics of powered recovery:

Must have control of the stage (aka, a probe core or Kerballed command pod, but a probe core is better)

Only activated engines are used.

Atmospheric delta-v greater than or equal to 2.5 times the terminal velocity (after parachutes, so parachutes can reduce this considerably)

Thrust to Weight ratio of at least 1 (even with parachutes)

Additionally, it is designed around stock engines. If using mod engines with strange fuels or other weird requirements, it may not work as intended. Feel free to try, but no guarantees it will work properly. You can check how much fuel was consumed in the Info tab of the in-flight GUI.

Also, the editor GUI now displays info for the current fuel values and for empty fuel values (if those are different). No more emptying out the stages needed to see if they will be recovered.

Share this post


Link to post
Share on other sites

Yeah, stagerecovery 1.4 seems to be causing ksp to crash on startup. If I replace the icons with the ones from 1.3, everything starts just fine. This is for both x86 and x86_64 on Linux. The log shows nothing useful at all, it just loads StageRecovery/icon.png being loaded; the game then crashes, with no further logging.

Share this post


Link to post
Share on other sites

Hmm, must be a linux specific bug since it's fine on Windows (at least on my end). Can you open the icons with a normal image viewer? They were made by Nezerroth, not me, so I don't know exactly how they were made. Can you open them in GIMP and try exporting them as PNGs again? Maybe it's related to an alpha channel or something like that, so save it with the bare minimum of settings. So weird that it's an icon issue, but I'll take that over other game breaking issues.

If you've still got issues after that, send me the log and I'll see if I can see something in it.

Share this post


Link to post
Share on other sites

If I open the PNG files in question from the command line with feh (a lightweight viewer and minor editor) and re-save them, ksp to loads properly (the icons also display properly in-game). If I open the original PNGs from the command line with feh, libpng throws a warning about a "known incorrect srgb profile", whatever that means. The PNGs created from feh do not have this warning and are also are around 1/3rd the size, for whatever reason.

Share this post


Link to post
Share on other sites

I was unable to duplicate the problem under MacOS X 10.9.4. The png images opened without any reported errors in preview.

skips

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.