Jump to content

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


magico13

Recommended Posts

Did the second stage have any parachutes? It should have at least given a failed recovery notice (assuming you have those activated, they are on by default). You probably didn't check, but did it show up at all in the separate GUI that appears when you press the SR button? If it happens again, could you get me the log file (output_log.txt from the KSP_Data folder)? It might be an issue related to powered recovery. Do you have Deadly Reentry installed? It's possible that it "burned up" through SR's Deadly Reentry integration but didn't post a message.

Link to comment
Share on other sites

Did the second stage have any parachutes? It should have at least given a failed recovery notice (assuming you have those activated, they are on by default). You probably didn't check, but did it show up at all in the separate GUI that appears when you press the SR button? If it happens again, could you get me the log file (output_log.txt from the KSP_Data folder)? It might be an issue related to powered recovery. Do you have Deadly Reentry installed? It's possible that it "burned up" through SR's Deadly Reentry integration but didn't post a message.

Ok, let's answer one question at a time...

1. yes, the 2nd stage had parachutes;

2. no, it did not show any notice (but I was in the Tracking Station, does it matter?);

3. yes, I did not deactivate any notice (I'm still learning how to use this mod, so I chose not to);

4. yes, I did check the recover window, nothing about 2nd stage there...;

5. yes, I have DREC installed. BTW, how do I prevent a stage from "burning"?

Link to comment
Share on other sites

2. no, it did not show any notice (but I was in the Tracking Station, does it matter?);

4. yes, I did check the recover window, nothing about 2nd stage there...;

5. yes, I have DREC installed. BTW, how do I prevent a stage from "burning"?

Ok, I think I know what happened. There's a bug with powered recovery and scenes other than the flight scene that makes it so SR can't look at the engines and get their thrusts/ISP/etc and as a result causing a crash. I can get around the game crash, but it results in the loss of the craft. The stage must not have had enough parachutes to drop to a 100% recovery rate, so it tried to use engines, causing the bug.

Two solutions: make sure to watch controlled stages from the map mode and not the tracking station, or turn powered recovery off. I should make that fail more gracefully in the future. I just wish I could actually get access to the values I need outside of the flight scene :/

The recovery window resets every time you leave the flight scene, so in this case it wouldn't have showed up unfortunately.

The way DREC and this work together is weird to say the least. There's a 1% chance of a stage burning up for every 10m/s it's going faster than 2000m/s (2400m/s is therefore a 40% chance, 3000m/s is 100% chance). If you have a heatshield, the total chance gets reduced by the ratio of the remaining shielding to the total shielding (a new shield provides a -100% to the chance of burning). A full heatshield will protect you up to 3000m/s. After that there's a chance again (3500m/s: 150% chance normally, 50% with full shield, 100% with a half used shield). It isn't scientific or precise at all, but it prevents you from smashing things into the atmosphere at 5km/s and expecting them to survive, and it does pose a slight threat to stages dropped at near orbital velocities.

Link to comment
Share on other sites

Just a quick note to say I've also been having a lot of trouble with inaccurate distances for recovered stages. They're often coming up at ~500-600km distance from KSC when they should be reporting maybe 50-100km at most.

I wonder if you could do something similar to the Atmospheric Trajectories mod...it can determine the exact spot on the surface where the craft will impact. Once you know those coordinates you should be able to calculate the straight-line distance to KSC.

I was thinking the same thing. I don't know what the trajectory mod's license looks like, but maybe you could steal stuff from it for this purpose.

Link to comment
Share on other sites

Just a quick note to say I've also been having a lot of trouble with inaccurate distances for recovered stages. They're often coming up at ~500-600km distance from KSC when they should be reporting maybe 50-100km at most.

So when I was working on a new feature (automatic recovery of launch clamps as soon as they are unloaded) and was using completely Stock functions I was seeing this same behavior (for stationary, landed launch clamps on the launchpad). So I think it's a Stock bug with determining the location of an unloaded craft, but it apparently only sometimes happens.

I've been considering tying into the Trajectories API since I don't really like taking code from other places, but that would require Trajectories be installed as well for that enhanced functionality. Since the Trajectories license is MIT, I may borrow that implementation from them so as to not require a dependency for what should be considered normal functioning. However, since SR doesn't "kick in" until vessel destruction, the trajectory would have to be computed when decoupling or first unloading rather than at destruction (since that won't happen until below 22km).

The other thing I've been considering doing is something a la TTNeverUnload and have the option for stages that would be recovered automatically (or ones you manually flag to remain loaded) continue having physics applied. That way they can actually land, and if you're like me and use kOS you can have your craft land automatically back at KSC. Also, then the percentages will be accurate and only parts which have actually been destroyed won't be counted (and deadly reentry will work).

That would likely be disabled by default (lots of people probably don't want to have a bunch of parts loaded at once). The only problem I'm having is determining when parts are dropped. I've found functions for determining when things get decoupled, but not how to access those "new" vessels. Either that or I need to wait until they unload, then manually load them again and flag them to not unload again.

Link to comment
Share on other sites

I seem to be having some trouble with the mod. I tweaked the stats on the stock radial parachute in order to reduce part count (gave it the drag of approximately 10 regular radials) however the recovery mod seems to still treat it as if it were just a single standard-stat stock parachute when it computes the impact speed. What am I doing wrong?

Link to comment
Share on other sites

I seem to be having some trouble with the mod. I tweaked the stats on the stock radial parachute in order to reduce part count (gave it the drag of approximately 10 regular radials) however the recovery mod seems to still treat it as if it were just a single standard-stat stock parachute when it computes the impact speed. What am I doing wrong?

May I suggest the RealChute mod? It will let you adjust parachute stats on the fly in the editor so you can land at whatever speed you want with your cargo on any planet. It also works flawlessly with StageRecovery.

With that out of the way, let me address your particular problem. From what scene are you watching for their recovery (flight/map view, or the Tracking Station). If it's during flight then it should recognize the changes no problem. If it's the tracking station then StageRecovery assumes the stock stats because I lose access to a lot of information outside of the flight view (though I think I may have found a solution to that which I will be adding into the next version). Map mode and flight are the only "safe" views to use with modified parts for the time being.

If you are in map mode or flight and are still having problems, what does the editor helper say? Do you see what would be reasonable speeds for your modified part compared to stock parts? If the editor helper isn't detecting the changes then there's definitely something wrong happening.

Link to comment
Share on other sites

It's while in flight dumping booster stages during launch. Since I kind of have to keep flying my rocket I can't focus on the discarded stage all the way through their descent.

I already use realchute for most needs, I just tweaked the stock radial chute because I wanted an easily/quickly installed stage recovery part. I'll try a few launches with max-size realchute radials installed and see how that fairs.

Link to comment
Share on other sites

It's while in flight dumping booster stages during launch. Since I kind of have to keep flying my rocket I can't focus on the discarded stage all the way through their descent.

When I said "watching for their recovery" that doesn't necessarily mean actually watching the craft (though generally if people are having issues they'll watch it in map mode or the tracking station), watching includes just looking for the message to appear. If you focused on the stage then StageRecovery would never kick-in.

Is the modified part a separate part from the stock chutes, or just a modification to the stock part's config? Since RealChute includes ModuleManager configs to overwrite the stock parachutes I'm wondering if your config changes are just being overwritten. The editor helper would quickly make that clear with a properly weighted test part (I believe an empty solid booster, a command pod, and a single parachute is not enough to drop the velocity to within safe levels with stock parts, but with your modified part it should be). If the editor helper isn't reading the stats correctly then your configs are definitely being overwritten by RealChute.

Link to comment
Share on other sites

Probably. Just tried a few max size (manual setting) realchute radials and the increased drag stats seemed to work just fine (successfully returned an SLS engine and a pair of the largest 3.75m fuel tanks). I guess I'll just suck it up for the time being and setup realchutes for my stage recovery. Sorry to bother you. :)

Edited by Yaivenov
Link to comment
Share on other sites

Hello there,

Another avid fan of this mod here.

Lately, I'm trying to solve any issues before they make it unplayable for me.

I'm hunting down any NREs I get and reporting them to the mod creators in hoping get the issue solved.

I'll be posting in a couple of other threads as well.

This is what I came across when I was looking through the log:

[EXC 23:50:12.918] NullReferenceException: Object reference not set to an instance of an object
StageRecovery.RecoveryItem+<>c__DisplayClasse.<TryPoweredRecovery>b__8 (.ProtoPartModuleSnapshot module)
System.Collections.Generic.List`1[ProtoPartModuleSnapshot].GetIndex (Int32 startIndex, Int32 count, System.Predicate`1 match)
System.Collections.Generic.List`1[ProtoPartModuleSnapshot].Find (System.Predicate`1 match)
StageRecovery.RecoveryItem.TryPoweredRecovery ()
UnityEngine.Debug:LogException(Exception)
StageRecovery.RecoveryItem:TryPoweredRecovery()
StageRecovery.RecoveryItem:.ctor(Vessel)
StageRecovery.StageRecovery:VesselDestroyEvent(Vessel)
EventData`1:Fire(Vessel)
Vessel:OnDestroy()

Here are the logs:

https://www.dropbox.com/sh/yo6s47374cxyrpj/AABF9xjnb2DOWcUoU8PJLnj9a?dl=0

Is this normal? Is there a fix for it?

PS: Presently, I do not see any issues while playing. I wanted to learn about these NREs and how to fix them, but it was suggested to me that all I could do is report it to the mod author.

Link to comment
Share on other sites

That is a known issue, usually, but this case is a bit of a special exception. The usual case that would cause that issue is a vessel being destroyed while not in the flight scene and not having a Vt value less than the low cutoff velocity. What happens is that SR says "Hey, that's not going slow enough, let's try to land it with it's engines!" and starts looping through the parts to look for engines and some sort of command (aka a probe or kerballed command pod). In the flight scene there's no issues since the parts still physically exist, even if they're unloaded. In the Space Center or Tracking Station scenes the game knows basically nothing about the actual parts, so I can see that there are engines but can't pull any data from them (like the max thrust or ISP). Trying to pull that data (by accessing the module reference) results in the NRE you see (which SR is fully aware of. You'll notice this line just before that: "[sR] Error occurred while attempting powered recovery.") The reason it doesn't break your game is because of a try/catch block that prevents it from causing crashes and instead politely alerts the log to the issue.

The reason your instance is weird is that it happened in the flight scene, which I haven't seen happen before. The good news is that I have actually found a way to get access to some of that information, or at least their default values, and should be able to prevent that error from occurring in the future.

For the time being, don't worry too much about it. It just means that powered recovery couldn't be completed, but the parachutes should still try to do the recovery (and in that case they did. The Vt was about 10, which returned about 12000 funds).

Link to comment
Share on other sites

First of all, thanks so much for this mod! This is the only mod that I've ever NEEDED since I assumed I could do this, built ships to do this, and then was very confused when some random tech limitation of the game prevented me from doing this. However, I have noticed a problem that may force me to uninstall. Recovering ~3/4's of the value of engines, chutes, and other parts just feels right. However, recovering 3/4's of the value of an EMPTY fuel tank feels like an exploit. I wanted to fix a technical limitation, not cheat. When you spend 6000 on a fuel tank, doesn't the majority of that money be going toward fuel, and not the tank itself? Getting ~4000 back after emptying feels like playing career mode for free!

Please correct me if I've got this wrong, I want to be wrong on this, I want to use this awesome mod with a clear conscience :)

Link to comment
Share on other sites

First of all, thanks so much for this mod! This is the only mod that I've ever NEEDED since I assumed I could do this, built ships to do this, and then was very confused when some random tech limitation of the game prevented me from doing this. However, I have noticed a problem that may force me to uninstall. Recovering ~3/4's of the value of engines, chutes, and other parts just feels right. However, recovering 3/4's of the value of an EMPTY fuel tank feels like an exploit. I wanted to fix a technical limitation, not cheat. When you spend 6000 on a fuel tank, doesn't the majority of that money be going toward fuel, and not the tank itself? Getting ~4000 back after emptying feels like playing career mode for free!

Please correct me if I've got this wrong, I want to be wrong on this, I want to use this awesome mod with a clear conscience :)

You should only be getting back the value for whatever amount of fuel is left in the tank. If you aren't then that's a bug. This is the function call that gets the value of a part: ShipConstruction.GetPartCosts(pps, pps.partInfo, out dryCost, out fuelCost); and when SR displays returned values it ONLY displays the dry cost, not the dry+fuel costs.

Is this the tank you're judging this by (for those who don't click the link, it's the 2.5m 32 tank, full: 6400 funds, empty: 4931.2 funds)? As you can see, that tank's empty cost is well over 4000 funds despite costing about 6500 funds full. That's because rocket fuel is actually ridiculously cheap in comparison to parts (1468.8 funds for 1440 LF + 1760 Ox).

So, your assumption that most of the funds for a fuel tank go toward the fuel is actually wrong, which is surprising to me as well!

If you find that your returns are higher than what you're comfortable with you have a few options. If you're playing with the Variable Rate (aka, the default mode) then you can lower either the low cutoff or the high cutoff (or both) to make the same terminal velocities pay out less. Or, by switching to the Flat Rate mode you can adjust the return percentage directly (but then recovery is all or nothing based on the singular cutoff speed).

You can also set some personal rules. I personally don't try to recover things that are going to be dropped when near orbital velocity, since they'd probably be very damaged or destroyed on reentry. I typically only recover things that I drop while still in the atmosphere (boosters rather than anything on the main stack).

Edited by magico13
Link to comment
Share on other sites

Hey there magico, me again buging you on yet another one of your mods :)

Playing yesterday something happened which I didn't know was possible: Stage burned in atmosphere :o

screenshot17.jpg

Is this normal or is because I have 'deadly reentry' enabled? How can I avoid this?

Link to comment
Share on other sites

That is intentional (but apparently missing from the OP, I really need to do some thread maintenance on here). It will only happen if Deadly Reentry is installed and the vessel is going fast enough. Fast enough means greater than 2000 m/s (but is configurable in the settings, and I THINK setting it to 0 will disable it. I wrote that a while ago and don't remember off the top of my head.) Importantly, it's not a strict cut off of 2km/s. That's just when there starts to be a chance of the vessel burning up.

Here's a semi-quick overview of how DR support works:

Above the DR cutoff velocity there starts to be a chance of the stage burning up. For the default settings this is 1% per 10 m/s above 2000 m/s. When you hit 3km/s there is a 100% chance of burning up. If you have heat shields it subtracts a percentage equal to 100 * (current_shielding / max_shielding), aka 100% with full shields, which will totally negate any chance of burning up until 3km/s. After 3km/s, even with heat shields there's a chance of burning up (for instance, at 3500 m/s there is a 50% chance with full heat shields (150% - 100%). With half used shields it's back to 100%! (150% - 50%)). After 4km/s no amount of heat shields will protect your stage from destruction.

Best way to avoid this is to not drop stages at near orbital velocity (especially without heat shields). Do notice that I made no mention of the actual shielding amounts, only the ratio remaining. This can be exploited to use tiny heat shields on big stages to land successfully, but I hope that most people would feel bad about downright cheating :P This mechanic is mostly in place to prevent people from throwing things at the atmosphere at 5km/s with Deadly Reentry installed and still have them survive, but it also makes it so you have to consider whether dropping things into the atmosphere (especially uncontrolled) with orbital speeds is a good idea ;)

Link to comment
Share on other sites

Hey thank you for clarifying my concern about the large amount of cash from spent fuel tanks. Your post was a big win because not only did I learn something, but I also get to continue using your mod with a clear conscience. You're awesome and people should like you!

Link to comment
Share on other sites

Couple of quick questions:

1) Is there any way to control what information is displayed on the various tabs of the toolbar GUI? There is Parts, Crew, Science, and Info. I like to take a screencap of the recovery info for each discarded stage, for posterity and record keeping, and while nearly everything I want to retain is on the Info tab (percent refunded, distance, and speed) the other info I want (total refunded for parts and fuel) is on the Parts tab. So right now I need to take two screencaps of each stage notice. Not a huge deal, but if I could add "total refunds" to the Info tab I would be very happy. Any way to do that easily?

2) Is there any way to delete notifications from the toolbar GUI? Some of my large launchers can have up to 5 stages, with at least 4 boosters per stage. That ends up really filling up the GUI quickly. I can delete the notifications from the Stock message system, but the notices stay in the StageRecovery GUI. Any way to delete them once they've been read, besides reverting and starting a new flight?

3) Any luck on the inaccurate distance thing? No worries, I'm not that concerned about a few funds lost...more interested in what route you are taking from the options you detailed.

Thanks!

Link to comment
Share on other sites

@ThirdHorseman

1) There isn't a way to do that currently since the GUI elements are all hard coded into the system, but I could add "Total Refunds" to the Info tab as well. Do you want/need it broken down into refunds for parts and fuel, or is the total sufficient? (generally fuel will be ~0 anyway).

2) The only way to "delete" them currently is to leave the flight scene. I never expected that anyone would want to delete them because I didn't think people would have that many stages, but I can add a button to "dismiss" or "delete" the info from the GUI.

3) I've been focussing my limited modding time on Kerbal Construction Time lately, so there hasn't been much progress in StageRecovery as of late. The last thing I had worked on was automatic recovery of launch clamps (which will need some modification to work with FASA). I have been considering adding the ability to keep stages loaded and have physics simulated on them (note: this would be an option, not a requirement, since many people probably wouldn't want it for normal stages) which would solve that issue, and I've been considering either integrating with Atmospheric Trajectories (easier, but adds a dependency) or borrowing part of that code to improve the landing locations. Now that I think of it, since the issue isn't absolutely major (mostly just an annoyance) adding a soft dependency on Trajectories is both easier/quicker for me and less questionable than borrowing code. And they did add the API because of my request, so I should probably use it :D

I'll devote some time to StageRecovery after the next KCT release, which will hopefully be very soon. I've had to make some major changes in KCT which have occupied over 100% of my small amount of dev time (who needs sleep?!)

Link to comment
Share on other sites

@magico13 is there any way to change the velocity from 2,000 m/s?

Definitely! In the settings (accessible in-game from the Space Center, or out of game in the GameData/StageRecovery/Config.txt file) just change the DRMaxVelocity to something higher, to wherever you think the chance for issues with DR would normally start to appear. You can also disable it by setting it to 0.

Here's the formula that calculates the chance (straight out of the source): burnChance = (float)(2 * ((vessel.obt_speed / Settings.instance.DeadlyReentryMaxVelocity) - 1));

So setting it to 5000 m/s would give you a 32% chance of burning up at orbital velocities (compared to Stock which is between 20 and 30% at orbital velocity). The astute may notice that it uses orbital velocity, which is actually changed to surface velocity in the next update, which will make it a bit more forgiving. Also keep in mind that due to KSPs weird physics, stages will be going faster at deletion (and thus recovery) altitude because drag is not applied.

For suborbital drops you shouldn't probably run into too many issues setting it around 5km/s.

Link to comment
Share on other sites

but I could add "Total Refunds" to the Info tab as well. Do you want/need it broken down into refunds for parts and fuel, or is the total sufficient? (generally fuel will be ~0 anyway).

"Total Refunds" would be just fine...it's just so with one screen you can see how much you got back and how that amount was determined. That would be spectacular, thanks!

but I can add a button to "dismiss" or "delete" the info from the GUI.

Something just like the stock messaging options (a trash can for Discard and a red X for Close) on the popup notifications would be perfect! Thanks!

I have been considering adding the ability to keep stages loaded and have physics simulated on them (note: this would be an option, not a requirement, since many people probably wouldn't want it for normal stages) which would solve that issue, and I've been considering either integrating with Atmospheric Trajectories (easier, but adds a dependency) or borrowing part of that code to improve the landing locations. Now that I think of it, since the issue isn't absolutely major (mostly just an annoyance) adding a soft dependency on Trajectories is both easier/quicker for me and less questionable than borrowing code. And they did add the API because of my request, so I should probably use it :D

While I do like the idea of actual physics on the discarded stages, I can understand why people wouldn't be too crazy about that if it had serious impact on game performance. I say go for the soft dependency, since it isn't a huge issue. Mods like Karbonite include like 5 other mods in the install, so it isn't that big of a deal!

I'll devote some time to StageRecovery after the next KCT release, which will hopefully be very soon. I've had to make some major changes in KCT which have occupied over 100% of my small amount of dev time (who needs sleep?!)

Time enough for sleep in the grave!!!! :) Thanks for the answers, and good luck with all the dev work!

Link to comment
Share on other sites

Hey Magico,

Would it be possible to have the powered recovery module check for jet engines or a certain amount of drag to determine if the vehicle is a plane?

I'd like to air drop rovers and landers around Kerbin and have my delivery plane automatically land itself. However the requirement for TWR of 1.0 makes that impossible with a cargo plane -- mine are usually around .6 or .7 TWR with AJE installed.

Even if the TWR requirement was just a configurable variable so that I could change mine and not affect others' gameplay style, that'd work for me.

I hate being needy... :)

Link to comment
Share on other sites

Mission controller had a check for planes that I can look back at and see if I can adapt it. At the very least, making the TWR minimum adjustable is simple. It's not super easy to tell if something should be landed horizontally in the code, but I'll see what I can come up with.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...