Papa_Joe

[1.4.x] Orbital Decay - Resumed v1.6.1.1, 04 Jun 2018

Recommended Posts

KSP Orbital Decay - Resumed!

Note:  Due to the prolonged absence of @Whitecat106, I took it upon myself to revive this mod.  I have attempted to contact @Whitecat106 to inform him of my intentions.  Since the license allows it, Here we are.  I make no promises as to how much I can expand on this mod, but @Whitecat106 did leave a bit of info in his original thread about the direction he was heading.  If you have ideas, please share, and code contributions are welcome.

_____________________________________________________________________________________
Original Author @Whitecat106
Original Thread:  Original Orbital Decay thread

Current Maintainer:  @Papa_Joe
_____________________________________________________________________________________

From Whitecat:

Introduction

Hello everyone, Whitecat106 here creator of the Historic Missions Contract Pack and I wish to share with you the release version of my new project. I have been working on this for quite a while and can now release this mod after I finally had a break through in the code - as a result of months of tinkering! Some mods in the past have come so close to this but none actually produced a viable working version... well until now...

What does it do?

  • On rails and off rails orbital decay for any vessel around any celestial body, this decay is determined by various factors, such as atmospheric drag, radiation pressure drag and more!
  • Estimated impact times are given for each vessel.
  • Station Keeping for active and non active vessels. Supports all KSP Resources.
  • UI interface for predicted decay times and vessel information.
  • The above work during time-warp!

Initial Dev Video:

https://www.youtube.com/watch?v=CoeHIbgr-wo

* Note this video shows the V0.0.1 Dev version, the features of this Release version differ slightly.

Notes:

For information on how to use the mod check out the wiki below!

Orbital Decay Wiki :             | Wiki |

Known Incompatibilities: (Major, Minor)

- RSS Extrasolar - Sagitarius A* causes problems with the coding of the mod, use at your own risk. Similarly other 'galactic core mods' may cause problems - To be fixed in 1.6.0

- Mechjeb autopilot can fail when nearly reaching a set altitude due to drag reducing the actual altitude - Fix in 1.6.0, other autopilot mods may be effected.

Download:

GitHub:  | Download |  

-- Please Backup Your Saves, this is a work in progress!  Also be sure to completely delete the existing WhitecatIndustries folder inside your GameData folder before you install this mod and Solar Cycle Industries.  Significant changes to the structure of both of these mods have been made when Papa_Joe adopted them.  This is a best practice with mods in any case, but is especially important now. 

-- After deleting the WhitecatIndustries folder, you can then install Orbital Decay and Solar Cycle Simulator in any order.  both mods are subfolders of the WhitecatIndustries folder.

-- PLEASE NOTE: You must disable the  ORBIT_DRIFT_COMPENSATION = True  In the KSP settings.cfg file otherwise orbits will no longer decay as of KSP 1.1.3, a fix for this on the way! Just change 'True' to 'False'  This is an old notice, so if you test with the ORBIT_DRIFT_COMPENSATION set to true ad it works, please let me know!

Source Code:

GitHub:  | Source |

Required dependencies:  (you must download these, they are not included with this mod)

  • Module Manager (not included):  This allows Orbital Decay to add a module to your vessels to enable the decay features.
  • Solar Cycle Simulator (Not included)  This enables Orbital decay to acquire information on solar radiation factors.  Please not that this was originally included with the mod but is now separate.

This mod now includes a version file and supports KSP-AVC  

Special Thanks:

- @ZAJC3W for the complete reworking of the station keeping / resource system! and for recompiling to keep the mod going through KSP 1.3.1.
- @Maeyanie for a recompiled dll to support KSP 1.4.2 with a couple of bug fixes.  I have incorporated those fixes into this version of Orbital Decay.
- Everyone who has provided encouragement and has helped find bugs and report them!

License:

This code is licensed under the Attribution-NonCommercial-ShareAlike 3.0 (CC BY-NC-SA 3.0) creative commons license.  License file here

Enjoy! 


Edited by Papa_Joe
new version - bug fixes

Share this post


Link to post
Share on other sites

What does RealisticDecay in GameData\WhitecatIndustries\OrbitalDecay\plugins\PluginData\Settings.cfg actually change?

Share this post


Link to post
Share on other sites

there is a stock Decay method and a realistic decay method.  I've not dived into them in any detail yet, but this mod is designed to be used with the stock game and RSS/RO, so my first guess is it is to enable support for RSS/RO.

 

Share this post


Link to post
Share on other sites

@Papa_Joe A bummer question:

If the orbiting debris is in a high decay state and is just a spent stage with armed parachutes, under stock circumstances it would be on rails forever ...
So loading it into flight mode would be needed, at least to get the periapsis below 20 km, then a switch to another vessel would be enough (if possible, depends if it's already in atmosphere - which depends if the debris got control and some EC and fuel left to lower the periapsis).

But now, it could be recovered by Stage Recovery, right?

Normally this only works in flight mode, but with Orbital Decay it could also be triggered when anywhere else than in flight mode - I hope.

Could this "just" be done by Orbital Decay or does Stage Recovery also have to support this feature? @magico13

Edited by Gordon Dry

Share this post


Link to post
Share on other sites

@Papa_Joe Bug! I was not able to open an issue on Github, so I post it here:

NullReferenceException: Object reference not set to an instance of an object
  at WhitecatIndustries.Source.Settings.ReadRD () [0x00000] in <filename unknown>:0 
  at WhitecatIndustries.Source.UserInterface.InformationTab () [0x00000] in <filename unknown>:0 
  at WhitecatIndustries.Source.UserInterface.MainWindow (Int32 windowID) [0x00000] in <filename unknown>:0 
  at UnityEngine.GUILayout+LayoutedWindow.DoWindow (Int32 windowID) [0x00000] in <filename unknown>:0 
  at UnityEngine.GUI.CallWindowDelegate (UnityEngine.WindowFunction func, Int32 id, Int32 instanceID, UnityEngine.GUISkin _skin, Int32 forceRect, Single width, Single height, UnityEngine.GUIStyle style) [0x00000] in <filename unknown>:0 
 
(Filename:  Line: -1)

GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced)
 
(Filename:  Line: 504)

In Tracking Station, the icon is a white square, clicking it shows this unresponsive and empty UI:
o1bUsgf.png

Full log:
https://www.dropbox.com/s/1vzl5akfc0h1l0c/2018-06-04_1 KSP.log.7z?dl=1

Share this post


Link to post
Share on other sites
Just now, Gordon Dry said:

@Papa_Joe Bug! I was not able to open an issue on Github, so I post it here:


NullReferenceException: Object reference not set to an instance of an object
  at WhitecatIndustries.Source.Settings.ReadRD () [0x00000] in <filename unknown>:0 
  at WhitecatIndustries.Source.UserInterface.InformationTab () [0x00000] in <filename unknown>:0 
  at WhitecatIndustries.Source.UserInterface.MainWindow (Int32 windowID) [0x00000] in <filename unknown>:0 
  at UnityEngine.GUILayout+LayoutedWindow.DoWindow (Int32 windowID) [0x00000] in <filename unknown>:0 
  at UnityEngine.GUI.CallWindowDelegate (UnityEngine.WindowFunction func, Int32 id, Int32 instanceID, UnityEngine.GUISkin _skin, Int32 forceRect, Single width, Single height, UnityEngine.GUIStyle style) [0x00000] in <filename unknown>:0 
 
(Filename:  Line: -1)

GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced)
 
(Filename:  Line: 504)

In Tracking Station, the icon is a white square, clicking it shows this unresponsive and empty UI:
o1bUsgf.png

Full log:
https://www.dropbox.com/s/1vzl5akfc0h1l0c/2018-06-04_1 KSP.log.7z?dl=1

Thanks!  I'm certain there were bugs in the app when I took it over.  The previous thread alluded to that.  I'll take a look.  Thanks for the log!

Share this post


Link to post
Share on other sites

New version to fix some bugs.

Version 1.6.1.1
 - Bug fixes for bad path names to config files after Project reorg
 - Clean up disallowed constructor var assignments due to Unity version change.
 - Correct url errors in version file
 

Share this post


Link to post
Share on other sites

@Papa_Joe 1.6.1.1 is in the repo, but not in the releases (and no dll in the repo) :P

Edited by Gordon Dry

Share this post


Link to post
Share on other sites
1 hour ago, Gordon Dry said:

@Papa_Joe 1.6.1.1 is in the repo, but not in the releases (and no dll in the repo) :P

LOL!  Helps if you actually press the release button! :P   Release is Published.

Share this post


Link to post
Share on other sites
15 hours ago, Gordon Dry said:

Could this "just" be done by Orbital Decay or does Stage Recovery also have to support this feature?

In theory StageRecovery should be able to handle this as-is but I'd definitely recommend testing it. Occasionally the information missing in non-flight scenes can cause issues with StageRecovery but it should be able to handle it. If you notice any issues with it feel free to mention them on the StageRecovery thread.

Share this post


Link to post
Share on other sites

@Papa_Joe @magico13 so I installed it, testing ORBIT_DRIFT_COMPENSATION = True.

There is a part of debris that has a decay rate of 1.6 km / day and should decay in 4 hours, let's see how it goes ... when my actual maneuver is done I will switch to it and see what exactly it is, it's "old" ... (Gemini 1 debris).

Edit:

Hmm, after checking its orbit in the Tracking Station to make sure it's not already in atmosphere before I switch to it I got these parameters:

  • apogee 94 km
  • perigee 92 km

So I switched to it and now it says:

  • decay rate 195 m / day
  • approx decay in 5.4 days

 

  1. What could be the reason for a change like this?
  2. Is it necessary for Orbital Decay to have each part loaded in flight mode at least once to have a proper calculation?

It seems that 2. is the case because I added the mod mid-game, that would mean on staging away something the values will be properly calculated when it happens.

Edit:

I would like to have a toggle in the Orbital Decay Manager to show only the actually loaded vessel, not to scroll down the lists on every attempt.

Edit:

Another request: sorting by name (should do it on default) and by parent body

20 hours ago, Papa_Joe said:

- Mechjeb autopilot can fail when nearly reaching a set altitude due to drag reducing the actual altitude - Fix in 1.6.0, other autopilot mods may be effected.

Yeah, I just got this while focusing an orbiting relay sat that has to circularize later (is on resonant orbit):

MechJeb module MechJebModuleAttitudeController threw an exception in OnFixedUpdate: System.NullReferenceException: Object reference not set to an instance of an object
  at MuMech.MechJebModuleAttitudeController.attitudeGetReferenceRotation (AttitudeReference reference) [0x00000] in <filename unknown>:0 
  at MuMech.MechJebModuleAttitudeController.attitudeAngleFromTarget () [0x00000] in <filename unknown>:0 
  at MuMech.MechJebModuleAttitudeController.OnFixedUpdate () [0x00000] in <filename unknown>:0 
  at MuMech.MechJebCore.FixedUpdate () [0x00000] in <filename unknown>:0 
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

Going back to SPC and loading the vessel again and this issue was gone.

Edited by Gordon Dry

Share this post


Link to post
Share on other sites

@Papa_Joe Do you know what? This mod has a nice byeffect:

The still existing orbital-changes-on-warp issue in low orbit or suborbital trajectory seems to be gone since I installed it!

Share this post


Link to post
Share on other sites

@Papa_Joe Now finally a piece of debris that was not only a decoupler decayed (also Gemini 1) and I got the message from StageRecovery that it was destroyed.

Because it came from StageRecovery it makes me hope that I will see a decaying stage with chutes recovered next.

Share this post


Link to post
Share on other sites

Hey @Papa_Joe I wonder how you mod would interact with an extreme part like solarsails

daiOHu3.png

Would it take into account its surface and angle towards orbital path? Or should I implement my own orbital decay?

Edited by FreeThinker

Share this post


Link to post
Share on other sites

@Papa_Joe Oh well, now I had a bad by-effect.

I guess it was Orbital Decay because I never had something like that happening before.

First glance, this tiny snippet of the log:

Packing Corona 1 station for orbit
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

ObT : NaN
M : NaN
E : NaN
V : NaN
Radius: NaN
vel: [NaN, NaN, NaN]
AN: [1798310.54544342, -87536.8377587473, 0]
period: Infinity

 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

[OrbitDriver Warning!]: Corona 1 station had a NaN Orbit and was removed.
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

Corona 1 station Unloaded
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

[OrbitDriver]: On-Rails SOI Transition from Kerbin to Sun.
 Transition UT Range: 14647253.374 - 14647253.394.
 Transition UT: 14647253.394. Iterations: 24.
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

[SpaceAge] OnSOIChanged(<'Kerbin', 'Sun', 'Corona 1 station'>)
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

[SpaceAge] Constructing SOIChange event with 4 params.
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

[SpaceAge] This is a return from a child body to its parent's SOI, therefore no SOIChange achievement here.
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

FF: ribbon achievement (vessel state):
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)

+ name: Sun Sphere of Influence

I just loaded the vessel, as soon as the loading finished I've seen some explosions and only the command pod was left - it was on top of the station (it was a core module).
(It already had station keeping enabled)

Log and vessel and save:
https://www.dropbox.com/s/401iczlwf57zxsg/2018-06-08_1 KSP.log.7z?dl=1

 

Edit:

btw I loaded the vessel using KAC (there was a maneuver scheduled later, so I clicked the entry and chose "Jump to vessel".

As I loaded the KAC backup save and loaded the vessel via Tracking Station this time, it did not explode, but it's misaligned near the decoupler between pod and station.

Spoiler

Cd2VwLd.png

I updated the Dropbox archive with the increased log.

I loaded the backup save again, exited the game and will try it again with
ORBIT_DRIFT_COMPENSATION = False

ORBIT_DRIFT_COMPENSATION = True (darn, I already had changed it to False yesterday).

 

Edit:

Or could it even be that it was my fault because I placed a decoupler on top of a docking port?
I did that because using already-docked vessels on launch always was prone to wobble for me when not using extra struts.

Edited by Gordon Dry

Share this post


Link to post
Share on other sites

No way, changing to ORBIT_DRIFT_COMPENSATION = True didn't help, now it also exploded when loading via Tracking Station ...

I will try to recover the crew, scrap that thing and change it in VAB so that no decoupler is next to a docking port.

Perhaps this helps.

Edit:

I will do something else before, because now it always explodes ... I will remove this mod:

It could be that it fights with Orbital Decay on scene load somehow... I will see.

Edit:

@whale_2 @Papa_Joe that helped - but now I have to load an abandoned Minmus lander to see what the removal of World Stabilizer could have as consequences ...

Edited by Gordon Dry

Share this post


Link to post
Share on other sites
2 hours ago, Gordon Dry said:

No way, changing to ORBIT_DRIFT_COMPENSATION = True didn't help, now it also exploded when loading via Tracking Station ...

I will try to recover the crew, scrap that thing and change it in VAB so that no decoupler is next to a docking port.

Perhaps this helps.

Edit:

I will do something else before, because now it always explodes ... I will remove this mod:

It could be that it fights with Orbital Decay on scene load somehow... I will see.

Edit:

@whale_2 @Papa_Joe that helped - but now I have to load an abandoned Minmus lander to see what the removal of World Stabilizer could have as consequences ...

One of the changes to KSP 1.4.3 was some improvements to the physics on load and when a vessel goes off rails.  I don't think it is completely corrected, but I do know it has become less of an issue.  As a result, I have not seen as much of a need for World Stabilizer.

 

Edited by Papa_Joe

Share this post


Link to post
Share on other sites
23 minutes ago, Papa_Joe said:

As a result, I have not seen as much of a need for World Stabilizer.

I still used it because "I heard" that it could still be useful in some cases.

Now, after I removed it I also was able to load the lander on Minmus without issues.

But - and I don't know what is the culprit - after I loaded the problematic station a second time the area around the decoupler / docking node was tilted/offset again.
No explosion at least.

So I guess my clue about the "decoupler never put next to a docking port" could be true.

To find out I have to stage away the pod and see it it works, or if it explodes then ...

Share this post


Link to post
Share on other sites
On 6/4/2018 at 7:18 PM, Papa_Joe said:

On rails and off rails orbital decay for any vessel

Does this also apply to asteroids?

Share this post


Link to post
Share on other sites
8 minutes ago, Drew Kerman said:

Does this also apply to asteroids?

Yes. You can nerf them up with RCS and then you can set them up to "station keeping" as well.

Share this post


Link to post
Share on other sites
2 hours ago, Gordon Dry said:

Yes. You can nerf them up with RCS and then you can set them up to "station keeping" as well.

why? That kind of defeats the purpose

Nevermind that - I suppose you're just saying it's a thing that is possible to do. I mean, I won't do it but good to know it can be done

Edited by Drew Kerman

Share this post


Link to post
Share on other sites

Update, see bottom

Spoiler

 

@Papa_Joe After I started fiddling with this:

which happened after I added the unofficial FAR:

I have this problem now - and I don't see the link. I did NOT have this problem after adding FAR, before I added my patch.

The problem:


NullReferenceException: Object reference not set to an instance of an object
  at WhitecatIndustries.Source.StationKeepingManager.EngineCheck (.Vessel vessel) [0x00000] in <filename unknown>:0 
  at WhitecatIndustries.Source.StationKeepingManager.FuelManager (.Vessel vessel) [0x00000] in <filename unknown>:0 
  at WhitecatIndustries.Source.DecayManager.FixedUpdate () [0x00000] in <filename unknown>:0 
 
(Filename:  Line: -1)

written to the log here and there, sometimes as some spam, sometimes solely.

I tried to launch a rocket, the first stage failed to ignite, but all following stages did ignite.

The full log (and the vessel):
https://www.dropbox.com/s/iqp8dias4x9wdrr/2018-06-16_1 KSP.log.7z?dl=1

 

Update:

Well, easy like that, I had to take the vessel back to VAB (I use KCT) and just replace the heatshield with a brand new one - et voilá now it works ...

Edited by Gordon Dry

Share this post


Link to post
Share on other sites

@Papa_Joe So, the issue is not really solved.

One specific vessel; I was able to disable station keeping in the VAB, but not reenable it.

NullReferenceException: Object reference not set to an instance of an object
  at WhitecatIndustries.Source.StationKeepingManager.EngineCheck (.Vessel vessel) [0x00000] in <filename unknown>:0 
  at WhitecatIndustries.Source.UserInterface.InformationTab () [0x00000] in <filename unknown>:0 
  at WhitecatIndustries.Source.UserInterface.MainWindow (Int32 windowID) [0x00000] in <filename unknown>:0 
  at UnityEngine.GUILayout+LayoutedWindow.DoWindow (Int32 windowID) [0x00000] in <filename unknown>:0 
  at UnityEngine.GUI.CallWindowDelegate (UnityEngine.WindowFunction func, Int32 id, Int32 instanceID, UnityEngine.GUISkin _skin, Int32 forceRect, Single width, Single height, UnityEngine.GUIStyle style) [0x00000] in <filename unknown>:0 
 
(Filename:  Line: -1)

After I loaded the vessel I was able to enable it, also the Orbital Decay Manager showed the changed status.

Log and that specific vessel (the upper stage still attached):
https://www.dropbox.com/s/w19gwqky3e2vc91/2018-06-16_2 KSP.log.7z?dl=1

Share this post


Link to post
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.