Jump to content

[1.3](Jun04/17) Automate Vertical Velocity and Altitude Control


Diazo

Recommended Posts

Version 1.20

Download here.

-Fix PartModule OnState method that could save the wrong vessel.

(No changes visible to player.)

@brusura: Okay, the issue turned out to be not as complex as I'd feared, this version should get you going.

Let me know if anything else crops up.

D.

Link to comment
Share on other sites

Version 1.21

Download here.

-KSP 1.0.3 Recompile.

-Compatibility with the ModActions mod.

-KSP 1.0.4 update also, works fine and I'm not releasing 3 versions in 3 days.

Alright, Squad surprised me with KSP version 1.0.3 so here's updates 2 days in a row. No player visible changes here, more of a maintenance release.

D.

Edited by Diazo
Link to comment
Share on other sites

Just a heads up that the ModActions mod linked in my previous post now supports this mod and you can control it by Action Group.

If I've missed something you'd like to be able to control this way, please let me know and I will see about getting it added.

D.

Link to comment
Share on other sites

Diazo, This mod is a life saver! I built a V-22 osprey a while back with two different deployable century guns. with this and horizontal control I can now make it hold a stable position for an extended period of time while manipulating the guns. A question I have is (and please forgive me if this was already asked I didn't see it yet) is there a way to tune the sensitivity of the stability hold, to react a little slower? With my Osprey the craft supported between two powerful engines is very heavy. This causes flex at the engine nacelles IR Rotatrons. And in turn the whole craft will continually bounce up and down attempting to hold a stable altitude. I managed to drastically reduce this issue by adding quantum struts between the engines and the fuselage (tacky). But I figured it was worth asking. Thanks again for such a great addition to KSP.

Link to comment
Share on other sites

I'm not sure I can do anything about the flexing feedback loop.

The main concern is that if I lower it for this purpose, when you are actually traveling horizontally, the lower sensitivity will cause the mod to react too slowly to changes in the height of the ground and can cause a crash.

The smaller concern is how do I compensate for this feedback loop? I'm able to compensate for lift generated by wings by looking at the vessels' position across time, but I can't think of a reference point I could use to compensate for flexing engine nacells.

If you can think of something on this I'll take another look at it, but as it stands I don't think there is anything I can do.

D.

Link to comment
Share on other sites

I'm not sure I can do anything about the flexing feedback loop.

The main concern is that if I lower it for this purpose, when you are actually traveling horizontally, the lower sensitivity will cause the mod to react too slowly to changes in the height of the ground and can cause a crash.

The smaller concern is how do I compensate for this feedback loop? I'm able to compensate for lift generated by wings by looking at the vessels' position across time, but I can't think of a reference point I could use to compensate for flexing engine nacells.

If you can think of something on this I'll take another look at it, but as it stands I don't think there is anything I can do.

D.

No worries at all man. I understand it being a double edged sword. I remember seeing a real life demonstration of a drone rotor on the end of a fixed pendulum arm like a see saw. The design was to evaluate lag in a computer guidance system with physical hardware. Too much latency and it would react too late, causing a degrading oscillation up and down which would eventually cause the rotor to contact the ground. What they wound up doing was building in a certain amount of "pre-cognition" I guess is the best answer. The idea is that it would react ahead of the problem instead of in response to it. I understand this is a very difficult problem as you would need to know the mass, thrust and so on of the given vehicle. And I am speaking very out of my depth on this one so I don't mean to sound like a know it all by any means. Just bouncing ideas around. What I am un-sure of is if this is an over compensation or under compensation issue. If it overshoots, the craft goes too high and cuts too much throttle. And in reverse falls to fast..... you get the idea. My thought was a buffered range of acceptable height. (a shock absorber) Say a range of 5 meters? But then have your mod split the difference and attempt to stay right at 2.5 in the center of the 5 meters. The idea is allow it to move up as well as down and the oscillation would be less aggressive causing less flex of an airframe and less aggressive up and down compensation would be required.

Please don't get me wrong this mod is just great! And I haven't spent enough time tuning a vehicle to work well with your mod. So far I have had great results though. Wiggling up and down compensation while hovering I can deal with, as the pros far outweigh the cons.

Link to comment
Share on other sites

Hi Diazo

just here to report that the issue is fixed , I just saw another error but this is not relevant at all just posting to let you know, it happens when you go on eva:

TWR1 Update Fail! 13 System.NullReferenceException: Object reference not set to an instance of an object

at VerticalVelocity.TWR1.Update () [0x00000] in <filename unknown>:0

But really it is not a breaking game error

Link to comment
Share on other sites

@brusura: Was that a one-time error or did it keep happening every update frame?

It looks like I missed an error trap and under certain conditions (most likely happening only for one update frame on vessel switch/spawn) I can reproduce that error.

Note that if it is happening every frame, the throttle keys will not behave correctly (Shift/Z/X/Ctrl) and the lock-out of target change when your mouse is over the GUI window will not work either. Everything else, including controlling the mod via on-screen mouse click, should still work fine.

It's fixed in my dev version, as it is not critical I'm going to wait a few days to push the next version of the mod to make sure I catch any other changes required for the ModActions integration.

@V8jester: I've tried to do that already in Height Control mode (the shock absorber idea), but it didn't really work. (In Velocity Control mode I don't even look at the current height due to how control in that mode works.)

I think there are two factors that are going to prevent me from being able to do anything about this. The first is that when the engine nacells flex, the centerpoint of the vessel changes and since that is the altitude reference for the vessel, this means this mod sees the flex as an altitude change, even if the body of the vessel has stayed at the same altitude.

The other is that there is a very small delay in the control loop between when this mod sees the data from KSP and can pass command inputs back. (This is why you will never see the vessel stabilize at exactly your velocity or height setpoint.) As the flex results in such relatively small and fast changes, this control loop delay severely limits my ability to compensate for them.

You don't say how big the bounce this flex is causing is, but if it roughly similar (or smaller) then the amount of flex happening, I pretty sure I can't do anything about that.

If a tiny amount of flex (say under a meter) is causing the vessel to bounce up and down several meters, that is something I want to look at further as the reasons I've stated above would not explain that.

D.

Link to comment
Share on other sites

User adjustable delay slider might fix the oscillation? Put the default at center, unless it's running with the absolute minimum delay.

Well maybe yes but possibly no. Diazo mentioned a slight delay already in the mod. Adding more of a delay actually will prove to be more detrimental. If you have too much delay, you can put a ship into a slow building oscillation that only becomes worse while you hover. If there was a way to maybe adjust the throttle curve for a hover auto adjustment.... That could possibly help.

Link to comment
Share on other sites

Alright, there is a single place I could insert a "damper" that might work for this.

The actual numbers used by this mod are very simple at heart, the farther you are away from the set point, the faster the mod tries to move you the other way. So if you are moving downwards at -10m/s, the mod sets the throttle to accelerate you upwards at +10m/s^2, assuming you have set a set point of 0m/s to hover.

(Then there's a whole bunch of added stuff such as never trying to go down faster then gravity, not trying to accelerate faster then your current engines allow, and so on, but that's not relevant to this post.)

I could insert a "throttle modifier" (better name?) so that if you are traveling downwards at -10m/s, the mod tries to accelerate at +10m/s^2 * modifier. So a throttle modifier of .5 would have the mod trying to accelerate upwards at only 5m/s^2.

The issue with this is that when you are not near your setpoint, such as the end of an orbit drop and you want to go from -150m/s to 0m/s to hover, that throttle modifier of .5 would over double the length of time needed to come to a hover. (I think it would quadruple it, but have not done the math.)

Thoughts?

D.

Link to comment
Share on other sites

Alright, there is a single place I could insert a "damper" that might work for this.

The actual numbers used by this mod are very simple at heart, the farther you are away from the set point, the faster the mod tries to move you the other way. So if you are moving downwards at -10m/s, the mod sets the throttle to accelerate you upwards at +10m/s^2, assuming you have set a set point of 0m/s to hover.

(Then there's a whole bunch of added stuff such as never trying to go down faster then gravity, not trying to accelerate faster then your current engines allow, and so on, but that's not relevant to this post.)

I could insert a "throttle modifier" (better name?) so that if you are traveling downwards at -10m/s, the mod tries to accelerate at +10m/s^2 * modifier. So a throttle modifier of .5 would have the mod trying to accelerate upwards at only 5m/s^2.

The issue with this is that when you are not near your setpoint, such as the end of an orbit drop and you want to go from -150m/s to 0m/s to hover, that throttle modifier of .5 would over double the length of time needed to come to a hover. (I think it would quadruple it, but have not done the math.)

Thoughts?

D.

I like the direction you are going in. I think the slower acceleration would drastically improve stability in hover. And I also see how it. Would hinder high speed deceleration. But here is a thought. Could you add some kind of check where it would only use the slower acceleration below a given speed? Say... Below 15 - 20 m/s?

Link to comment
Share on other sites

I could add a check like that, testing would be required to see though if it works and at what range.

On the bounce you are seeing, what are the actual numbers? Both your best guess on how big the bounce is in meters, and what the Current Velocity display on this mod's GUI window is? If those two factors are already small, the control loop delay that KSP imposes would negate any benefit this throttle modifier would give.

D.

Link to comment
Share on other sites

I could add a check like that, testing would be required to see though if it works and at what range.

On the bounce you are seeing, what are the actual numbers? Both your best guess on how big the bounce is in meters, and what the Current Velocity display on this mod's GUI window is? If those two factors are already small, the control loop delay that KSP imposes would negate any benefit this throttle modifier would give.

D.

I completely see what you mean. And the numbers are very small like 1-2 m/s. The mod does a good job of keeping the craft in a stable position. It just seems to do so aggressively when you have a somewhat flexible craft. I'm willing to accept we just need to design stiffer crafts as well. I'll post a video of the osprey hovering with your mod this evening so I can show you exactly what I mean. With the amount of wobble it's producing it's totally reasonable considering all the hurtles you need to overcome to even make the mod work. So don't loose any sleep over it, your mod is golden man.

Link to comment
Share on other sites

Alright in hind sight The wobble really isn't as bad as my first impression had noted. But as promised here is a video showing the wobble and also my work around using Quantum Struts. I want to see if I can edit the quantum struts to have a transparent texture when engaged. But that's a whole other can of worms entirely.

Link to comment
Share on other sites

Interesting, I see the flex you are talking about.

But the actual altitude change is small enough the KSP control loop delay is going to nullify any workaround I put in place. Note that the "Current Velocity" display is to two decimal places, a current velocity of 0.15 means the vessel is only moving vertically upwards at 15 centimeters per second. For comparison, I'd guesstimate that the fuselage of the vessel in your video to be anywhere from 6 to 8 meters tall. Also, while you did go above 0.30m/s a few times, the majority of the time your vessel was under 0.20m/s vertical velocity. (Either positive or negative.)

However, I think the rocking back and forth is actually the Landing Aid mod, not this mod. Can you try exactly the same test but with the Landing Aid mod in "hold" mode (blue), instead of hover-in-place mode (red) please?

The new aerodynamics in KSP 1.0 mean that the KSP 0.90 math the hover-in-place mode is still running leads to a little bit of bounce back and forth in the current version. (I do have the next release of the Landing Aid mod to fix this scheduled for a few weeks from now that will fix this issue.)

D.

Link to comment
Share on other sites

Interesting, I see the flex you are talking about.

But the actual altitude change is small enough the KSP control loop delay is going to nullify any workaround I put in place. Note that the "Current Velocity" display is to two decimal places, a current velocity of 0.15 means the vessel is only moving vertically upwards at 15 centimeters per second. For comparison, I'd guesstimate that the fuselage of the vessel in your video to be anywhere from 6 to 8 meters tall. Also, while you did go above 0.30m/s a few times, the majority of the time your vessel was under 0.20m/s vertical velocity. (Either positive or negative.)

However, I think the rocking back and forth is actually the Landing Aid mod, not this mod. Can you try exactly the same test but with the Landing Aid mod in "hold" mode (blue), instead of hover-in-place mode (red) please?

The new aerodynamics in KSP 1.0 mean that the KSP 0.90 math the hover-in-place mode is still running leads to a little bit of bounce back and forth in the current version. (I do have the next release of the Landing Aid mod to fix this scheduled for a few weeks from now that will fix this issue.)

D.

Ok I retested only using the hold mode. I swear the more I use this mod the more I love it! I think hold mode is slightly more stable as far as swaying but here is the video just the same

You could use the strut guns instead of the quantum struts.

Hey good call. I swapped the quantum struts for the strut gun and the black definitely blends in a whole lot better - Thanks

Link to comment
Share on other sites

Hmm.

That looks about right for that much flex in the wings.

One thought I had was what is the spool time on those propellers? That might also be part of the issue here.

D.

Link to comment
Share on other sites

Hmm.

That looks about right for that much flex in the wings.

One thought I had was what is the spool time on those propellers? That might also be part of the issue here.

D.

Hope you don't slap me for this one. They are modified FS Rotors. I tripled the power output as well as tripled the reaction wheel torque. Honestly I'm really beginning to think I barked up the wrong tree with my complaining. I've been really focusing on messing with your mods the last couple of hours and I can't say enough good things about them. Between the two mods I can now land my osprey anywhere I want, with ease. If the only downfall is the fact that the nacelles wiggle slightly unless they are secured with quantum struts, I can live with that. Really thank you for putting this together.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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.

×
×
  • Create New...