Jump to content

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


magico13

Recommended Posts

Noticed some issues with 1.0.5. I'm pretty sure a recompile is all that was needed, so I've done that and have pushed a new update. If you're using KSP 1.0.5, you'll have to update. No new features yet, those are still WIP.

Link to comment
Share on other sites

  • 2 weeks later...
[quote name='magico13']Noticed some issues with 1.0.5. I'm pretty sure a recompile is all that was needed, so I've done that and have pushed a new update. If you're using KSP 1.0.5, you'll have to update. No new features yet, those are still WIP.[/QUOTE]

LOVE the mod.

Is there any way to remove the icon? I prefer a "set it and forget it approach" instead of being reminded that I am using a mod while immersed in the game.
Link to comment
Share on other sites

[quote name='Javin']LOVE the mod.

Is there any way to remove the icon? I prefer a "set it and forget it approach" instead of being reminded that I am using a mod while immersed in the game.[/QUOTE]

Well, the icon gives you access to a bunch of other stuff in the editor and flight scenes, but if you really want to remove it you could download the [URL="http://forum.kerbalspaceprogram.com/threads/60863-1-0-5-Toolbar-1-7-10-Common-API-for-draggable-resizable-buttons-toolbar"]toolbar mod[/URL] and set it to not show any icons. I've added an issue on GitHub to provide an option to remove the buttons completely (at least when using just the Stock Toolbar) if you're ok with waiting for the next release. I'm nearly finished with some new features for the VAB/SPH and once those are done I'll be putting out a release.

Edit: If you're not afraid of a development build, I've added this into the latest dev build. Get it from [URL="http://magico13.net:8080/job/StageRecovery%20Development/"]here[/URL]. You'll have to add this to the bottom of your settings file (in the StageRecovery folder): "HideButton = true" Edited by magico13
Link to comment
Share on other sites

For starters, should state I'm playing RO/RSS/RP-0. Not sure if this would even work in real life but if you had a spent rocket stage that was entering the atmosphere at around 3000m/s, if you included a bunch of drogue chutes that were set to deploy when the stage reached 90km-100km, would they reduce the ships speed enough before they got ripped off so that StageRecovery would allow a successful recovery? Obviously you'd also have to include standard chutes that deployed closer to the ground. Just not sure if the drogue chutes would survive long enough to cut the stages speed to a survivable level.
Link to comment
Share on other sites

  • 2 weeks later...

I have just completed and failed a Contract Configurator contract that was tied to recovery of a Kerbal Tourist. I failed it due to him being 'killed'. As you may have guessed, I used StageRecovery to recover this tourist kerbal. We slapped a pair of parachutes on the passenger fuselage, and a heat shield, and just ejected them off the end of the rocket. StageRecovery brought Bill and our intrepid tourist back just fine - both were mentioned on the SR popup, and Bill is back in the Astronaut Complex. The Tourist is nowhere to be found, and I have the perks of having failed the contract. 

Question three (one and two are in the Tourism Plus thread), is whether at any point between Squad deleting debris under 23 km altitude and further than 24 km from the active vessel, and StageRecovery 'recovering' the kerbonauts, the Kerbals might be status: dead?

Thanks for the help!

Link to comment
Share on other sites

@chrisl StageRecovery works with RO, you just have to go into the settings and increase the DR Velocity to something more reasonable like 7000 or 8000.

 

@blu3wolf Unfortunately there is a point where the Kerbal is dead and then brought back to life. There's a tiny reputation hit for it, and it causes contract failure. I believe a page or two back there was another report of it. The semi-good news is that I've been working on getting around it, but it requires precalculating if a vessel is going to be destroyed. StageRecovery works through events and unfortunately there aren't many applicable events fired before the kerbals are killed (which is BS since there's an event like OnAboutToBeDestroyed that fires after the kerbals are dead but really shoulf be before then).

The only event I've found that works is when the vessel goes on rails (is unloaded). Unfortunately that means that StageRecovery nicely recovers the kerbals only if the vessel goes out of range while under 23km. If it's above 23km then it goes on rails it isn't destroyed until it falls back down, but there's no event that works for that.

Basically, its a really annoying problem that I haven't found a good solution to since Squad is eager to kill the kerbals. (Did you know, in flight the Kerbals aren't killed once, but twice! Yep, twice. In the Tracking Station they aren't killed at all when a vessel gets destroyed, until a scene change at least)

Link to comment
Share on other sites

Hey @magico13, I need your help on an issue that has been reported against the Tourism Contract Pack here.  The gist of the issue is that he recovered the tourist via stage recovery, but failed their contract (because I detected them as killed).  I skimmed the StageRecovery code and looks like the way it works is to run after the vessel is marked as destroyed and "revive" Kerbals.

Right now, I'm using the GameEvents.onCrewKilled event to detect Kerbal death for those types of contracts.  Is there a different event that I could look at instead that fires later (ie. after Stage Recover)?  Or should I perhaps just detect the event, wait a couple of second and only fail the contract if they are still showing up as dead after the delay?

Link to comment
Share on other sites

@nightingale That very problem was the discussion of the previous post. Its not just an issue with your contracts, its with all contracts. It seems Squad is eager to kill kerbals as soon as possible in the vessel destruction code, and I haven't found a good event I can use to pre-recover the kerbals.

I've got a workaround in the dev builds but it only works for a very specific set of circumstances. For it to work for everything I'll likely have to move away from events and move to something that checks at risk vessels every frame. If you want to change something on your end, checking a single frame after they're "killed" should be enough time.

Link to comment
Share on other sites

2 hours ago, magico13 said:

@nightingale That very problem was the discussion of the previous post. Its not just an issue with your contracts, its with all contracts. It seems Squad is eager to kill kerbals as soon as possible in the vessel destruction code, and I haven't found a good event I can use to pre-recover the kerbals.

I've got a workaround in the dev builds but it only works for a very specific set of circumstances. For it to work for everything I'll likely have to move away from events and move to something that checks at risk vessels every frame. If you want to change something on your end, checking a single frame after they're "killed" should be enough time.

Ah, I should've actually read even one post up in the thread, sorry!

I'll implement a one-tick delay, it's pretty quick for me to do that.  Obviously won't help you with the stock stuff, but it's something at least.

Link to comment
Share on other sites

Hi

 

I'm having as issue with StageRecovery not working and I cant work out why (hoping someone can help!). The mod is installed and the icons in game all appear, setting can all be configured. In the VAB the StageRecovery icons appears and works as intended - i.e. it produces messages with stage recovery information ,terminal velocities etc. The problem is, when I actually launch a rocket SR simply doesn't appear to kick in. I get no messages about either success of failure of recovered stages and no credit increase. I have used SR for a long time so I know this is not an operational issue (such as not putting on parachutes etc.)

 

I have done all the obvious things such as remove and reinstall the mod, disable and re-enable the mod, disable powered recovery - all without luck.

 

Is there a log or something else I can look at that might point to the issue?

 

 

Link to comment
Share on other sites

@Marstiphal It sounds like things are installed correctly, so I'm not sure what would be up either. Do ensure you're on the latest version if you're playing on KSP 1.0.5 (or use SR 1.5.7 for KSP 1.0.4). I'm assuming it worked fine for you in other 1.x KSP versions? In 1.0 they increased the physics range so you have to get >23km away before things despawn, so it's possible the things you drop are hitting the ground before they'd despawn.

 

The log to check is the output_log.txt file in the KSP_Data folder. If you're not on Windows it's a bit different, but this thread has the locations for the appropriate logs. If you upload that log to a site like dropbox or google drive and send me the link then I'll take a look at it and see if something's up. The way for it to be most useful would be to fire up KSP, start a new launch and drop some things that should get recovered, then revert the launch and exit KSP. That'll make the log nice and short and make it easier to see what's going wrong.

Link to comment
Share on other sites

42 minutes ago, magico13 said:

@Marstiphal It sounds like things are installed correctly, so I'm not sure what would be up either. Do ensure you're on the latest version if you're playing on KSP 1.0.5 (or use SR 1.5.7 for KSP 1.0.4). I'm assuming it worked fine for you in other 1.x KSP versions? In 1.0 they increased the physics range so you have to get >23km away before things despawn, so it's possible the things you drop are hitting the ground before they'd despawn.

 

The log to check is the output_log.txt file in the KSP_Data folder. If you're not on Windows it's a bit different, but this thread has the locations for the appropriate logs. If you upload that log to a site like dropbox or google drive and send me the link then I'll take a look at it and see if something's up. The way for it to be most useful would be to fire up KSP, start a new launch and drop some things that should get recovered, then revert the launch and exit KSP. That'll make the log nice and short and make it easier to see what's going wrong.

Thanks, I appreciate the help. This was after a new game, test dropped 2 SRB's and 1 main engine and associated fuel tanks.

 

Here is the file

 

You say that things de-spawn at >23km but I'm seeing these dropped pieces being tracked at far greater distances. Could that be part of the issue? I've never had any problems with SR before. I'm on the latest KSP and latest SR files and it has been working just fine on this set up. I therefore can only assume (i know, I know) that this is a new conflict with another mod or something updated.

Edited by Marstiphal
Link to comment
Share on other sites

Hello all,

Could someone explain to me how StageRecovery and FMRS cooperate? Last time I tried using them together (which I believe was earlier than their compatibility) all hell broke loose...

Does StageRecovery only recover parts that don't have command probes on them? Unlike FMRS which requires them?

Link to comment
Share on other sites

@Marstiphal Well, the log is definitely saying something's wrong with both StageRecovery and KCT, but I'm not totally sure what about it is messed up. StageRecovery sees the parts being destroyed and estimates the terminal velocity, but when it goes to calculate the distance from KSC it errors out. KCT has an error that it's spamming with regards to trying to assign reconditioning time and I'm not sure why that's messing up either. Is your install through CKAN? If so, can you send me your mod manifest (the "easy way" from this link) and any config files you changed from the default.

1 hour ago, deltatag said:

Hello all,

Could someone explain to me how StageRecovery and FMRS cooperate? Last time I tried using them together (which I believe was earlier than their compatibility) all hell broke loose...

Does StageRecovery only recover parts that don't have command probes on them? Unlike FMRS which requires them?

I haven't tested StageRecovery with FMRS in a while, and I don't think FMRS has been updated since 1.0, so I'm not 100% sure they're working together correctly but here's how they're setup to work. When FMRS is turned off, StageRecovery handles everything as if FMRS wasn't installed. When FMRS is on it handles everything with a probe core, kerballed command pod, or RealChute parachute and StageRecovery handles uncontrolled things that use Stock parachutes. I'd like it to handle uncontrolled things with RealChute parachutes as well, but that'd require a change on the FMRS side. If you know you're not going to use FMRS for recovering parts from a particular flight, it's best just to turn it off for that flight and let StageRecovery handle it.

Link to comment
Share on other sites

On ‎12‎/‎5‎/‎2015‎ ‎7‎:‎12‎:‎25‎, magico13 said:

@chrisl StageRecovery works with RO, you just have to go into the settings and increase the DR Velocity to something more reasonable like 7000 or 8000.

Oh.  I hadn't even considered that Stage Recovery wasn't already geared to RO.  I've been playing all this time with the default settings and just accepting that anything more than 2km/s was likely going to fail to recover.  But I'm assuming that setting it to 7000 or 8000 would be too high since that's orbital velocity.  Does Stage Recovery actually "fly" (or fall) the stage through reentry to determine whether it burns up?  Or does it just look at certain variables and come up with a percentage chance that the stage burns up?

EDIT: Or is the DR Velocity supposed to be just below orbital velocity?

Edited by chrisl
Link to comment
Share on other sites

57 minutes ago, chrisl said:

Does Stage Recovery actually "fly" (or fall) the stage through reentry to determine whether it burns up?  Or does it just look at certain variables and come up with a percentage chance that the stage burns up?

EDIT: Or is the DR Velocity supposed to be just below orbital velocity?

The latter. If it's out of physics range (22.5km) but still above the atmospheric pressure cutoff (~23km on Kerbin, IDK what it is for Earth) then it just acts like it were on an airless world (aka: speed up as you get closer to the ground and don't slow down from drag). SR looks at the surface velocity at destruction, compares it to the DR velocity and comes up with a percent chance to be destroyed (0% if below the DR velocity, but can be >100% at high speeds). Heat shields reduce that percentage by up to 100% based on how much material they have left.

You'll have to tweak things a bit to find something you feel is reasonable. The default of 2km/s works for Stock since that's just under orbital velocity, which means you should be able to drop things from a low suborbital trajectory and have a low (but >0%) chance of destruction, but dropping them into the atmosphere at Munar return speeds are instant death. Dropping them down from orbital speeds gives around a 50-50 shot of destruction without heatshields, but is easy with heat shields.

I think 7 or 8km/s is reasonable for SR with RO since the parts don't get to slow down before destruction. That should allow for suborbital but not orbital returns. You could set it lower if you wanted since truly suborbital things don't always survive reentry either.

 

(Stock: <2km/s: 0% chance. 3km/s: 100%. 3km/s+heatshield: 0%. 4km/s+heatshield: 100%)

Link to comment
Share on other sites

@magico13, @Marstiphal

I suspect Kopernicus is at fault here, there's a lot of errors coming from that mod.

About the only thing that could be null in Magico's code is "SpaceCenter.Instance" and in Kopernicus code I found:

// Clear space center instance so it will accept nouveau Kerbin
SpaceCenter.Instance = null;

Maybe @Thomas P. can help you :)

Link to comment
Share on other sites

@charfa I saw that too and wondered if the SpaceCenter was somehow null, but that seems very unlikely. @Thomas P.'s response confirms that for me even more. I'm tempted to say it's related to KCT apparently breaking the execution of the State Change event for that vessel (though still unsure of why that would happen in the first place).

 

The Vessel and the Vessel.protoVessel both can't be null either otherwise it wouldn't have gotten that far. The only remaining things are the StageRecovery Settings object (unlikely though and it couldn't have gotten that far along either), the SpaceCenter.Instance.cb (definitely a possibility, but seems unlikely, plus the only planet mod was Kerbol Plus which doesn't reparent Kerbin). Nothing seems like it should be null, which is why I want to test with the same environment. Worst case I just send him a dev version that logs the value of each variable used and figure out which one is messed up.

Link to comment
Share on other sites

  • 2 weeks later...

New Update!

I also attempted to update the OP, but the new forum is weird so it might take a few revisions.

There were two main focuses of this update: the editor helper GUI and kerbal recovery.

On the Editor Helper GUI front there were substantial improvements. Where the old one would take the whole vessel and calculate it as a single stage, the new one will attempt to break the vessel into individual stages and calculate stats for each one separately. That means that you can build the entire vessel and then see if things will be recovered, rather than building each stage separately and merging them all at the end. Additionally, the stages are highlighted green/yellow/red to give you a quick view of the recovery status. I'd like feedback on what you want changed/improved/added (perhaps powered recovery, for instance)

Regarding Kerbal Recovery, during flight StageRecovery will attempt to pre-recover kerbals prior to the vessel's destruction so that contracts aren't failed. You should be able to send down tourists or rescued kerbals without the contracts failing now. This only works in the flight scene, however, and might not work correctly at high timewarp.

 

A picture of the new editor helper:

3vue5Lo.png

 

Full changelog:

1.6.0 (12/21/2015)
- Hovering over Stock the SR icon in flight lets you preview the SR window
- TweakScaled parachutes now supported
- Tourists and other crew are pre-recovered while in the flight scene, preventing contract failure
- Improved the Editor Helper. Now splits the vessel into individual stages and provides velocity estimates for each stage. Will be improved after receiving feedback
- New setting to completely remove all SR buttons, accessible only through the config file
 

Edited by magico13
Link to comment
Share on other sites

Oh cool. I was wondering myself about how to tell if the chutes are enough for a given stage, aside from some trial and error.

Also, @magico13 what does it mean if the recovery on the top stage says 99.8% and is yellow rather than green? Like theres a .2% chance it won't be recovered?

Edited by smjjames
Link to comment
Share on other sites

48 minutes ago, smjjames said:

what does it mean if the recovery on the top stage says 99.8% and is yellow rather than green? Like theres a .2% chance it won't be recovered?

Yellow just means it's between the low cutoff and the high cutoff, so you'll only get a fractional recovery. That means you'll lose 0.2% of the value upon recovery (which is pretty much nothing, you'll lose more from distance which maxes out at 98%). Green happens as soon as the velocity is below the low cutoff, which defaults to 6 m/s.

Yellow then is 6m/s to 12m/s. Red is >12m/s.

Link to comment
Share on other sites

Magico,

I know plane recovery has been talked about previously, but I'm having some trouble trying to recover a plane with powered recovery even with the minimum TWR set lower than the plane's active TWR.

Usually the recovery message says something like "Attempted powered recovery but...", however I don't get that message at all with this plane. It's like it's not attempting it.

I'm using RSS/RO and the plane uses 4 prop engines from KAX (I think). Is there something that the code is looking for in order to identify an engine for powered recovery?

Link to comment
Share on other sites

It looks for ModuleEngine or ModuleEngineFX and fuel for those engines. Could you upload the log file and the planes craft file? It should work with mod engines but I haven't tested it with those ones before.

Link to comment
Share on other sites

1 hour ago, magico13 said:

It looks for ModuleEngine or ModuleEngineFX and fuel for those engines. Could you upload the log file and the planes craft file? It should work with mod engines but I haven't tested it with those ones before.

I think it may not be the engines. I recovered it with parachutes just to test, and found that my pilot wen't missing from the command pod after recovery. Was listed as MIA after I ended the mission. Never actually showed as recovered when the SR popups came up. However I think it's not attempting powered recovery due to loss of pilot.
Maybe something to do with pre-recovery?

The log isn't very clean. This happened after a few different other missions and tests. I'll run a clean log a bit later.

Here's the relevant portion of the log that I gathered this from:

[LOG 11:22:59.613] [SR] Vessel LR-EX2 is going to be destroyed. Recovering Kerbals!
[LOG 11:22:59.628] [SR] Pre-recovered Emilia Volvakova
[LOG 11:22:59.628] Packing LR-EX2 for orbit
[LOG 11:22:59.699] Vessel LR-EX2 was on-rails at 23.3 atm pressure and was destroyed.
[LOG 11:22:59.742] [SR] Searching in RecoveryQueue (0) for 222a63fe-6cf3-4d43-835b-ac5e612424a6
[LOG 11:22:59.742] [SR] Altitude: 10829.6079005431
[LOG 11:22:59.749] [SR] Vt: 10.85407
[LOG 11:22:59.755] [SR] Trying powered recovery
[LOG 11:22:59.755] [SR] No kerbal pilot found, searching for a probe core...
[LOG 11:22:59.756] [SR] No probe core with SAS found.
[LOG 11:22:59.756] [SR] Final Vt: 10.85407
[LOG 11:22:59.756] [SR] Distance: 96218.07
[LOG 11:22:59.756] [SR] Adding funds: 307.491760253906, New total: 106851.470224559

Craft File: http://www.filedropper.com/showdownload.php/lr-ex2

Link to comment
Share on other sites

Ah crap. I forgot to test powered recovery with pre-recovered kerbals. Try it with a probe core and it should work. I'll have to add in some code for pre-recovered kerbals. I might not get a chance to do that today.

 

Edit (12/29/2015): Small bugfix update to make powered recovery work with pre-recovered Kerbals. Should work properly now for you @amo28 but let me know if you see anything else weird. Sorry I didn't get to it sooner, the holidays has meant lots of travel and time with family.

Edited by magico13
Link to comment
Share on other sites

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