Jump to content

[1.9.x] Vertical Velocity Controller Redux

Recommended Posts

Forum user @Diazo hasn't been around in almost a year, and this mod of his was sorely missed, so I've adopted it moving forward.  Original thread is here:  https://forum.kerbalspaceprogram.com/index.php?/topic/46647-13jun0417-automate-vertical-velocity-and-altitude-control/

Control your descent speed exactly and fine-tune it in 1 m/s increments.

This mod assumed you will use the Z key to control it. However, as this conflicts with the Set Throttle to Max command the mod is bound to no key upon installation

You can use the on-screen buttons to control the mod but the following instructions on how to use this mod assume you have unbound the Set Throttle to Max command from the Z key and bound the Z key to this mod.

The closest available alternate key for the Set Throttle to Max command is the Tilde(~) key, all other keys on the left side of the keyboard are bound to something else already.

Latest Update:

Version 1.32: KSP 1.3 Compatibility update. Localization is not supported in this version, English is still hard-coded. Localization will be added when this mod moves to the new GUI.

KNOWN ISSUE: Due to this mod still using the old GUI system, some computers freeze for several seconds the first time a window using the old GUI is made visible in the game. This should only happen once per game session the first time an old style window (from any mod) is shown on screen by KSP. Moving to the new GUI in the next version (barring any bugfix releases that come first) will resolve this.


Now, for feedback when your vessel is landed, the "Altitude:" text will change to a green "LANDED" text to indicate you are touched down even though the altitude is still reading a few meters of altitude.



CKAN has been updated to install the dependencies, if needed.

This mod uses the ToolbarController to manage the toolbar button(s)

What this mod does:

  • Set a vertical velocity setpoint that will automatically maintained via downwards pointing engines.
  • The mod compensates for vessel angle off vertical so you can move sideways while keeping vertical speed the same.
  • Weight changes, such as burned fuel, are also automatically accounted for.
  • Aerodynamic lift from wings is accounted for. (Tail fins on a rocket will generate lift even when they point straight up.)
  • The setpoint can be set to the current vertical velocity or to 0 to maintain altitude.
  • The velocity setpoint can then be modified in 1m/s increments. (Configurable increment.)
  • Accounts for the presence of SRBs to make this usable during launch to avoid hitting terminal velocity.
  • Should be compatible with all mods, please let me know of any conflicts
  • Supports Davon Throttle Control mod to only control engines on Throttle 0 Details

What his mod does not do:

  • Control vessels that generate lift solely with wings. If there are no downwards pointing engines, this mod can not do anything. Combination VTOL's work great though, especially in the horizontal transition as you pick up speed and the wings generate more and more lift.

Want to control your horizontal velocity?

Horizontal Landing Aid




Show interface: Click the VEL button on the Toolbar (if installed) or hit Z to display the mod interface. Note that pressing Z will engage velocity control mode and maintain your current vertical velocity. Click the VEL button again to hide or click the bottom mode button when it is Control Off to hide the mod interface.

Show settings: Click the Wrench Icon in the lower right.

Vessel Tilt Compensation: This mod will compensate for the angle of your vessel and will maintain the vertical speed as directed. This is limited by your available engine power however, if you tilt far enough over that 100% engine power can not keep you up, the engine will lock at 100% and you will have to adjust your vessel's angle. (Or disable the mod until you recover.)

Aerodynamic Lift Compensation: Because of the approximate nature of how KSP calculates lift, rocket tail fins generate lift even when pointed straight up. The mod compensates for this to keep your vertical speed at the setpoint. (In tests, the stock Kerbal 2 rocket was generating an acceleration of 0.5m/s^2 upwards with a horizontal speed as low as 25m/s from the 3 control winglets.)

Keyboard bindings: By default this mod uses the Z key, although this can be changed if desired. Otherwise it uses the keys that are bound to throttle control, by default these are Left-Shift, Left-Control and X. This guide will refer to the keys by these defaults, but if you have changed which keys control the throttle, use those keys instead. These bindings correspond to the 4 top buttons (Off, Zero Vel, +1, -1). The Height Control and Operation Mode button have no keyboard binding and must be clicked. Note that you can rebind this key to any key on the keyboard, a mouse button, a joystick button, or a controller button. However, there is no conflict check, if you bind the key to something already in use, both functions will execute when the button is pressed.

Velocity Step Size: On the settings screen, you can change the size of the velocity step from the default 1m/s. Note that due to how KSP handles text boxes, you can not enter 0.5 directly, rather you must enter the 5, then cursor back and enter the decimal point. This is due to the fact that KSP 'auto-corrects' the 0. to 0 and deletes the decimal point if no number is after it.

Emergency stop: At any time, press any throttle key while Z is not held down will turn this mod off and return to KSP's default control scheme. Note that during orbital descent ("Free Pitch"), pressing a throttle key will behave as normal, but will not disable the mod. To disable the mod during orbital descent requires a double tap of the Z key. The first tap turns off Height Control and goes to Velocity Control, the second tap disable the mod.

Altitude: Be aware that the altitude reported is to the vessel's center of mass and so will report an altitude of a few meters even when you are landed. For confirmation you have landed, the "Altitude" text will change to green "LANDED" text when you are touching the ground.

Soft landing (Velocity Control):

Press Z to maintain your current descent velocity, once near the ground hit Z-X to start hovering. Leave enough height to slow down, this mod can only slow you as fast as your activated engines will allow.

Tilt your vessel to slide horizontally with your desired landing spot.

Press Z-Ctrl to start descending, each press of Ctrl will increase the descent speed by 1m/s.

As you approach touch down, press Z-Shift to decrease your descent speed (1m/s per press) and touchdown at a nice soft 1m/s or 2m/s.

Once landed hit X (without holding down Z) to cut engines and disable this mod.

Soft takeoff (Velocity Control):

Press Z-X to enable the mod and set the desired velocity to zero.

Press Z-Shift to increased your ascent rate by 1m/s per press.

Press Z-X to set your velocity setpoint to zero to enter a hover, or press Z-Ctrl to reduce your ascent speed by 1m/s per press.

Liftoff speed control:

Takeoff as normal, once you reach your desired vertical speed hit Z and that speed will be maintained.

Once clear of the lower atmosphere, hit any throttle key (while Z is not pressed) to disable the mod and continue your ascent as normal.

Note that this mod controls vertical speed only. As you tip over your total speed will increase as your horizontal speed becomes a larger part of your total velocity.

Height Control:

First, the desired height to fly to must be entered. Click the 'Fly To' text box and enter your desired altitude. Only numbers and special keys (arrow keys, backspace, delete, etc.) are valid.

Be aware that while the text box has focus, commands are not issued to KSP. However, pressing any non-number key such as W will cause the text box to lose focus and return control to KSP. It may take two key presses however, one to return focus and a second to issue the command.

Once the desired altitude is entered, click the Auto Height button to engage and your vessel will fly the desired altitude. The mod will compensate for vessel tilt (up to about 30°) so you can control your horizontal speed by tilting your vessel. Pressing a throttle key will disable height control and return you to the default KSP controls. Pressing Z will enter Velocity Control mode with the Velocity Setpoint your current vertical speed.

Height control can be enabled anytime the gray 'Auto Height' button is present. See warning messages below if you do not have this button.

Descent from orbit (Height Control):

When descending from orbit (or from a sufficient height), there is a special "Free Pitch" mode available.

To use, enter the altitude you desire to stop and hover at in the 'Fly To' text box. The auto height button should say "Auto Height (Free)". Click this and the auto height button should change to "Free Pitch". This effectively arms the Height Control mode to take control of the throttle once you are low enough, but does nothing at this height.

Continue to control your ship via the normal KSP keybindings to de-orbit. Note that pressing a throttle key does not disable the mod while in this mode.

When you are 20 seconds away from the height where the Height Control mode needs to take over to hover at the desired altitude, the "Free Pitch" will change to "Thrust Warning", you then have those 20 seconds to return your vessel to pointing straight up so that the Height Control can take control of the throttle to bring you to a stop at your desired altitude.

Height Control Button Warnings:

This button can display several different things:

TWR LOW: This means that 80% throttle, your vessel currently can not accelerate upwards. More engine power is required for Height Control to work. Velocity Control mode can still be engaged.

TWR HIGH: This means that 1% throttle, your vessel currently can not accelerate downwards. This is almost exclusively caused by the presence of Solid Rocket Boosters. Height Control can not engage until the SRBs are expended. Velocity Control mode can still be engaged.

Note that if either TWR HIGH or LOW become true when Height Control mode has been engaged, control will revert to Velocity Control with a setpoint of 0 so the craft will attempt to hover until you can correct the situation.

Auto Height (gray text): Height Control is not currently engaged (although Velocity Control may). Click to activate Height Control mode.

Auto Height (Free) (gray text): Your altitude is high enough that entering Height Control mode will be in the orbital descent "Free Pitch" mode, leaving you with throttle control

Auto Height (Now) (gray text): Your altitude is such that Height Control will take control of the throttle as soon as you enter it.

Auto Height (Thrust) (gray text): Your altitude is such that Height Control will take control of the throttle as soon as you enter it, but you are in the 20 second buffer zone between Free Pitch mode and Normal Height Control mode.

In Auto: Height Control mode has control of the ship and everything is normal. You may pitch the vessel up to 35° off vertical for horizontal speed control and the Height Control mode will automatically adjust your vertical velocity to compensate.

OVER PITCH: (Over Pitch in yellow text.) This is a warning condition that the vessel is greater the 35° off vertical and Height Control may not be able to compensate for that pitch angle. Height Control will still attempt to however and if you return to less then 35° off vertical, Height Control will be able to recover and return your vessel to the desired altitude.

Free Pitch: This is a special condition that is only present during long descents, usually from orbit. When this mode is displayed you have full control of your vessel, including the throttle. During this time, pressing a throttle key controls the throttle and does not disable this mod.

THRUST WARNING: (Thrust Warning in yellow text.) This is a warning condition that the vessel is about to thrust vertically to hold at the desired altitude. When this is displayed, you are leavingFree Pitch mode and you have 20 seconds to return to less then 35° off vertical, otherwise you may overshoot your desired altitude.

Skycrane mode

As of version 1.18, the compensation for adding and removing loads from a skycrane is now handled silently in the background by the mod. When you attach or detach a load from a skycrane, the mod should compensate for the weight different in a very short time (half a second or less) and you can fly as normal from there.

Mod Use (Refer to screen shot above):

Current Vertical Velocity: Shows you current vertical velocity regardless of whether this mod is engaged or not. Positive numbers is upwards velocity, negative numbers downward velocity.

Velocity Setpoint: Has 3 modes. "---.--" is displayed when this mod is not engaged. "123.12" A number displays when the mod is engaged in Velocity Control mode and shows what the current target velocity is. "Auto" displays when Height Control mode is engaged.

Disable Velocity Control: Clicking this button disables this mod (both Vertical Velocity and Height Control modes). This is the same as pressing a throttle key (Shift/L-Ctrl/X) with Z not held down.

Set Vertical Velocity to Zero: Clicking this button enables this mod in Velocity Control mode and sets the Velocity Setpoint to 0 (zero). This is the same as pressing Z-X on the keyboard.

Increase/Decrease Vertical Velocity by 1m/s: Clicking these buttons will increase or decrease the Velocity Setpoint by 1m/s when in Velocity Control mode. If the mod is not in Velocity Control mode (so not engaged or in Height Control mode), the mod will engage Velocity Control mode and use the ship's current velocity as the Velocity Setpoint. This is the same and pressing Z-Shift or Z-LCtrl on the keyboard.

Target and Current Altitude: The current altitude of your ship and the desired target altitude above terrain (not sea level as displayed at the top of the screen) for Height Control Mode.

Height Control Button: The button for Height control mode.

Operating Mode: Shows you which mode the mod is currently in. "Height Control Mode", "Velocity Control Mode" or not engaged ("Control Off"). Click this button to go from Height Control to Velocity Control, and then click again to go from Velocity Control to Control Off.

Direction: Set which direction is up. Click 'Direction' to see the current setting and the Up Down Forward Back Left Right buttons to set the up direction that way relative to the root part's local axis (which can be different then the world axis.) A red arrow will appear showing which direction is now up. This setting saves on a per vessel basis.

Known limitations:

-Jet Engine spooling is not fully accounted for and the craft will bounce before settling if jet engines are the primary source of lift. (No fix possible)

-Does not account for RCS

-Only practical near planets surface

Edited by linuxgurugamer
Link to comment
Share on other sites

  • 5 months later...

Does this support Blizzy's Toolbar? I'm pretty sure it did back in 1.2.x. In 1.5.1 with the latest ToolBar and dependencies, it's stuck in the stock toolbar. Blizzy's doesn't have the option to display it.

BTW, it is possible to add a limiter to throttle change speed to help with jet engine response? I know most of the problem is dealing with the spool up/down of jets. Maybe a "Jet Mode" toggle that limits the rate of change in throttle and putting a clamp/limit of max vertical acceleration would help. At the very least, I think it would make it more obvious that  player has to be more careful when using jets only. (Of course, this is assuming you'll even consider developing this further rather than just maintaining functionality.)

Link to comment
Share on other sites

  • 10 months later...
  • 1 month later...

Hi, I have a bug with this mod that I cannot figure out.

When I launch a new craft, a pink box extends from the main crew module. Messing with the settings of the mod, I noticed that it is related to the 'direction' option. I don't know how to remedy this, thoughts?



Link to comment
Share on other sites

On 11/17/2019 at 7:04 AM, falconfoe said:

Hi, I have a bug with this mod that I cannot figure out.

When I launch a new craft, a pink box extends from the main crew module. Messing with the settings of the mod, I noticed that it is related to the 'direction' option. I don't know how to remedy this, thoughts?


Bug repeats for me.  Workaround once in the scene is to open the VEL settings panel and tap the Direction button.
It makes the pink box show the forward direction for about 10 seconds and then disappear.

Once it is cleared from the scene it stays gone until a reload, so you can get it out of the way during docking / landing / EVA maneuvers.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  • 1 month later...
On 12/13/2019 at 10:12 PM, Atlas Gaming said:

@linuxgurugamer I think you fixed this in the Horizontal Velocity Controller. It's still a bug in Vertical. Would love to see a fix when you have time :)

I did a bit of digging after experiencing the same issue tonight, and I can confirm this is the case. A change was made to line 66 of "RCSLandAidModule.cs" for Horizonal Velocity Controller adding (what appears to be) support for legacy shaders. Implementing the same fix on line 310 of TWR1.cs should resolve the issue. According to the github commits, that was the only significant change to HVC when @linuxgurugamer fixed HVC.

This is of course just the analysis of someone with experience reading logs and interpreting code from other games. Feel free to explain how wrong I am!

Link to comment
Share on other sites

  • 2 weeks later...

Nice mod, I was about to implement this functionality, but in the end, I googled it first. I have one question about it: can the mod control robotic parts, or it can only adjust engine gimbaling and throttle?

Edited by kalmor
Link to comment
Share on other sites

20 minutes ago, kalmor said:

Nice mode, I was about to implement this functionality, but in the end, I googled it first. I have one question about it: can the mod control robotic parts, or it can only adjust engine gimbaling and throttle?

The mod is only aware of gimbaling and throttle

Link to comment
Share on other sites

  • 1 month later...

This mod looks amaizing. Does it assist VTOL control, or do i have to manage the balance of the engie myself and the mod will "only" crontroll the thrust of all engines?

(aside from the fact, that jet engines aren't working very good)

Link to comment
Share on other sites

  • 8 months later...

Hey question for you Linux... I often use this mod for 'unplanned' landings and though it would be cool to incorporate 'some' automation into the abort Action to for instance turn on the mod, set descent rate to 5m/s and let the dracos gently bring the dragon capsule down. Or add in smartparts that can trigger an Action at say 300M and THEN turn on this mod,  set 5m/s descent and gently land.

Only way I can think of doing that is with a 'controller' part which can be slapped on a ship and then used as part of Actions tab to select a function from that part (which is tied to this mod) like turn on, set speed to -5, set SAS to Radial Out... Then I looked at the Action groups and when a capsule is selected, I see what LOOKS like exactly what I want listed under VertVel and Translation... 

Did you read my mind? LOL or am I looking at a totally unrelated set of commands?

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.

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...