Sarahleth

Solar Panel Auto-Deployment/Retract

Recommended Posts

I am wondering if there's a way to make solar panels deploy automatically (or retract automatically) when my current electric charge storage reaches a certain point. I've not found any mods that can do this nor any in game way but if someone can point me in the correct direction etc then i would be very much grateful.

Edited by Sarahleth

Share this post


Link to post
Share on other sites

Hello, and welcome to the forums!  :)

Moving to Add-on Discussion, since the tech support forum is for "my game is broken, how do I fix it" type of questions.

As to your actual question,

2 minutes ago, Sarahleth said:

I am wondering if there's a way to make solar panels deploy automatically when my current electric charge storage reaches a certain point.

...I don't know of any myself (sorry I can't be more helpful there), but I'm kinda curious about the gameplay reasons why you need this.  Why not just deploy the panels as soon as you're out of atmosphere, and just leave them deployed?

(i.e. what was your reason for not having them deployed already anyway?  why wait until the EC gets low?)

Share this post


Link to post
Share on other sites
4 minutes ago, Snark said:

Hello, and welcome to the forums!  :)

Moving to Add-on Discussion, since the tech support forum is for "my game is broken, how do I fix it" type of questions.

As to your actual question,

...I don't know of any myself (sorry I can't be more helpful there), but I'm kinda curious about the gameplay reasons why you need this.  Why not just deploy the panels as soon as you're out of atmosphere, and just leave them deployed?

(i.e. what was your reason for not having them deployed already anyway?  why wait until the EC gets low?)

Ah thanks. And i need them to auto deploy because i am using mechjeb's roverautopilot and i want to leave my game whilst it moves the rovers; and so i want the solar panels to autodeploy once the rover has run out of power so it can recharge and then mechjeb will start driving it again. Sorry if that was badly explained.

Edited by Sarahleth

Share this post


Link to post
Share on other sites
4 minutes ago, Sarahleth said:

i am using mechjeb's roverautopilot and i want to leave my game whilst it moves the rovers; and so i want the solar panels to autodeploy once the rover has run out of power so it can recharge and then mechjeb will start driving it again.

...so why not just deploy the panels before you walk away from your computer, i.e. before MechJeb starts driving the rover, and just leave them open?

(Sorry if I'm dense and there's some good reason that would be obvious to any MechJeb user-- I never use it myself.)

Share this post


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

...so why not just deploy the panels before you walk away from your computer, i.e. before MechJeb starts driving the rover, and just leave them open?

(Sorry if I'm dense and there's some good reason that would be obvious to any MechJeb user-- I never use it myself.)

Because the dynamic atmospheric pressure (Q) would be too high and the solar panels would collapse. (The rovers on kerbin, i forgot to mention that.)

Share this post


Link to post
Share on other sites

On a side note, it would be kinda cool to have a scripting language for autonomous rovers...

Share this post


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

Because the dynamic atmospheric pressure (Q) would be too high and the solar panels would collapse. (The rovers on kerbin, i forgot to mention that.)

But in that case, how would the auto-extend feature help you?  Because as soon as it's restored any electric power to the rover at all, wouldn't MechJeb go ahead and start driving the rover anyway, with the panels still extended, causing them to get ripped off anyway?

(again, please excuse my MechJeb ignorance)

Share this post


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

On a side note, it would be kinda cool to have a scripting language for autonomous rovers...

As a hobbyist programmer i have already wished apon a star for this feature.

Share this post


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

As a hobbyist programmer i have already wished apon a star for this feature.

does kOS not fit the bill?  (Haven't ever used it myself, but I gather that it's the go-to choice for automated scripting of KSP craft.)

Share this post


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

But in that case, how would the auto-extend feature help you?  Because as soon as it's restored any electric power to the rover at all, wouldn't MechJeb go ahead and start driving the rover anyway, with the panels still extended, causing them to get ripped off anyway?

(again, please excuse my MechJeb ignorance)

No because mechjeb has a feature that it warps to the next day if you run out of electric charge, but there is a delay so there'd be time to auto deploy the solar panel.

Just now, Snark said:

does kOS not fit the bill?  (Haven't ever used it myself, but I gather that it's the go-to choice for automated scripting of KSP craft.)

I've heard of kOS but not yet dabbled with it.

Share this post


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

No because mechjeb has a feature that it warps to the next day if you run out of electric charge, but there is a delay so there'd be time to auto deploy the solar panel.

But would that even work?  I don't know how MechJeb does that auto-warp feature, but given that "next day" is several hours, I assume it's regular warp and not physics warp.  Which means nothing physical can happen during that interval.  Which I assume means that it wouldn't be able to deploy the solar panels during the warp.  And as soon as the warp ends and it's the next day and it can extend the panels, wouldn't MJ then start driving and rip the panels off?

Share this post


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

But would that even work?  I don't know how MechJeb does that auto-warp feature, but given that "next day" is several hours, I assume it's regular warp and not physics warp.  Which means nothing physical can happen during that interval.  Which I assume means that it wouldn't be able to deploy the solar panels during the warp.  And as soon as the warp ends and it's the next day and it can extend the panels, wouldn't MJ then start driving and rip the panels off?

Well what happens is that as power lowers the rover's speed lowers so at that point i could set the solar panels to deploy and then electric would run out and mechjeb would warp

you can see the option in the image: d2cd12456fd330b94540b27a554fa2b3.png
https://gyazo.com/d2cd12456fd330b94540b27a554fa2b3

Edited by Sarahleth

Share this post


Link to post
Share on other sites
5 minutes ago, Sarahleth said:

Well what happens is that as power lowers the rover's speed lowers so at that point i could set the solar panels to deploy and then electric would run out and mechjeb would warp

Still not following.  Even with that option, how does it recover without ripping off the panels?  As soon as the panels deploy (whether it's before or after MJ warps to the next day), it's going to charge up the rover, yes?  Which means MJ no longer has any reason to brake, and will just go full speed ahead with the panels still deployed, yes?  Which will rip them off?

Would it not solve the whole problem by just using non-deployable solar panels that are always on and can keep the rover charged even while it's rolling?

Share this post


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

Still not following.  Even with that option, how does it recover without ripping off the panels?  As soon as the panels deploy (whether it's before or after MJ warps to the next day), it's going to charge up the rover, yes?  Which means MJ no longer has any reason to brake, and will just go full speed ahead with the panels still deployed, yes?  Which will rip them off?

Would it not solve the whole problem by just using non-deployable solar panels that are always on and can keep the rover charged even while it's rolling?

Yes non-deployables would work. But mechjeb doesn't stop time warping untill the next day, and hopfully any mod or kOS or whatever i used to auto deploy the panels would also be able to retract them afterwards.

Share this post


Link to post
Share on other sites
3 minutes ago, Sarahleth said:

would also be able to retract them afterwards

^ Okay, so that's a pretty important requirement.  It's not, "I need a mod that extends panels" but also "that retracts them".  Might want to call that out in your OP:wink:

Anyway, thanks for the clarification, and I'll stop hijacking your thread now.  :)

It would be a pretty straightforward mod to create something like that (the code would be fairly simple), so I wouldn't be surprised if something like that exists.  I could imagine other useful scenarios for such a mod (e.g. "I've got a reentering spacecraft.  Auto-retract any deployable things when the dynamic pressure starts approaching the danger point.")  If there is such a mod, hopefully someone will chime in here.

  • Like 1

Share this post


Link to post
Share on other sites
25 minutes ago, Snark said:

does kOS not fit the bill?  (Haven't ever used it myself, but I gather that it's the go-to choice for automated scripting of KSP craft.)

I have only briefly glanced at it...

But if it's a true scripter language for KSP craft, with ability to perform actions based on events, then would it not be the recommended tool in this case?  ...or does it lack the ability to perform actions based on events?   ...perform an action based on elapsed time may also suffice.

Edited by XLjedi

Share this post


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

^ Okay, so that's a pretty important requirement.  It's not, "I need a mod that extends panels" but also "that retracts them".  Might want to call that out in your OP:wink:

Anyway, thanks for the clarification, and I'll stop hijacking your thread now.  :)

It would be a pretty straightforward mod to create something like that (the code would be fairly simple), so I wouldn't be surprised if something like that exists.  I could imagine other useful scenarios for such a mod (e.g. "I've got a reentering spacecraft.  Auto-retract any deployable things when the dynamic pressure starts approaching the danger point.")  If there is such a mod, hopefully someone will chime in here.

Thanks i'll edit the origional post in a sec. And yeah i'm sure that there's some mod out there that's just hard to find that already does this. I'm almost considering doing it myself.

  • Like 1

Share this post


Link to post
Share on other sites
5 minutes ago, Sarahleth said:

I'm almost considering doing it myself.

That would be great!  :D

If you do decide to make one yourself, might I suggest the following?

  • Make it apply to anything deployable, not just solar panels.
  • Don't make it specifically tied to anything like "running out of electricity".  Have it based solely on "dangerous dynamic pressure."
  • It would just retract the deployable thing when the situation is getting dangerous, and extend the deployable thing when the situation appears to be safe.
  • "Dangerous" means "over the dynamic pressure limit, or else close to it and rising".  "Safe" means "under the limit, and not trending upwards".  With user-selectable thresholds so they can tune it (i.e. how far under the limit the threshold is, and what rate of change).

With something like that, it would be broadly useful in lots of situations.  In your own case, it would cause it to extend the solar panels when the rover's going slow, and retract them when it's going fast, which is really what you care about anyway, yes?

Share this post


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

That would be great!  :D

If you do decide to make one yourself, might I suggest the following?

  • Make it apply to anything deployable, not just solar panels.
  • Don't make it specifically tied to anything like "running out of electricity".  Have it based solely on "dangerous dynamic pressure."
  • It would just retract the deployable thing when the situation is getting dangerous, and extend the deployable thing when the situation appears to be safe.
  • "Dangerous" means "over the dynamic pressure limit, or else close to it and rising".  "Safe" means "under the limit, and not trending upwards".  With user-selectable thresholds so they can tune it (i.e. how far under the limit the threshold is, and what rate of change).

With something like that, it would be broadly useful to everyone in a whole lot of situations.  In your own case, it would cause it to extend the solar panels when the rover's going slow, and retract them when it's going fast, which is really what you care about anyway, yes?

Yeah that sounds like a great idea. I'm pretty sure i'll get around to trying that. I've only looked at the making of mods in ksp a little bit though. And though i do mod in other games quite a bit i've still got a bit to learn about making mods in ksp before i can make it work a nice and things.

  • Like 1

Share this post


Link to post
Share on other sites

I think you could probably work out something with Smart Parts:

I'm not sure you could check EC level, but you could do speed or something else I think.  Then bind all the solar panels to an action group and have it get fired.

Share this post


Link to post
Share on other sites
30 minutes ago, DStaal said:

I think you could probably work out something with Smart Parts:

I'm not sure you could check EC level, but you could do speed or something else I think.  Then bind all the solar panels to an action group and have it get fired.

Come to think of it...  if it's tied to an action group, and triggers based on elapsed time, this is even something that can be done with a programmable keyboard/joystick button macro.

Share this post


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

I'm pretty sure i'll get around to trying that. I've only looked at the making of mods in ksp a little bit though. And though i do mod in other games quite a bit i've still got a bit to learn about making mods in ksp before i can make it work a nice and things.

(thumbsup)

  • The good news:  KSP is pretty easy to mod
  • The bad news:  ...but documentation is spotty, very sparse, and often out of date
  • The good news:  ...but there are lots and lots of examples to work from, since every mod is required to post a link to its source code
  • The bad news: ...but sometimes it can be hard to find a mod that does something similar enough to what you're doing that you can imitate it
  • The good news: ...but there's a large and active community of KSP modders, and they generally tend to be very friendly / helpful / informative / knowledgeable, and there's a good place to post questions to them when you get stuck.

So, on the whole, good news wins.  :)

My own experience as a modder has been that it's usually a pain in the posterior to figure out "how do I do X?" ... but once it's actually figured out, the code to "do X" usually turns out to be simple and straightforward.  So the moral of the story is, expect to have to do a lot of googling and head-scratching and asking questions up front, but the actual coding tends to be not too bad once you get it figured out.

Share this post


Link to post
Share on other sites

KOS and Smart Parts
can work
i use both of them to do similar things
 

15 hours ago, Sarahleth said:

dynamic atmospheric pressure (Q) would be too high

?!?!?!?!
how fast is you rover going?
i see 30 in the pic. is that inaf to break the panels?
did you try smaller panels?

Edited by danielboro

Share this post


Link to post
Share on other sites
18 minutes ago, danielboro said:

KOS and Smart Parts
can work
i use both of them to do similar things
 

?!?!?!?!
how fast is you rover going?
i see 30 in the pic. is that inaf to break the panels?
did you try smaller panels?

My rover tends to average 30 m/s whilst it's being controlled by mechjeb, because i set it to that because i don't trust it with grater speeds. I've not tested if that speed can rip them off but the problem is that with quick inclinations and other things on the terrain it can raise the g force which i know for a fact is enough to rip them right off.

Share this post


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

My rover tends to average 30 m/s whilst it's being controlled by mechjeb, because i set it to that because i don't trust it with grater speeds. I've not tested if that speed can rip them off but the problem is that with quick inclinations and other things on the terrain it can raise the g force which i know for a fact is enough to rip them right off.

i personally wold have used a kos script that will deploy panels if speed is less then 10 else retract

until 0 {
if SHIP:VELOCITY:SURFACE:MAG<10 panels on. else panels off.
wait 0.
}

Edited by danielboro
  • Like 2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now