MasseFlieger

Extended Trim

Recommended Posts

Hello fellow kerbals :cool:

For some time I have wished that we had a couple of additional options in our trim controls, below is my early attempt to add this on to the game.

After losing several aircraft to hamfisted pilots, Kerbal engineers decided that enough was enough. And so ExtendedTrim was born.

Made out of WD40 and duct tape this mod adds the following:

new key binding: Press Left Alt+Z to trim the aircraft to the same input, and enjoy level flight. :)

right-click and action groups now available to clear/reset your trim per axis or set the trim like ALT+Z key Binding

you can now save your preferred trim settings: this means that independent of any other trim values you change during flight, you can save the values you want to recall later. These actions are accessible via action groups.

nothing more to it.

Dependencies: modulemanager

Some images:

FHlCNkaMJhlE.jpg

MjZ7XhTcHdea.jpg

This is an early release, some issues may occur, please let me know of any.

License: GPLv3

Download Latest version from KerbalStuff: here

Thanks to :

dazoe for the inspiration to do it: https://github.com/dazoe/KSP-TrimIndicators

taraniselsu for the awesome examples: https://github.com/taraniselsu/TacExamples

diazo for the help in the development forums

Change Log:

0.3:

- 3 new Action Group actions added:

- Save Trim; saves trim to the persistence file as an independent set of values

- Restore Trim: restored saved trim values

- Set Trim to input: same behavior as ALT+Z

- 1 new part event: set trim, will set trim much like ALT+Z

- extended trim control can only be used when the ship is controllable

- small improvements to the Auto Trim logic

- code clean up

0.2:

- ALT+Z now sets the trim to the current input with or without SAS on

- "Set trim" now Action Group and Right Click Events

0.1.:

- Alpha Release

README:

Quick instructions:

during flight:

- press ALT+Z or activate the set trim action group to save the current trim settings to the actual trim of the aircraft

- turn SAS on, and then press ALT+Z or active the set trim through action group or right click event to turn on AUTO TRIM; this will dynamically adjust the trim settings to the SAS input, this allows you to turn off SAS, and the aircraft should hold the last SAS input enabling a smooth transition into manual flight

- after adjusting/setting trim to a favorite value, activate the "save trim" action group to save the values (these values will be stored regardless if you change the trim afterwards)

- activate the action group "Restore Trim" to reset the trim to the saved values from the step above

Edited by MasseFlieger
mod update

Share this post


Link to post
Share on other sites

Now this, this is useful. Nice!

Um. Does "autotrim" work for remembering current inputs regardless of SAS? I.e. I get my plane trimmed out with stick and rudders, and hit autotrim, and it will remember *those* inputs, regardless of SAS on/off?

Share this post


Link to post
Share on other sites

Hey NathanKell,

The autotrim is only to set the trim to same input as the SAS module had it, other than that trim works as previously. In this version it will set the trim to the SAS input values the instant you press Alt+Z.

Next version Im planning on having persistent trim, where once you save the trim, it will be saved into the persistence file.

Share this post


Link to post
Share on other sites

Ah, I see. Is it possible you could just grab the actual controlstate when Alt+Z is pressed? That way it will set the trim to "just like this" no matter what caused "this"--SAS or regular inputs.

Share this post


Link to post
Share on other sites

Alright, I tested a bit, and changed the auto trim to set based on input regardless of where the input is coming from.

Also added right click and action group options to set the trim in the same way.

Have a go and let me know what you think!

I'm still working on saving the trim settings into the craft / persistence file.

Share this post


Link to post
Share on other sites

Awesome! Thanks!

As this is a part module, you can just store the trim in KSPFields marked persistent and then set the trim to that OnStart.

Edit: Ah, it's both. Well, you could save trim to static members of your KSPAddon, and query them for your module's OnSave, and apply them in OnLoad.

Edited by NathanKell

Share this post


Link to post
Share on other sites

Alright folks! 0.3 is out, this time with persistent trim settings!

What does this mean? It means 2 things:

1. you can set your favorite trim, and save it, then...

2. you can change the trim settings as much as you want, set auto trim, etc... and still revert back to the favorite/saved values at any point, even after leaving the flight and coming back to it as it will persist in the game save.

Please test it out and let me know how it goes, I am planning on putting it on the mod showcase tomorrow or so unless there is some showstopper bug :)

Share this post


Link to post
Share on other sites

Is it possible to set the trim of an aircraft in the editor so that it gets automatically applied when you load the craft on the runway? I am sorry if I did miss something in the description, English is not my first language. Otherwise, this mod is very nice.

thanks, Umbra

Share this post


Link to post
Share on other sites
Is it possible to set the trim of an aircraft in the editor so that it gets automatically applied when you load the craft on the runway? I am sorry if I did miss something in the description, English is not my first language. Otherwise, this mod is very nice.

thanks, Umbra

Hi Umbra,

At the moment you can only save trim settings once in-flight, which will then persist. That is an excellent idea however, I will check on getting that done.

Share this post


Link to post
Share on other sites

While we're suggesting suggestions, I have another suggestion! :)

Add "fine trim" keys, so you can vary trim in lower steps. With decent control at low Q, it's very hard to trim out at high Q

Share this post


Link to post
Share on other sites
While we're suggesting suggestions, I have another suggestion! :)

Add "fine trim" keys, so you can vary trim in lower steps. With decent control at low Q, it's very hard to trim out at high Q

Hi NathanKell,

If I understood you, you want to be able to trim the control surface at a smaller angle at a time? hmm, perhaps I can try and detect when fine controls are turned on, and override the original key bindings.

Ill check on this, and report back.

Thanks for the suggestions, keep them coming!

Share this post


Link to post
Share on other sites

Detecting fine controls is easy. Overriding the binding is less likely, not sure you can consume the key before KSP notices it. However, what you can do is check when a trim key is pressed, and then yourself subtract a portion of the trim that was (or is about to be) added. It won't work perfectly in edge cases, but it should work decently well.

Share this post


Link to post
Share on other sites

Has this been tested to perform normally on 25? I'm getting some weird flight behaviour, and Ferram swears it ain't him...

Share this post


Link to post
Share on other sites

Hi, can I make a small request on behalf of us crazy non-qwerty foreigners? On my keyboard for instance, Z is where a W is on qwerty, so alt-z is already bound to trim pitch down.

Can you make the key binding modifiable, or let us disable it and use a custom action group?

Or, bind it to alt+[max throttle] so it stays consistent.

Share this post


Link to post
Share on other sites
Has this been tested to perform normally on 25? I'm getting some weird flight behaviour, and Ferram swears it ain't him...

I have been playing it in .25 but I have been mostly in mod testing mode, so haven't done more testing than functional. I will dive a little deeper, and see if there is something weird going on.

- - - Updated - - -

Hi, can I make a small request on behalf of us crazy non-qwerty foreigners? On my keyboard for instance, Z is where a W is on qwerty, so alt-z is already bound to trim pitch down.

Can you make the key binding modifiable, or let us disable it and use a custom action group?

Or, bind it to alt+[max throttle] so it stays consistent.

Apologies for the late reply - I will check in making all keys configurable/toggable.

Share this post


Link to post
Share on other sites

@Wanderfound: Hey there, tested a little more in 0.25 and couldnt find any unusual. Please send me or reply here with some details on what you are experiencing, and I can have a look further. I also tested with the latest FAR.

Share this post


Link to post
Share on other sites
If I understood you, you want to be able to trim the control surface at a smaller angle at a time? hmm, perhaps I can try and detect when fine controls are turned on, and override the original key bindings.

A small window with two sets of +/- buttons and a text field displaying current value for each control would do great. The buttons could (in|de)crement the value by 1% or .1%. Like so:


//\\ = + 1%
/\ = + .1%
15.2
\/ = - .1%
\\// = - 1%

There is no need to make more dramatic increments cause stock trimming does that great.

Share this post


Link to post
Share on other sites

0.25 x86, if I load the game, go to the SPH and select a command part I get this spammed to my debug log:


NullReferenceException: Object reference not set to an instance of an object
at AeroKerbinIndustries.ExtendedTrimModule.Update () [0x00000] in <filename unknown>:0

Happens in the flight scene as well

Share this post


Link to post
Share on other sites
0.25 x86, if I load the game, go to the SPH and select a command part I get this spammed to my debug log:


NullReferenceException: Object reference not set to an instance of an object
at AeroKerbinIndustries.ExtendedTrimModule.Update () [0x00000] in <filename unknown>:0

Happens in the flight scene as well

Apologies - I have not been around for the last couple of months - I will have a look into this as soon as I compile this for 0.90

Share this post


Link to post
Share on other sites

oh hey. No problem I actually haven't even noticed it at all recently and it's just been installed this whole time, still works for .90 but yea a version-specific compile is always nice

Share this post


Link to post
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.