Jump to content

[1.2] TrimPlus 1.2.1 - bind trim to joystick buttons and keyboard keys


RadarManFromTheMoon

Recommended Posts

This little plugin lets you map the airplane trim controls to joystick and keyboard keys. (because alt+WASD is meh!) Nothing more, nothing less.

 

here is a screenshot:

elHBGgy.jpg

 

TRIM_PITCH_UP / TRIM_PITCH_DOWN: press to trim the plane up or down

TRIM_ROLL_LEFT / TRIM_ROLL_RIGHT: press for roll trimming

TRIM_YAW_LEFT / TRIM_YAW_RIGHT: press for yaw trimming

RESET_TRIM_PITCH reset pitch trim to zero

RESET_TRIM_ROLL reset roll trim to zero

RESET_TRIM_YAW reset yaw trim to zero

RESET_TRIM like pressing RESET_TRIM_PITCH, RESET_TRIM_ROLL and RESET_TRIM_YAW at the same time

SET_TRIM_PITCH : 1. level out plane 2. press and hold button 3. release pressure on the stick 4. release button. The plane is now trimmed out

SET_TRIM_ROLL: Like SET_TRIM_PITCH but with roll

SET_TRIM_YAW: Like SET_TRIM_PITCH bit with yaw

SET_TRIM: like pressing SET_TRIM_PITCH, SET_TRIM_ROLL and SET_TRIM_YAW at the same time

Source

Download

license: GPL v3

Edited by RadarManFromTheMoon
Link to comment
Share on other sites

  • 3 months later...
  • 3 weeks later...
8 hours ago, ZobrAA said:

@RadarManFromTheMoon Like your mod! Just want to ask, what actually SET_TRIM_* action do?

Glad you like it. SET_TRIM was intended to set the trim to the current control state (speak: Joystick position) Not sure if it works, and there are any useful applications though. I for myself never use it, so I might just remove it from the mod in the future.

Link to comment
Share on other sites

2 hours ago, RadarManFromTheMoon said:

Glad you like it. SET_TRIM was intended to set the trim to the current control state (speak: Joystick position) Not sure if it works, and there are any useful applications though. I for myself never use it, so I might just remove it from the mod in the future.

Oh, I see now :)

One more question: can you add some king of trim indicators?

Like ferram one day suggested: kqjpQDX.png Or like in good old Simple Trim Indicators mod. :rolleyes:

Link to comment
Share on other sites

  • 4 weeks later...
On ‎4‎/‎20‎/‎2016 at 6:47 AM, RadarManFromTheMoon said:

Glad you like it. SET_TRIM was intended to set the trim to the current control state (speak: Joystick position) Not sure if it works, and there are any useful applications though. I for myself never use it, so I might just remove it from the mod in the future.

 

Actually, I use it, but only the Pitch Trim variant.  I would like to report an oddity though.  I can hold my stick at say, fifty percent of aft stick input, and tap my set-trim button, and the input will vastly exaggerate and set the trim to max.  This forces me to try and reset trim multiple times before I get it to settle where I want it, and horribly degrades trim accuracy. 

 

I do not know what causes this, but it behaves in a manner that almost seems like a button debounce issue.  Which shouldn't be an issue as that implies a lot of problems from joystick button to program. 

 

 

Anyway, I have a suggestion for the set trim commands.  As they stand, when it's working as it should, setting the trim on a stick causes the 'centerpoint' of stick control to jump, causing a swift kick to the vehicle being controlled upon setting trim.  It's annoying, and rather difficult to get trim adjustments correct with.

 

I have a suggestion for improvement based on a program addition to FSX called Real Trim.

 

The behavior is as thus.  Rather than 'setting' trim on a button press, setting trim is a three-step action.

1: Press and hold the 'set trim' button.

2: Release tension on the stick.

3: Release hold on the 'set trim' button.

 

This more readily mimics the real life behavior of trim in aircraft as you are simulating 'thumbing the trim tab' until tension is relieved from the flight stick/yoke.

 

I would assume the command would work as thus:

1: Upon button press, the control input state is locked where it stands and the trim value is set.

2: The player continues to hold the button and relieve stick tension.  Relieving stick tension does not upset aircraft.  The player could go wild with the stick at this point.  As long as the button is held, the input is 'locked'.

3: Once the player has reached neutral position, they release the trim button.  Stick 'control' is restored and the input is unlocked.  Since the stick is now in a neutral position, there is no 'kick' from the 'new logical neutral' being affected by the stick's actual position.

 

 

 

 

Link to comment
Share on other sites

  • 3 weeks later...
On 13.5.2016 at 1:20 PM, AdmiralTigerclaw said:

 

Actually, I use it, but only the Pitch Trim variant.  I would like to report an oddity though.  I can hold my stick at say, fifty percent of aft stick input, and tap my set-trim button, and the input will vastly exaggerate and set the trim to max.  This forces me to try and reset trim multiple times before I get it to settle where I want it, and horribly degrades trim accuracy. 

 

I do not know what causes this, but it behaves in a manner that almost seems like a button debounce issue.  Which shouldn't be an issue as that implies a lot of problems from joystick button to program. 

 

 

Anyway, I have a suggestion for the set trim commands.  As they stand, when it's working as it should, setting the trim on a stick causes the 'centerpoint' of stick control to jump, causing a swift kick to the vehicle being controlled upon setting trim.  It's annoying, and rather difficult to get trim adjustments correct with.

 

I have a suggestion for improvement based on a program addition to FSX called Real Trim.

 

The behavior is as thus.  Rather than 'setting' trim on a button press, setting trim is a three-step action.

1: Press and hold the 'set trim' button.

2: Release tension on the stick.

3: Release hold on the 'set trim' button.

 

This more readily mimics the real life behavior of trim in aircraft as you are simulating 'thumbing the trim tab' until tension is relieved from the flight stick/yoke.

 

I would assume the command would work as thus:

1: Upon button press, the control input state is locked where it stands and the trim value is set.

2: The player continues to hold the button and relieve stick tension.  Relieving stick tension does not upset aircraft.  The player could go wild with the stick at this point.  As long as the button is held, the input is 'locked'.

3: Once the player has reached neutral position, they release the trim button.  Stick 'control' is restored and the input is unlocked.  Since the stick is now in a neutral position, there is no 'kick' from the 'new logical neutral' being affected by the stick's actual position.

 

Trim in KSP basically works as an offset to the current control input, thus offsetting the resting point of the control surfaces. Setting a new trim value that drastically differs from the previous trimming causes a bounce because the new control input is suddenly joystick pitch + new trim position - old trim position. Thats not really usable so I was planning to remove the feature alltogether.

 

However I really like the idea of setting the trim by releasing pressure on the stick. Thanks for the tip! Though I think I will stick to the Real Trim functionality since I think freezing the input is a little bit too much.

PS. will see if I can find something similar for X-Plane :wink:

Link to comment
Share on other sites

1 hour ago, RadarManFromTheMoon said:

Trim in KSP basically works as an offset to the current control input, thus offsetting the resting point of the control surfaces. Setting a new trim value that drastically differs from the previous trimming causes a bounce because the new control input is suddenly joystick pitch + new trim position - old trim position. Thats not really usable so I was planning to remove the feature alltogether.

 

However I really like the idea of setting the trim by releasing pressure on the stick. Thanks for the tip! Though I think I will stick to the Real Trim functionality since I think freezing the input is a little bit too much.

PS. will see if I can find something similar for X-Plane :wink:

You misunderstand.

 

What I was saying is that when I press the button to set the trim, the setting jumps as if I rapidly pressed the button twice.  Once to set it, and again as if I immediately pressed it a second time when the setting was altered.  In the electronics hardware world, this behavior would be associated with 'bouncing', where pressing the button actually causes the electronic contact to strike multiple times in a seemingly single motion as the contacts 'bounce' open before it settles.  These bounces can happen ten to fifteen times in a single button press.

 

Correcting this event is known as 'debounce', and has nothing to do with the behavior of the aircraft to suddenly jerk in-game.  Debounce is where you design the electronic circuit to essentially read the first input, and then lock out any more reads for a few microseconds so that the bounces don't get read.  Your keyboard, for example, has this.  Oooootttteeeerrrrrwwwwiiiisssseeeee  <-----You'd get that.  Anything modern containing buttons usually has debounce built in, so it's not my flight stick.

As for locking the input behavior.  I disagree, I don't think it's too much.  That's how Real Trim in FSX effectively works.  You hold down the button, and then release the stick.  The input is locked so that stick motion doesn't drop your nose, and instead alters the trim settings.  If the problem is the issue of thinking that this would introduce problems with control...  Well, you're doing it wrong.  You're not SUPPOSED to trim until you're adjusting for straight and level.  If it's a technical problem with implementing it, I can understand that as being too much (work).

 

 

 

 

 

 

Link to comment
Share on other sites

1 hour ago, AdmiralTigerclaw said:

You misunderstand.

 

What I was saying is that when I press the button to set the trim, the setting jumps as if I rapidly pressed the button twice.  Once to set it, and again as if I immediately pressed it a second time when the setting was altered.  In the electronics hardware world, this behavior would be associated with 'bouncing', where pressing the button actually causes the electronic contact to strike multiple times in a seemingly single motion as the contacts 'bounce' open before it settles.  These bounces can happen ten to fifteen times in a single button press.

 

Correcting this event is known as 'debounce', and has nothing to do with the behavior of the aircraft to suddenly jerk in-game.  Debounce is where you design the electronic circuit to essentially read the first input, and then lock out any more reads for a few microseconds so that the bounces don't get read.  Your keyboard, for example, has this.  Oooootttteeeerrrrrwwwwiiiisssseeeee  <-----You'd get that.  Anything modern containing buttons usually has debounce built in, so it's not my flight stick.

As for locking the input behavior.  I disagree, I don't think it's too much.  That's how Real Trim in FSX effectively works.  You hold down the button, and then release the stick.  The input is locked so that stick motion doesn't drop your nose, and instead alters the trim settings.  If the problem is the issue of thinking that this would introduce problems with control...  Well, you're doing it wrong.  You're not SUPPOSED to trim until you're adjusting for straight and level.  If it's a technical problem with implementing it, I can understand that as being too much (work).

 

 

 

 

 

 

I have rewritten the set_trim_x part of the plugin and you now can use it the way you described :D

Have fun!

Edited by RadarManFromTheMoon
Link to comment
Share on other sites

  • 4 months later...
  • 2 years later...
8 minutes ago, linuxgurugamer said:

Yes and no, would be nice to have it as one, but I don't see it really adding value to what's already there, at least not without a lot of work

that is what I am thinking; loaded both - only one working. Changes to UI probably have crashed this one while TrimIndicator seems to be functioning perfectly. UI work, iirc, is considerable work.

Link to comment
Share on other sites

1 minute ago, zer0Kerbal said:

that is what I am thinking; loaded both - only one working. Changes to UI probably have crashed this one while TrimIndicator seems to be functioning perfectly. UI work, iirc, is considerable work.

Actually, I would thing that the api has changed.  Are you using a version compiled for the version of KSP you are using?

And I didn't realize that this was a dead mod.  I'll think about it LOL

Edited by linuxgurugamer
Link to comment
Share on other sites

3 minutes ago, linuxgurugamer said:

Actually, I would thing that the api has changed.  Are you using a version compiled for the version of KSP you are using?

And I didn't realize that this was a dead mod.  I'll think about it LOL

haven't recompiled it yet - need to update unity(just trying to remember where I put the download link) next then will recompile. Tried it with the version recompiled for 1.3.1

Edited by zer0Kerbal
Link to comment
Share on other sites

33 minutes ago, zer0Kerbal said:

haven't recompiled it yet - need to update unity(just trying to remember where I put the download link) next then will recompile. Tried it with the version recompiled for 1.3.1

You dont need unity if you have visual studio

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