Jump to content

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


Diazo

Recommended Posts

Author here. Real life's been kind of nuts, was my baby's first Christmas and I'm getting back into the swing of things.

1) Yes, works with FAR. My for fun games always have FAR installed and I've had no issues.

2) 0.23 works fine as long as you leave engines at 100% on the tweakables. If you limit engine thrust to less then 100% the calculations go wonky and you will not hold altitude. Fix already in for next version.

3) The altitude above terrain has a bug where it can display "-1" for altitude when too high (in orbit) or above deep ocean. Fix is known but not implemented yet.

4) Jet spooling: I am open to adding compensation for this, but I'm not sure how to. The mod does not have any "history", rather it computes the throttle setting in real time based on your current vertical speed (for velocity hold) or distance from desired altitude (for altitude hold). This then sets the rocket throttle instantly. I'm not sure how to add jet engine spooling compensation to this equation.

5) Toolbar: This is planned for next version and is the hold up. As soon as this is in I'll be releasing the next version.

6) Descent from orbit ("Free Pitch" and "Thrust Warning"): I find I don't really use the altitude hold mode in my descent from orbit and am considering ripping it out. Does anyone actually use this?

Next version should be out this weekend some time.

D.

edit: @martinezfg11

The limitation about "up being up" you talk about is a limitation of the mod that is here to stay. If you absolutely want to use this mod like you will have to put a docking port (or similar) on the top side and use the "control from here" option.

Having said that, I am turning over ideas in my head for an "airplane hold" mode where it will cruise for you by holding your plane level and adjusting speed to maintain height but nothing has come of that yet.

Edited by Diazo
Link to comment
Share on other sites

Hi Diazo. You're not the only one struggling with real life stuff, that's for sure.

I do still have this installed and I find it very useful. Hovering around is lots of fun, Landings are more controlled, and it remains very handy for spaceplane stuff. Even the vertical velocity readout by itself is great, since I don't usually need more than that (provided by mechjeb or kerbal engineer) when flying an SSTO spaceplane.

Regarding jet engines: When counting the thrust available from a jet engine, you wouldn't necessarily have to check its history to determine spooling status. So long as you are able to determine the "actual thrust" of a jet engine at any given moment, I would think that you could use the difference between that and your "desired thrust" (what is currently used to set throttle) to come up with a different throttle value. Unfortunately, I am not up to solving the math myself just now, but maybe there are some smart people over in the plugin development subforum that could shed light on the necessary calculations.

Regarding Descend from orbit: It's true, I don't tend to use the hold altitude feature for descending from orbit, but it is fun to hover over bumpy terrain with (since it uses ground height and not sea-level height). I think the concept for a "descend from orbit to height/land" button is a great idea (and it actually works pretty well!) but maybe it needs to be separated into it's own window that can be accessed optionally? This way it would not be complicating the simpler "near-surface" functions (zero-velocity, increment/decrement, simple hold altitude, etc.). Since it does work, I wouldn't ditch it completely.

In any case, thanks for sharing this and please don't feel pressured to do more than you want to. I know I don't have the time to properly maintain my own little utility, let alone play KSP. :)

Link to comment
Share on other sites

Er, I realize I was not clear enough.

The height control mode is here to stay, it was the Free Pitch and Thrust Warning modes I was talking about during descent from orbit.

Having thought it over, what I am going to do is add a "Height Control Armed" button.

This button will do two things: The next time Z is pressed, engage height control and while "Height Control Armed" is true, pressing a throttle key will not disengage the mod. That way, you can do whatever you like on your descent from orbit and then once you get the 20 second "Thrust Warning" you can point your ship upwards and hit Z to engage height control once you are ready to proceed to your selected altitude.

D.

Link to comment
Share on other sites

New version out.

Fixed some bugs and added support for the toolbar to hide the interface when you are not using it.

Note that it starts hidden so hit the button or Z to show it.

The height control has been reworked when descending from orbit. When in free pitch mode, there is no more auto-control of throttle. Instead, engaging auto-height while in orbit pre-arms height control to automatically engage when you get lower.

Now, while in orbit ("Free Pitch") showing, you have full control of your vessel, including throttle, so you can de-orbit as you normally would. Then when you get low enough, "Thrust Warning" comes up to let you return your vessel to point upwards so the height control can engage.

This means however that when in orbit, pressing a throttle key does not disengage the mod. However, while you are in orbit the mod does nothing, engaging height control simply tells it to come on automatically once you are lower.

The testing for this release has also made me unhappy with the height control algorithms however. I'm going to totally re-work those for the next release, hopefully in a couple weeks.

D.

Link to comment
Share on other sites

Fixed some bugs and added support for the toolbar to hide the interface when you are not using it.

Absolutely awesome. Thanks! I actually uninstalled this to remove screen clutter but am getting close to needing to do lots of precision landings again, and this will make those much easier.

Link to comment
Share on other sites

@Boamere: No, that will not work as is.

Look at the nav ball, when the direction you want to go up is pointing up, the nav ball must be pointed 90 degrees upwards, like a basic rocket sitting on the pad after leaving the VAB.

You can try adding a docking port on the top and using the "Control from here" command on it though.

There is no provisions for lift from wings, if you are moving horizontally the mod may not be accurate.

D.

Edited by Diazo
Link to comment
Share on other sites

@Boamere: No, that will not work as is.

Look at the nav ball, when the direction you want to go up is pointing up, the nav ball must be pointed 90 degrees upwards, like a basic rocket sitting on the pad after leaving the VAB.

You can try adding a docking port on the top and using the "Control from here" command on it though.

There is no provisions for lift from wings, if you are moving horizontally the mod may not be accurate.

D.

Thanks! :)

Link to comment
Share on other sites

Do you have blizzy's toolbar installed? You should have both a GameData\000_Toolbar and a GameData\Diazo directory. Running a quick test shows that if the 000_Toolbar is not present, the GUI will stay hidden.

Blizzy's toolbar is included in my latest download.

D.

Link to comment
Share on other sites

Do you have blizzy's toolbar installed? You should have both a GameData\000_Toolbar and a GameData\Diazo directory. Running a quick test shows that if the 000_Toolbar is not present, the GUI will stay hidden.

Blizzy's toolbar is included in my latest download.

D.

Yes, I have the toolbar, in the latest version 1.4.4, though I tried the bundled one (1.4.3.) too, to no avail. The toolbar works fine with Kethane, Alarm Clock quick jump buttons, and few others.

The button with V is there, but nothing happens when I click on it. Pressing Z puts the space craft in hover, and Shift+Z/Ctrl+Z works as well to ascend, descend. The only thing I can't see is the GUI to control throttle +/- 1 step, which is what I was counting on the most.

Link to comment
Share on other sites

Okay, version 1.4 out.

I changed how the GUI rendering works to hopefully fix the bug you are seeing Dre4dW0rm. Also, while I was in there I added support for the GUI window to save it's location.

Note that on first run after installing version 1.4, the GUI will be in the very top left. It will now save its location though so you will only have to move it once.

@Dre4dW0rm: I'm pretty sure I've fixed what kept the GUI from displaying for you, but if I did not, can you attach the ksp.log from your main ksp directory for me please? That will help me figure this out.

D.

Edited by Diazo
Link to comment
Share on other sites

Ah! I don't want Mechjeb too (its to big and automating way too much for me, but its a great idea otherwise). I was thinking to implement a similar plugin but decided to give the ribbons a try instead.

I will test this plugin in the next few days.

Link to comment
Share on other sites

Okay, version 1.4 out.

I changed how the GUI rendering works to hopefully fix the bug you are seeing Dre4dW0rm. Also, while I was in there I added support for the GUI window to save it's location.

Note that on first run after installing version 1.4, the GUI will be in the very top left. It will now save its location though so you will only have to move it once.

@Dre4dW0rm: I'm pretty sure I've fixed what kept the GUI from displaying for you, but if I did not, can you attach the ksp.log from your main ksp directory for me please? That will help me figure this out.

D.

Great work. GUI works, and all functions also work. Thank you very much for fixing.

Link to comment
Share on other sites

Diazo great work on the plugin. Would you consider adding a kill horizontal speed option in your plugin. I know this is something akin to mechjeb, but I find your plugin way more reliable. Also, the plugin does not compensate for weight added to the craft using mods like KAS. Maybe that can be added in the future? Thanks!

Link to comment
Share on other sites

Diazo great work on the plugin. Would you consider adding a kill horizontal speed option in your plugin. I know this is something akin to mechjeb, but I find your plugin way more reliable. Also, the plugin does not compensate for weight added to the craft using mods like KAS. Maybe that can be added in the future? Thanks!

The issue is that how do I kill horizontal speed?

Right now it simply calculates the thrust needed for vertical velocity and your vessel angle and holds you at altitude.

I don't even calculate horizontal movement right now, I leave it up to the pilot to balance it via tipping the ship.

Way back when I started, one of the design goals of this mod was to allow a skycrane to land without the use of RCS, just main engines. so tipping the ship is how horizontal speed was controlled.

I suppose that this is a long winded way of saying I'm certainly open to having my mod kill horizontal speed, I don't just have a clue how to have my mod kill horizontal speed as it has to work on a ship without RCS.

As for the KAS thing, that surprises me. I'll have to look at the KAS stuff, but it must be doing something odd where the KAS stuff attaches without become part of the vessel (in the game code), so my vessel.mass calculation does not pick it up.

I'll look into it.

D.

Link to comment
Share on other sites

In order to have the plugin control both Vertical and Horizontal velocities, it would have to take over steering the vessel in addition to throttle.

Controlling just throttle, the plugin can only work on maintaining 1 vector (currently vertical). Technically speaking, it's possible to have it maintain one of an infinite number of horizontal vectors (East/West, 1degree/181degree), but it would then be ignoring vertical, requiring the pilot to compensate by pitching up (exact opposite of what we have now which maintains vertical, allowing pilot to pitch off vertical to control horizontal). Near airless bodies, once you've gotten to your desired horizontal speed, there's very little change to it, so pitching up would result in no thrust for controlling vertical. The final problem, is that to control horizontal velocity this way, it would be up to the player to point the ship retrograde, which will never be perfect and require the pilot to adjust the ships heading at least once to cancel out all horizontal motion (since thrusting off vector would increase horizontal speed along another vector).

Controlling vehicle steering opens up possibilities for a horizontal autopilot: Zero your vertical velocity with the throttle autopilot, enter a horizontal speed and compass heading, then the horizontal autopilot could pitch over to (and away from to slow down) the desired direction, allowing the vertical autopilot to adjust throttle accordingly to maintain vertical speed. A "Zero horizontal" function could detect the heading the vessel's surface prograde/retrograde direction is on and use that. I imagine the user touching any steering controls would immediately disengage the horizontal autopilot (steering) but leave the vertical autopilot (throttle) on. Conversly, manually adjusting the throttle might disengage just the vertical autopilot but leave the horizontal autopilot running (steering to maintain horizontal speed with whatever throttle setting is used).

I don't know if you're interested in having the plugin take over the steering wheel, but it sounds like the way to go if you want the option to control both vertical and horizontal motion without RCS. You might also consider an RCS-based horizontal autopilot to take advantage of designs with it, even if all it does is attempt to zero out horizontal velocity on command.

All this is just fun speculation on my part. Don't feel you need to do anything else with this plugin, since it's quite awesome in its current form.

Link to comment
Share on other sites

I love you. Thanks for putting stuff that should already be in the game in the game, and giving me yet another reason to not install MechJeb. :)

Not so much love as appreciation here, but the rest stands. 8) Thanks!

Link to comment
Share on other sites

Horizontal and vertical control functions would have to be intimately interconnected, otherwise they could induce oscillations in each other with increasing amplitude until the ship goes out of control and crashes.

See Pilot Induced Oscillation https://en.wikipedia.org/wiki/Pilot-induced_oscillation and Race Condition https://en.wikipedia.org/wiki/Race_Condition

Link to comment
Share on other sites

Okay, I've released Version 1.5

This is more of a maintenance release then adding new functions. I originally hacked the Height Control code in several versions ago and it has just been getting worse and worse.

So, I ripped it out and redid the Height Control from scratch. Nothing changes in how the mod is used on the player's end, but everything should be smoother in height control mode and dropping from orbit (free pitch mode) should now be more logical. (No more potential for bouncing as you reach your target altitude.)

I also investigated how KAS works. It looks like as long as you use the "Plug (Docked)" function, things will probably work as expected. "Plug (Undocked)" leaves what has been connected as a separate vessel so it is not considered by my mod.

Could the ones who use KAS give me a description or screenshot of how they are using it? That will give me a better idea of what I'm looking at in terms of making my mod work with KAS.

D.

Link to comment
Share on other sites

(Have not used KAS beyond the bit of testing I did.)

I don't think it will be a big deal to run that picture as you show in Docked mode intead of Undocked.

The biggest difference that I can think of is that when you dock, resources are shared (fuel, mono-prop, etc.) where-as undocked they are not.

If you are slinging something like that, using dock mode runs the risk of emptying its fuel tanks if it was a rover or something, but that should be it.

If I can make sure it works though, that looks like a textbook situation where my mod would be useful.

D.

Link to comment
Share on other sites

Don't know if it's just me but when i install this mod i get UI problems, for example the blue text that appears when you mouse over the part categories or the Save and Load options appears way off to the right.

It also seems to affect the B9 science part that you can write craft information, all the text shows up at the right side.

Without mod

BKrTPsW.jpg

With mod installed all the craft information text is changed to the right side

OIgc850.jpg

Anyone know why this is happening?

Link to comment
Share on other sites

I certainly have "Align Right" on several of the text elements in my GUI.

How those are getting transferred to B9 I don't have a clue.

Will investigate.

D.

edit: Okay, found it. Looks like the cause is split between my mod and B9.

It looks like neither my mod nor B9 isolate their GUI object from the KSP master GUI. So when either my mod or B9 (or a 3rd mod that does not isolate the GUI object) makes changes to the GUI settings, it carries over between the mods.

So the last object in my GUI window has the Align Right tag, my mod passes that back to KSP to be picked up by B9.

Then B9 comes along and assumes that the KSP gui is set to Align Left because that's how it is set when KSP starts and does not check to make sure so it uses the Align Right flag my mod set.

I'll fix my mod as soon as I'm home (not at my development computer right now), but I can't do anything about the B9 end of things. If another mod comes along in the future that does not isolate the GUI, it will do this again to the B9 stuff.

However, that does mean this bug is on the UI only. Game play and function is not affected.

Edited by Diazo
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...