Jump to content

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


Diazo

Recommended Posts

I haven't tested your mod yet, but I saw in your wishlist you wanted to do terrain height hover.

I've done that for my hover code here, using raycast and pqsAltitude:

https://github.com/snjo/Firespitter/blob/master/Firespitter/engine/FShoverThrottle.cs

And some other non terrain hover code here:

https://github.com/snjo/Firespitter/blob/master/Firespitter/engine/FScopterThrottle.cs

Hope that can help you :)

edit: Oh, and if you want an example of multi point hover code in a single part, I do that in my buoyancy code:

https://github.com/snjo/Firespitter/blob/master/Firespitter/water/FSbuoyancy.cs

Edited by Snjo
Link to comment
Share on other sites

@Clanf: I'm a bit confused, right now it's a velocity control, it does not refer to either surface or terrain height, it controls your vertical speed relative to your SOI and that's it.

@JumptserG: Glad to be of assitance. :)

@Snjo: I'll take a look at the code and see if I can work it out. I'm only really stuck on the math for moving to a set altitude, the rest of it I've got pretty much set.

Will have to wait until the Touchscreen Mod is 0.22 compatible though, but that should be straightforward.

D.

Link to comment
Share on other sites

  • 2 weeks later...

Okay, fly to altitude and hold is in.

Unfortunately not as straight forward due to Unity limitations. (Anyone know how to delay a text box entry?)

I do need feedback on tilting the vessel while in height control mode. At the moment it reserves 20% thrust for vessel tilt, so if the ship has a TWR of less then 1 at 80% thrust, it will not engage. Did I make this too generous?

D.

Link to comment
Share on other sites

Would it be possible to have an alternate increment ammount other than +1 or -1? What about highlighting one corner of each button? When you press the button most of it causes the value to increment by 1. If you take the time to click in the smaller sweet spot it increments by 10. Ideally the value would be set in the config file so players that wanted an alternate value of 50 or 100 could get that.

Your example of going to a hover and letting the ship drop to find a new descent rate seems like it would use more fuel for slowing a descent. Why not just slow directly to your new rate in 10 m/sec increments? (or whatever the alternate value was set to)

Link to comment
Share on other sites

I don't want to annoy you with this but i'm using an AZERTY keyboard and i use ZQSD as well as A and E for controlling the vessel is there a way to change the command key?

Yes there is. In the Gamedata\Diazo\TWR1 folder there is the TWR1.cfg file.

Change the "TWR1Key = z" line to use the key you want. Just make sure it is lower case, uppercase will cause the mod to fail to load due to how Unity handles key input detection. It can also be set to use the special keys (shift/ctrl/etc.) but I would have to look those key codes up.

@Kerba Fett: Note that at the end of my example I do note that it was a nice safe descent at the expense of using more fuel so yes, that is how that example works.

However you can see your current velocity and just hitting Z locks you to that current velocity. Kerbin has one of the highest gravities in the game and it only pulls you down at 10m/s. Hit Z when you see your current velocity close and then tap Z-Shift/Ctrl a couple times to adjust.

Especially now that height control is in, that takes care of the first big drop from orbit to low altitude for you now.

The other reason is that the Velocity Control is intended for keyboard control. I'm not going to add functionality for it on buttons on the screen I can't add on the keyboard and I can't see any way to change the increment without needed a second key which I don't think is available on most people's keyboards. (Note that Height Control is on-screen only and I have no plans to add keyboard control for it.)

If you can give me a better example of how you would use this I might look at it, but as it stands I have no plans to implement anything but 1m/s second increments.

D.

Link to comment
Share on other sites

Double post I know, but I just re-read my release post for Height Control last night and realized that it kind of sucks. (Yay late night posts just before bed.)

So, the real release post for Height Control follows. :wink:

In the new release I've also added on-screen buttons to control the mod functions.

The Velocity Control component is still intended to be controlled by the keyboard, and will always stay controlled by the keyboard. I added the on-screen buttons for people who want to do it that way as I know some people would prefer that method.

Note that the function of the Velocity Control mode has not changed, I just added the on-screen buttons for it.

Height control is all new however.

The 'Fly To' text box is the altitude you want your ship to hold in meters above terrain. Note that this is different then the altimeter at the top of the screen which displays height above sea level.

Click this box to enter text entry mode where you can enter your desired altitude as expected, then click outside the box to return to flight mode.

Note the distinction between text entry mode and flight mode, this is important. Due to how Unity handles the text entry, when you have clicked into text entry mode, it captures all key inputs, including flight control inputs so until you click outside the text box and return to flight mode, you can not control your ship. I'm going to keep looking into this, but I suspect this is a limitation we are going to have to live with.

Once your height is set, click the Auto Height button to fly to the selected altitude and hold. When the Auto Height text is green, Height Control is enabled and flying your ship.

When in height control mode, it still compensates for vessel tilt and mass changes in your ship so you can control your horizontal velocity while staying locked at your selected height.

Effectively, Height Control mode is Velocity Control mode with a Velocity setpoint of 0 at a specific altitude and should work that way.

The one thing I need feedback on is how much thrust to reserve for horizontal control. At the moment, Height control mode can only use up to 80% thrust, the other 20% is reserved for vessel tilt compensation. This translates into up to 35° off vertical for moving around. You will see a yellow OVER PITCH warning if you go past 35° degrees, but Height Control will still do it's best but it can't guarantee a stable hover if you go past 35°.

This limit however means that a ship with a TWR of less then 1 at 80% thrust, (or a TWR of 1.25 at max thrust) can not be height controlled and you will have a red TWR LOW warning and not be able to activate height control mode.

Should I change this 80% limit?

The other thing you will see is a red TWR HIGH warning. This is caused by a throttle setting of 1% not being negative acceleration. This will be caused by the presence of SRBs on launch from Kerbin usually, although really low gravity moons may also cause this error if the craft trying to land has a lot of engine power. Again, all it means is that Height Control can not engage.

In all cases, these warnings apply to Height Control only. The Velocity Control mode can be activated at any time and will do it's best with whatever ship configuration you have.

As always, any feedback is good feedback. :)

D.

Link to comment
Share on other sites

  • 2 weeks later...

Wow, serendipity. I reinstalled this mod today, right around 5pm. I had to search Google for it. Then I play with the "new" version for a while (very nice, by the way!) and come back and the thread was replied to less than an hour (and maybe even just a few minutes) after I'd downloaded it.

Link to comment
Share on other sites

Unlocked aircraft engines and landing gear in my career. After 5-10 minutes of flying around, I decided I NEEDED this mod again as my throttle control for cruising. It isn't the intended purpose of this mod, but it's just so simple and effective! I Flew missions to both poles of kerbin and had fun exploring the various mountain ranges.

If the GUI could be hidden and remembered where I position it on the screen between flights, I would consider it perfect.

I promise I'll use it for a lander or VTOL soon...

Link to comment
Share on other sites

@JumpsterG: Remebering the Window position will be in for next version. I have the code for that implemented in my other mod, just need to copy it over. (Thanks for the reminder.)

I'm not sure about hiding the mod window though, press Z to show it again?

Having said that, version 1.2 is out. Two changes in this one.

1) Tweaks to the Altitude Hold code. There should now be virtually no overshoot of your target altitude so operations near the ground should be less risky.

2) Added a new "Free Pitch" mode. (And "Thrust Warning" to go with it.)

When you are descending from orbit, if you tip your vessel over past 60° off vertical, the engines will now come on at 50% thrust. As you approach the horizon the thrust ramps up to 100% when you hit 85°. Any farther, including past the horizon so that your nose is pointing downwards, and the engines stay at 100%

This allows you to continue canceling your horizontal speed as you descend with Height Control mode engaged, rather then having to finish descending to your desired altitude before canceling your horizontal speed.

20 seconds before the thrust to hold altitude begins, you will exit "Free Pitch" mode and "THRUST WARNING" will be displayed. You need to have you ship back to within 35° of vertical before those 20 seconds are up, or you may overshoot your desired altitude anyway.

I am not sure 20 seconds will be long enough for everyone though. My vessels have a pretty decent rotation speed so 10 seconds would be long enough for me. I bumped it up to 20 seconds because I know some of the really big craft out there simply don't turn that fast. If you try out Free Pitch mode, let me know how 20 seconds feels please?

D.

Edited by Diazo
Link to comment
Share on other sites

I love the mod.

As for hiding the GUI, would you consider adding a button in the upper left hand corner, like Kerbal Alarm Clock or Crew Manifest does? Or would that even be feasible?

Either way, great work.

Edited by Firov
Link to comment
Share on other sites

  • 1 month later...

This is something of a necro, but do you still plan on maintaining this mod Diazo? It's a great mod, and I'd hate to see it fade away.

I'm not sure if it's completely compatible with .23, as I haven't actually tested it yet, but even if it is, since the original release there have been a few community developments such as the toolbar plugin that could be integrated into this that would make it even better.

Edited by Firov
Link to comment
Share on other sites

  • 4 weeks later...

Your bump reminded me that I had not returned to post regarding this mod working in .23. It does. :)

Not this mod's fault, but any attempt I've made to do VTOL with jet engines just ends in tears. ;.;

If the mod handled the spool up time of jets, just maybe I could make one work by compensating for my bad piloting, but more likely it's my designs that are flawed.

Link to comment
Share on other sites

You could cheat by editing the engine spool speed in the CFG?

MODULE

{

name = ModuleEngines

thrustVectorTransformName = thrustTransform

exhaustDamage = True

ignitionThreshold = 0.1

minThrust = 0

maxThrust = 150

heatProduction = 350

useEngineResponseTime = True

engineAccelerationSpeed = 0.12

engineDecelerationSpeed = 0.21

useVelocityCurve = True

fxOffset = 0, 0, 0.74

Link to comment
Share on other sites

I realized that this works pretty well with jet engines and even firespitter props. Just not when the heading is at the horizon. sPbkqCD.jpg.

When facing vertically the hover system works quite well. Maybe this can be fixed if the author ever decides to revive this plugin. 3VVzdKp.jpg

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