Snark

[1.8.x] AntennaSleep v1.1: "Snooze" button for deployable antennas so they don't get destroyed during reentry

Recommended Posts

What it does

  • Adds a “Sleep” button to the part menu of deployable antennas, whenever the antenna is open.
  • Pressing the button causes the antenna to retract… but it will then automatically re-extend a few minutes later, even if you have no control due to lack of communications.
  • Default sleep time is 5 minutes. A slider on the antenna’s menu lets you adjust how long it will sleep, in half-minute increments.
  • The antenna's menu displays a countdown timer while sleeping.

Download from SpaceDock
License: CC-BY-NC-ND 4.0
Source code

screenshot_small.png

 

How to install
Unzip into your GameData folder, same as any mod.  (Includes ModuleManager.)

 

Why would anyone want this?

If you’re playing KSP with the CommNet difficulty set to “Require communications for control”, this means that you completely lose control of your probe if it doesn’t have a communications link back to a control source such as KSC.

This can make things tricky if you’ve got a ship that needs to do aerobraking or atmospheric reentry somewhere far from Kerbin, if the antenna you use to control it is a deployable one.  If you don’t retract it, it will get destroyed by hypersonic winds.  If you do retract it, it’s safe… but now your probe is an inert doorstop.

This mod is intended to give you some interesting options for designing your probe.  You can put your antenna to sleep before hitting atmosphere, and it will wake up again later on to (hopefully) re-establish control.

How to use

menu.png

  • Use the slider on the menu to control how long the antenna will sleep. You can do this in the vehicle editor or in flight.
  • While in flight, press the “Sleep” button for an extended antenna to cause it to retract and stay retracted for the specified duration, after which it will automatically re-extend.
  • The menu displays a countdown timer while sleeping.
  • If you happen to still have control of the ship while the antenna's sleeping, you still have the ability to manually extend it, same as always (which will cancel the sleep).
Edited by Snark
Update to v1.1 (KSP 1.8 compatibility)

Share this post


Link to post
Share on other sites

Awesome! I've been wanting something like this for a while. Any chance there's an easy way to add this to RemoteTech parts? (MM patch or just .cfg edit)

Edit: May be a moot point, since the fate of RT seems to be in flux at the moment. :(

Edited by Jarin

Share this post


Link to post
Share on other sites
17 minutes ago, Jarin said:

Awesome! I've been wanting something like this for a while. Any chance there's an easy way to add this to RemoteTech parts? (MM patch or just .cfg edit)

Actually, you don't need it in RemoteTech.  RT has a programmable flight computer that lets you accomplish this same thing:

  1. Send a delayed-execution command to "extend antenna"
  2. Retract the antenna.

I always loved the careful "programmer's dance" I had to do with RemoteTech when approaching atmospheric reentry.  :)  The new CommNet feature in KSP 1.2 gives me most of what I liked about RemoteTech... except the one thing I missed, which was the ability to re-extend an antenna automatically.  That was basically the only thing I used the flight computer for in RT.

So, this mod was specifically prompted by wanting to make KSP's stock CommNet able to do that one thing.  I wasn't about to try to re-implement the RT flight computer in its majestic entirety!  But just doing this one, simple small thing was pretty easy.

That said:  I've implemented AntennaSleep such that the part module it uses to do its job will work on any part that uses a ModuleDeployablePart-derived class (e.g. ModuleDeployableAntenna) to work.  So, it should be easy to patch it to make it work with RT antennas, right?  (In case you want the convenience of a one-click antenna sleep, instead of complex fiddling with the flight computer.)

Alas, no.

Or rather, not trivially, at least not with the current version of RemoteTech.  It turns out that they don't use ModuleDeployableAntenna for their deployable antennas-- they just use ModuleAnimateGeneric, which means AntennaSleep won't handle it.

That's not to say it's a total showstopper-- for example, I expect I could put code into AntennaSleep to make it work with ModuleAnimateGeneric, or even perhaps patch the RemoteTech antennas to use ModuleDeployableAntenna instead of ModuleAnimateGeneric.

However, neither of those really feels like the best solution to me.  (Not necessarily bad, just not the best possible.)  What I'm hoping is that RT will update to use ModuleDeployableAntenna, and then an AntennaSleep patch for RT antennas would become trivial.

So anyway, here's the TL;DR summary:

  • It's possible for you to do this same thing in RemoteTech now with their flight computer, just not as conveniently.
  • If RT changes to use ModuleDeployableAntenna, then I'll add a simple/trivial patch to AntennaSleep to include RT antennas.  Would just take me a few minutes.
  • If RT doesn't do so... I may eventually implement a patch anyway, if folks really want it.  :)  But it's somewhat lower on my priority stack, so it could be a while before I get to something like that-- I've got work on other mods that would probably be higher priority than adding this.

Share this post


Link to post
Share on other sites

Are there other ModuleDeployablePart types this could be extended to? Solar panels would be the logical addition I think.

Share this post


Link to post
Share on other sites
5 hours ago, DocMop said:

Are there other ModuleDeployablePart types this could be extended to? Solar panels would be the logical addition I think.

Yes, which is why I implemented it in terms of ModuleDeployablePart instead of specifically ModuleDeployableAntenna, despite the fact that I'm only using it for antennas.  Anyone who wanted to expand it to other such parts would only need a snippet of ModuleManager config to do so.

I thought about adding it to other parts besides antennas, but pretty quickly decided, nope.  Here's why:

I hate UI.  I'm a firm proponent of the theory that "UI is bad, and less UI is better."  Oh, it's often necessary, but my philosophy is that there shouldn't be any more of it than there has to be, and it's worth putting design thought into a problem to figure out "how can one achieve more with less UI?" or, "is the added clutter of the extra UI worth the extra functionality?"

In the case of AntennaSleep behavior for non-antenna parts, I decided that (for me, at least), it's not worth the tradeoff.  I mean, sure, it would be possible to add a "sleep" functionality to deployable solar panels.  But why?  In the case of the antennas, it's serving a useful purpose by allowing a brief outage during a dangerous interval, and we need the "sleep" because otherwise there's no way to extend the antenna again.  But solar panels?  Why not just retract them, and then extend them manually a little later?  We have control, after all.  (And if we don't have control... there's not a lot of use in extending the panels.)  So it seemed of marginal utility to me... and there would be the added "cost" of putting additional UI clutter on the solar panels' menus.  For me, the "clutter cost" wasn't worth the functionality benefit for panels.

But for anyone who wants the functionality, though, it's easy to add via ModuleManager.

Share this post


Link to post
Share on other sites

Hey Snark. Been having a minor problem with your mod. Note that it may not be your mod that's at fault, it could just be vanilla KSP or a problem on my end.

I usually rotate the antennae so that they're not sticking out at a 90-degree angle when they're retracted. For some reason, this means that the antennae won't extend after the sleep period - the log says Can't wake Communotron 16 (can't currently move). In fact, even if the omni-antenna on my returning probe is in range and I have control, I still won't be able to extend an antenna until the probe is on the ground (it says 'Deploying would destroy part' or something).

Anyway, I'll keep testing it but I thought I would give you a heads-up.

Share this post


Link to post
Share on other sites
21 hours ago, MarvinKosh said:

Hey Snark. Been having a minor problem with your mod. Note that it may not be your mod that's at fault, it could just be vanilla KSP or a problem on my end.

I usually rotate the antennae so that they're not sticking out at a 90-degree angle when they're retracted. For some reason, this means that the antennae won't extend after the sleep period - the log says Can't wake Communotron 16 (can't currently move). In fact, even if the omni-antenna on my returning probe is in range and I have control, I still won't be able to extend an antenna until the probe is on the ground (it says 'Deploying would destroy part' or something).

Hm, interesting.  Hard for me to picture exactly what you mean by "rotate so they're not sticking out at a 90-degree angle when they're retracted"-- perhaps you could post a screenshot of your ship?  Without having a repro case there's no way for me to tell what's going on.

That said:  If you're having problems extending the antenna even without AntennaSleep itself-- i.e. just clicking the "Extend Antenna" button doesn't work-- then that's nothing to do with the mod, it's something about KSP itself.  So my guess is that this isn't an AntennaSleep bug.

Share this post


Link to post
Share on other sites

Hi, wanted to ask is there a possibility to add Antenna Sleep to a specific part rather then Module Name?

BoxSat mod witch uses patches to bring it up to current 1.2.1v  it's antennas wont recognize this mod.

Share this post


Link to post
Share on other sites
6 hours ago, dtoxic said:

Hi, wanted to ask is there a possibility to add Antenna Sleep to a specific part rather then Module Name?

BoxSat mod witch uses patches to bring it up to current 1.2.1v  it's antennas wont recognize this mod.

The answer is "maybe, depending on how BoxSat is implemented".  Do you have a link?

Technical details in spoiler section below, if you're interested.

Spoiler

So, I'm not sure how familiar you are with ModuleManager and how mods work, but here's the gist of it:

  • AntennaSleep creates a new kind of module, called ModuleDeployableSleep, which is what does the stuff that the module does.
  • ModuleDeployableSleep can be applied to any part that includes ModuleDeployableAntenna.  (Technically, it will work with any part that has a module that inherits from ModuleDeployablePart, of which ModuleDeployableAntenna is one.)
  • However, for this to happen (i.e. for the "sleep" behavior to show up on the part), there needs to be some config that adds a ModuleDeployableSleep to the part.

The reason that all the stock antennas get the sleep behavior when you install AntennaSleep is that I include some config with the mod that adds that module to all the stock antennas.  The reason you're not seeing it on the BoxSat mod is that AntennaSleep doesn't currently know anything about BoxSat and therefore doesn't include any config to add ModuleDeployableSleep to its antennas.

So, the main thing is to find out how BoxSat is implemented (which is why I asked you for the link, above).  Specifically, we need to know whether BoxSat antennas are actually implemented using ModuleDeployableAntenna.  If they are, then it will be easy to add some config to make them work with AntennaSleep.  If they aren't, then AntennaSleep simply won't work with that mod.

Once you've given me a link to the BoxSat mod, I can take a look at the config it uses, which will quickly answer the question about whether it's potentially compatible with AntennaSleep.

 

Share this post


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

The answer is "maybe, depending on how BoxSat is implemented".  Do you have a link?

Technical details in spoiler section below, if you're interested.

  Hide contents

So, I'm not sure how familiar you are with ModuleManager and how mods work, but here's the gist of it:

  • AntennaSleep creates a new kind of module, called ModuleDeployableSleep, which is what does the stuff that the module does.
  • ModuleDeployableSleep can be applied to any part that includes ModuleDeployableAntenna.  (Technically, it will work with any part that has a module that inherits from ModuleDeployablePart, of which ModuleDeployableAntenna is one.)
  • However, for this to happen (i.e. for the "sleep" behavior to show up on the part), there needs to be some config that adds a ModuleDeployableSleep to the part.

The reason that all the stock antennas get the sleep behavior when you install AntennaSleep is that I include some config with the mod that adds that module to all the stock antennas.  The reason you're not seeing it on the BoxSat mod is that AntennaSleep doesn't currently know anything about BoxSat and therefore doesn't include any config to add ModuleDeployableSleep to its antennas.

So, the main thing is to find out how BoxSat is implemented (which is why I asked you for the link, above).  Specifically, we need to know whether BoxSat antennas are actually implemented using ModuleDeployableAntenna.  If they are, then it will be easy to add some config to make them work with AntennaSleep.  If they aren't, then AntennaSleep simply won't work with that mod.

Once you've given me a link to the BoxSat mod, I can take a look at the config it uses, which will quickly answer the question about whether it's potentially compatible with AntennaSleep.

 

ModuleDeployableAntenna is implemented in Original BoxSat but the Patches i think use something different, not sure what @Deimos Rast can help here maybe, he created the Patches

Share this post


Link to post
Share on other sites

@Snark my repo is here, but I'm pretty sure in it's current form it won't work. I think @dtoxic might be incorrect, as ModuleDeployableAntenna is a 1.2 creation (or am I the one who is incorrect?) and BoxSat is from 1.0.4 (I don't have a copy in front of me at the moment though to check). The antennas use ModuleAnimateGeneric still, I didn't get around to looking at their pivots and such for the new deployable module. Suppose I should raise an issue about that....

 

https://github.com/deimos790/BoxSat_Continued

Share this post


Link to post
Share on other sites
2 minutes ago, Deimos Rast said:

@Snark my repo is here, but I'm pretty sure in it's current form it won't work. I think @dtoxic might be incorrect, as ModuleDeployableAntenna is a 1.2 creation (or am I the one who is incorrect?) and BoxSat is from 1.0.4 (I don't have a copy in front of me at the moment though to check). The antennas use ModuleAnimateGeneric still, I didn't get around to looking at their pivots and such for the new deployable module. Suppose I should raise an issue about that....

 

https://github.com/deimos790/BoxSat_Continued

Yeap you are right, looked at the wrong cfg! had like 8 open lol :D ModuleDeployableAntenna is present in your patch and not in the Boxsat pfff, my eyes have gone crazy, i have to take a nap :D 

Share this post


Link to post
Share on other sites

Hi everyone,

I've released v1.0.1 of AntennaSleep.

No new functionality.  This just fixes a bug that causes NullReferenceException to get spammed if a ModuleDeployableSleep (from this mod) ever gets added to a part that doesn't have a ModuleDeployablePart on it.  That doesn't affect you if you just install this mod... it mainly addresses the potential for hilarity in case some other mod adds a compatibility patch that tinkers with with things.  (Discovered the problem when I was writing the RemoteTech compatibility patch for JX2Antenna, which is a new mod by @steedcrugeon and me-- it adds a big 1000G antenna for large modded solar systems.)

So, unless you're getting a bunch of NullReferenceExceptions (which you probably aren't), you can view this as an "optional" update.

Share this post


Link to post
Share on other sites
On 10/12/2016 at 3:01 PM, DocMop said:

Are there other ModuleDeployablePart types this could be extended to? Solar panels would be the logical addition I think.

FWIW, MechJeb will automagically retract and then re-extend your solar panels for you. So that's another option.

Share this post


Link to post
Share on other sites
34 minutes ago, mikegarrison said:

FWIW, MechJeb will automagically retract and then re-extend your solar panels for you. So that's another option.

Well, sure!  But not an option for those of us who don't (and never will) use MechJeb.

Not that there's anything wrong with using MechJeb, for folks who enjoy it.  It simply happens not to be my personal cup of tea, for a variety of reasons, chief of which is that it would completely kill the parts of the game that are personally enjoyable for me.  Making MechJeb palatable to me would require rewriting it so that it has no UI and provides no autopilot features... but that would kinda defeat the purpose of it.  :wink:

So, I wrote this to be a simple, compact, lightweight, nearly-UI-less mod that will do exactly what I want it to do for my personal gameplay.  It does what I need it to do, and nothing else.

(As with all my mods:  I just mod for my personal enjoyment, so that the game will do what I want it to do.  Folks who like the same things that I happen to like, will get good use out of it.  Those who prefer MechJeb or other solutions-- well, more power to you!)

Share this post


Link to post
Share on other sites
3 hours ago, Snark said:

Well, sure!  But not an option for those of us who don't (and never will) use MechJeb.

Not that there's anything wrong with using MechJeb, for folks who enjoy it.  It simply happens not to be my personal cup of tea, for a variety of reasons, chief of which is that it would completely kill the parts of the game that are personally enjoyable for me.  Making MechJeb palatable to me would require rewriting it so that it has no UI and provides no autopilot features... but that would kinda defeat the purpose of it.  :wink:

So, I wrote this to be a simple, compact, lightweight, nearly-UI-less mod that will do exactly what I want it to do for my personal gameplay.  It does what I need it to do, and nothing else.

(As with all my mods:  I just mod for my personal enjoyment, so that the game will do what I want it to do.  Folks who like the same things that I happen to like, will get good use out of it.  Those who prefer MechJeb or other solutions-- well, more power to you!)

FWIW, I was answering the other question about solar panels. I already understood why you made this mod about antennas.

Share this post


Link to post
Share on other sites
1 minute ago, mikegarrison said:

FWIW, I was answering the other question about solar panels. I already understood why you made this mod about antennas.

Ah, okay, makes sense.  :)

Share this post


Link to post
Share on other sites

Hi all,

I've released v1.0.2 of AntennaSleep.  No new features, this is just an update for KSP 1.3 compatibility.

The main thing that's changed is that it's now bundled with the newest version of ModuleManager, 2.8.0, so that it'll work with KSP 1.3.

One other change is that I've updated it to target .NET framework version 3.5, as a KSP mod is supposed to.  Previously it was targeting 4.5.2.  (This change is of interest only to modders who might be adding assembly references to this mod.  It has basically zero effect on players.)

Enjoy!

Share this post


Link to post
Share on other sites

Updated mod to v1.0.3.  No new features, just a minor update for KSP 1.4.1 compatibility, including moving to ModuleManager v3.0.6.

Share this post


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

I'm back after a long winter (waiting for the last updates), is this mod still needed on KSP 1.4.5?

Yep, it's fine.

SpaceDock was a bit slow in updating to allow marking things as 1.4.5-compatible, so I was slow off the mark in updating, here.  I see that they've rectified that omission, so I've marked the thread accordingly.

Share this post


Link to post
Share on other sites

I'm so glad this got bumped, it fixes a need I hadn't even realised I had. Brilliant!

Share this post


Link to post
Share on other sites

Just found this, and thank you!
This mod should be stock, without a doubt.

Share this post


Link to post
Share on other sites

Hi gang,

Just a note that I've released AntennaSleep v1.1.  No new features, just a compatibility update for KSP 1.8.

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.