Jump to content

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


magico13

Recommended Posts

Sometimes the distance calculation bugs out when KSP reports an incorrect latitude and longitude for the vessel. Unfortunately there's not much I can do about that. And it's totally random when it happens.

But it happens every single time.

I noticed something else and I now know it's caused by the Kopernicus mod that slightly moves Kerbin.

Is there any way I can make SR ignore the distance check

Edited by Ryve
Link to comment
Share on other sites

Is there any way I can make SR ignore the distance check

There isn't in the official release, but I made a dev version just for you, here. It adds a setting, accessible only in the config file and not in the in-game settings, that you can set to override the distance percentage. By default it's at -1.0, which means "calculate the distance". If you set it to anything between 0 and 1 it will force the distance percentage to be between 0 and 100%, constant. The normal maximum for distance is 98%, the minimum is 10%, and it falls off kinda slowly. Setting it to 0.95 would probably be fair in a vast majority of cases.

That setting won't appear in the file until you start the game. Any changes you make to it will require you to change scenes before they take effect (so do it in the Main Menu or the Space Center scenes and it'll load by the time you go into Flight).

Link to comment
Share on other sites

There isn't in the official release, but I made a dev version just for you, here. It adds a setting, accessible only in the config file and not in the in-game settings, that you can set to override the distance percentage. By default it's at -1.0, which means "calculate the distance". If you set it to anything between 0 and 1 it will force the distance percentage to be between 0 and 100%, constant. The normal maximum for distance is 98%, the minimum is 10%, and it falls off kinda slowly. Setting it to 0.95 would probably be fair in a vast majority of cases.

That setting won't appear in the file until you start the game. Any changes you make to it will require you to change scenes before they take effect (so do it in the Main Menu or the Space Center scenes and it'll load by the time you go into Flight).

A hero. Not the hero we deserved but the hero we needed. Nothing less than a knight. Shining.

I have also received word from the people at Outer Planets Mod.

They are close to fixing the issue, but no ETA. Just in case anyone else wanted to know.

Edited by Ryve
Link to comment
Share on other sites

Are you familiar with Kerbal Konstructs? It places additional static bases and tracking stations in various places on Kerbin, if I understand correctly they already support the stock recovery of missions, can Stage Recovery be made to use the additional static locations for calculating recovery?

Link to comment
Share on other sites

Are you familiar with Kerbal Konstructs? It places additional static bases and tracking stations in various places on Kerbin, if I understand correctly they already support the stock recovery of missions, can Stage Recovery be made to use the additional static locations for calculating recovery?

It's kind of on my long-term todo list. There's a github issue about doing this same thing for RSS, and while the two require vastly different implementations, it would make sense to add support for both at the same time. I'm going to be doing some work to get KK integration into KCT at some point soonish, and since KCT now requires StageRecovery for parachute based recovery of parts, I'll likely need to add that support into SR as well (so it makes sense to do that all at the same time).

In short, long term goal unless people pester me about it a lot ;)

Edit: Alternatively, KK could tie into the SR API and determine the amount of funds it should give the user to "split the difference", but it makes more sense for this to be done on SR's side.

Link to comment
Share on other sites

Just wondering if there is any provision to recover stages which fall within draw distance of the recovery site of your manned capsule? Ex: On a particular rocket I jettison the final power stage of my capsule after my reentry burn, and it typically reenters and splashes down within 20km of the command module. I recover the command module, and the "spacecraft debris" is lost without being recovered. Am I doing something obvious wrong here?

Link to comment
Share on other sites

Just wondering if there is any provision to recover stages which fall within draw distance of the recovery site of your manned capsule? Ex: On a particular rocket I jettison the final power stage of my capsule after my reentry burn, and it typically reenters and splashes down within 20km of the command module. I recover the command module, and the "spacecraft debris" is lost without being recovered. Am I doing something obvious wrong here?

StageRecovery only works when things exit the physics range of the active vessel. If the other parts are still loaded, you can recover them the old fashioned way, which might require a bit of manual trickery to do properly. The physics range is 22.5km in 1.0 (it was only 2.5km in 0.90). I may add the ability to automatically deploy stock parachutes on unfocused vessels when get within a certain distance of the ground, but that will require a totally different set of code, which is why I haven't done it yet. When I do that, it should make that sort of thing easier to accomplish. Otherwise, you can try deploying your parachutes on that other piece while you reenter.

If you're not seeing it in the Tracking Station but know it landed safely, make sure you disable debris filtering (top of the TS/map view window), as debris isn't shown by default. You also won't get a popup telling you you recovered any funds, but your funds will actually go up.

Edited by magico13
Link to comment
Share on other sites

I may add the ability to automatically deploy stock parachutes on unfocused vessels when get within a certain distance of the ground, but that will require a totally different set of code, which is why I haven't done it yet.

Orrrrr maybe suggest that people use Realchutes instead, as it as an awesome mod and gives the option to arm the chute instead of launching it right away.

Link to comment
Share on other sites

It's kind of on my long-term todo list. There's a github issue about doing this same thing for RSS, and while the two require vastly different implementations, it would make sense to add support for both at the same time. I'm going to be doing some work to get KK integration into KCT at some point soonish, and since KCT now requires StageRecovery for parachute based recovery of parts, I'll likely need to add that support into SR as well (so it makes sense to do that all at the same time).

In short, long term goal unless people pester me about it a lot ;)

Edit: Alternatively, KK could tie into the SR API and determine the amount of funds it should give the user to "split the difference", but it makes more sense for this to be done on SR's side.

Thank you for taking the time to answer. I support your long term plan in the hopes that it becomes a short term plan :)

Link to comment
Share on other sites

Having a major issue with the powered recovery in this mod

In the 0.90 version it was possible too have a tank on the top of your rocket stage where you disabled the fuel flow leaving it reserved, so when using MechJeb launch control it would automatically stage and there would be enough fuel left in the tank for a safe powered recovery. I didn't have too switch too the discarded stage and unblock the fuel flow, the mod just saw there was fuel in it and activated engines and successfully recovered.

Now in the 1.0 version the blocked fuel in the stage isn't counted for recovery, it always results in failure. Also when you go too switch too the stage it bugs out when you unblock the fuel, automatically throws throttle to maximum burning away the fuel.

Could you please restore it too the 0.90 functionality where the powered recovery will use fuel in blocked tanks, this would make the mod far more useable for Mechjeb players who would like the mod too work in the background of their automatic launches; the way the mod works currently you need too manually stage when you guess there is enough fuel left for a powered recovery.

I like too go to the bathroom and make a cup of tea when I hit launch, come back too find my payload in orbit and all stages recovered safely.... unfortunately in the current state of the mod this is not possible :(

Edited by Wetapunga
Link to comment
Share on other sites

I like too go to the bathroom and make a cup of tea when I hit launch, come back too find my payload in orbit and all stages recovered safely.... unfortunately in the current state of the mod this is not possible :(

Holy crap, how do you automate all of that? Please send me a PM so as to not derail the rest of this thread.

Link to comment
Share on other sites

Holy crap, how do you automate all of that? Please send me a PM so as to not derail the rest of this thread.

It used to be as simple as having MechJeb do the ascent for me and designing my rocket stages too have extra fuel for the stage recovery plugin too play with.... alas now stage recovery is broken and doesn't play nice, powered recovery is weird now.

I had a fully automated Falcon Heavy using the 3 meter parts as my standard lifter, saved me a LOT of money being able to recover all the main stages automatically, with a lighter cargo the core 1st stage often ended up in stable orbit so I would kick it back down to let it recover, heavy cargos the second stage ended up in orbit

Link to comment
Share on other sites

When I get to work and am on an actual computer, I'll respond to everything in full, but powered recovery either doesn't work because of the changes to thrust, or requires a crap ton of fuel because SR can't calculate terminal velocities correctly. Either way I'm going to have to dig into the code to fix it, and do a bunch of tests along the way, which because of finals this week and next might take me some time to do. I'm already busy after work today, I might be able to get some stuff done tomorrow evening, Friday is one of my finals (at 7pm) and I'll be at work until then, but Saturday I'll have the best chance of getting an opportunity to do some work on the problem. I am also trying to finish a massive final project (in my Atomic Scale Simulations class) that has been, and will continue to, eat up enormous amounts of time, which is due next Wednesday (along with a paper, presentation, and website for it, along with actual results and my simulations take over a day just to run). Until then, you might need to use FMRS. Also if you have no SAS at all then SR won't recover it (there's an option in the settings, "Tie Into Upgrades" or something like that).

Edit: Sorry if I sound whiney or rude, just a bit of a rough morning and the impending finals have me a little on edge.

Edit2: At work, responding to a bunch of KSP posts in various threads.

@magico13 does StageRecovery modulate thermal damage to parts during reentry?

Kind of. Older versions of SR had a weird way of interacting with Deadly Reentry that I have moved to the Stock system. I've explained it numerous times throughout the thread, but apparently have never added that to the OP (which explains all the questions about it). I'll try to add a description of how it works to the first post, and if you still have questions when you read it, let me know.

@Wetapunga if you could upload a log file from one of your flights, it might save me some time trying to figure out exactly where the problem is. I'm still going to have to do a bunch of tests myself, but at the very least I can see if the powered recovery code is trying to work at all. If it's a thrust calculation issue, it might log an error. If it's just that the "calculated" terminal velocity of the ship is way too high and no amount of fuel will fix it, then I'll be able to see that in the Vt outputs. Either way, I know the thrust to weight calculations aren't using the correct atmospheric thrust, so I'll need to change that, but if it's primarily an issue with terminal velocity measurements I can get you a quick workaround until I can do a more proper fix later. Terminal velocities will definitely be higher with this version of KSP, and (un)fortunately the new aero doesn't have simple equations to determine terminal velocity. I'll have to throw a bunch of things at the ground and come up with a reasonable estimation for Vt for things without chutes.

Edited by magico13
Link to comment
Share on other sites

Having a major issue with the powered recovery in this mod

Now in the 1.0 version the blocked fuel in the stage isn't counted for recovery, it always results in failure. Also when you go too switch too the stage it bugs out when you unblock the fuel, automatically throws throttle to maximum burning away the fuel.

Not a major issue but rather design choice, the powered recovery needs to have SAS or a command module (confirm?) to work. And I guess it should be optional too, as everything that magico does is.

You could just simply strap on some radial chutes....

Link to comment
Share on other sites

Not a major issue but rather design choice, the powered recovery needs to have SAS or a command module (confirm?) to work. And I guess it should be optional too, as everything that magico does is.

You could just simply strap on some radial chutes....

The craft needs to have SAS capabilities yes, but I suspect the calculation of terminal velocity + the changes to thrust added in 1.0 are the primary sources of problems. I need to go through that code again anyway, I just haven't gotten a chance to yet.

Link to comment
Share on other sites

It used to be as simple as having MechJeb do the ascent for me and designing my rocket stages too have extra fuel for the stage recovery plugin too play with.... alas now stage recovery is broken and doesn't play nice, powered recovery is weird now.

I had a fully automated Falcon Heavy using the 3 meter parts as my standard lifter, saved me a LOT of money being able to recover all the main stages automatically, with a lighter cargo the core 1st stage often ended up in stable orbit so I would kick it back down to let it recover, heavy cargos the second stage ended up in orbit

This is exactly what I used to do as well. And then you can unlock your buildings much faster and then start to flip a ton of money into science late game.

Might now have to write a kOS script to fly the first stage home.

- - - Updated - - -

The craft needs to have SAS capabilities yes, but I suspect the calculation of terminal velocity + the changes to thrust added in 1.0 are the primary sources of problems. I need to go through that code again anyway, I just haven't gotten a chance to yet.

The other problems is the physics cutoff, no? If the first stage remains in physics range when it hits the ground, it needs to land intact? You can't just add up the amount of dV and call it a day, correct?

Link to comment
Share on other sites

The other problems is the physics cutoff, no? If the first stage remains in physics range when it hits the ground, it needs to land intact? You can't just add up the amount of dV and call it a day, correct?

SR only cares about things that go beyond the physics cutoff (SR is event driven, it doesn't monitor all the craft for changes so it only knows to do things when KSP tells it to). If the first stage stays within physics range, then SR isn't needed and that's up to you to figure out (since you can technically land it yourself, for powered landings I'd use kOS or MechJeb). It's pretty unlikely that the first stage hits the ground before you get out of range, unless you drop it from under like 5km.

How SR's powered recovery code is supposed to work is that it checks that the TWR for all the active engines is greater than 1 (for obvious reasons), then properly adds up the ISP of all the active engines. Then, using that total ISP it calculates how much dV the ship has compared to how much it requires (which has always been 2.5 times the terminal velocity, after parachutes are accounted for), targeting a landing speed that is 2 m/s less than the minimum cutoff (4m/s target by default). If it's got enough dV, it takes out the fuel it would have had to burn, then recovers. If it doesn't have enough dV then it takes as much as it can and calculates the final velocity, on the off chance that it gets the final velocity to something low enough for partial recovery.

Because of how I'm basically not calculating the terminal velocity of ships without parachutes, the required dV is probably outrageously high. I still haven't seen any logs or screenshots or anything to know what it's saying the terminal velocity is. And I don't know if the thrust value it's using is the one at "deletion" or at sea level, or in vacuum.

Link to comment
Share on other sites

Ok, that's what I figured. So for a 2 booster Falcon Heavy craft, the physics cutoff shouldn't make a difference once you sort out the powered landing stuff as you'll be jettisoning those boosters more than high enough to miss the cutoff and they should be going slow enough to not burn up. When you get to 4 or 6 booster asparagus craft, that's a different matter and you may well be dropping those first stages soon enough that you won't hit 22K before the booster hits the ground. Something new to think about in the design.

As for dV estimates being too high, I personally think that's fine. The reason why SpaceX powered landing is such a game changer is that you recover 95% of the cost of the stage, and so instead of building minimally-viable stages to cut down on the amount of cash you are literally going to dump into the ocean, you build maximally-viable stages that are larger, stronger, safer, and likely overpowered and overfueled, because your only real cost is the fuel you use up. It's a completely different way to design a launcher because you can stick anything you want in your lifter stage and so long as you can get it home in one piece, you get it all back for the next launch. So, I wouldn't worry about the dV calculation being too high so long as we can predict what it will be. If we know it's about 400dV, then we can work out the mechanics for how to drop that stage with that much dV in the tank, and the cost of fuel for that number vs 200 or what it realistically would be is effectively zero.

Link to comment
Share on other sites

I'm going to limit the maximum terminal velocity to something reasonable, and then let you guys know what it is. Currently I think it might be predicting WAY unreasonable values, like thousands of meters per second, meaning you'd need more dV to land than to get into orbit. Not very reasonable. But I wont get a chance to fire up KSP to do tests until tomorrow, but with log files I can probably do a quick fix tonight if the thrust calculation isn't too messed up (I can add a cap on the terminal velocity without firing up visual studio, but not mess with the thrust stuff).

Link to comment
Share on other sites

The debris filter was what I was missing, thanks! Just as a side note, I've had good luck with deploying the parachutes in staging simultaneously with the decouplers, but raising the deployment pressure to maximum so they don't deploy at 25,000m and burn up.

Link to comment
Share on other sites

The debris filter was what I was missing, thanks! Just as a side note, I've had good luck with deploying the parachutes in staging simultaneously with the decouplers, but raising the deployment pressure to maximum so they don't deploy at 25,000m and burn up.

Awesome! Glad to hear things are working properly for you!

As for everyone who is having trouble with powered recovery, please go here, read the recent changes, and try the .dll in the "Last Successful Artifacts". It should fix any issues with powered recovery. You now need 300 m/s of dV and the terminal velocity is set to 200 m/s for any vessels that don't have parachutes.

Link to comment
Share on other sites

Noticed a minor bug during a very early career launch, the kind you go straight up, run out of fuel and come back down. I detached the first stage once it was spent, and the parachutes on it opened, slowing the descent. The capsule stage landed first, and when I activated time compression to accelerate the first stage's descent, it disappeared and I got a notification that it was recovered. The small bug is that it said the stage had been recovered over 700 km away from the KSC, when it truth it would've been a helluva lot closer to 700 metres.

Link to comment
Share on other sites

The small bug is that it said the stage had been recovered over 700 km away from the KSC, when it truth it would've been a helluva lot closer to 700 metres.

For whatever reason, time acceleration seems to cause that. I'm starting to wonder if maybe KSP sets the lat/lon to 0, 0 for some vessels in certain situations.

Link to comment
Share on other sites

Mini bug: flag on kerbal was recovered with a recovery message on my save just now... yet "flag" is on the ignore list...

edit:(and game crashed a minute later, so no logs sorry)

Edited by Mokmo
Link to comment
Share on other sites

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