Board index FlightGear Support Hardware

Idea for Elevator- and Aileron-trim

Joysticks, pedals, monitors.

Idea for Elevator- and Aileron-trim

Postby macnab » Mon Oct 08, 2012 1:20 pm

Adjusting Elevator- and Aileron-Trim with a button or keyboard is a bit of a problem in that you don't really know where you are. You can use the HUD for a graphical idea, but this method is more accurate.

While you are adjusting the trims, that value is displayed on screen. It is a bit easier to remember a numerical setting than "about 1.3mm above the center mark."

Before you do anything, if you have not already done so, store a copy of keyboard.xml somewhere safe. It is in Flightgear/data. Now edit it (the one in Flightgear/data) with Wordpad. Put Wordpad in Landscape mode under Page Setup, it helps avoid errors. Use "Find" to look for elevator-trim. It will look like this:
Code: Select all
 <key n="49">
  <name>1</name>
  <desc>Decrease elevator trim</desc>
  <repeatable type="bool">true</repeatable>
  <binding>
    <command>property-adjust</command>
    <property>/controls/flight/elevator-trim</property>
    <step type="double">-0.001</step>
  </binding>

Delete the three lines between <binding> and </binding> then type the necessary so that it looks like this (using spaces to line everything up nicely:
Code: Select all
  <binding>
     <command>nasal</command>
     <script>
        controls.elevatorTrim(0.75);
        gui.popupTip(sprintf("Elevator-trim: %.2f", 4.5 * getprop("/controls/flight/elevator-trim")));
     </script>
  </binding>

Now while adjusting elevator-trim you will get an on-screen display between -4.5 and +4.5.
You cannot do aileron-trim with the keyboard.

If you use buttons on your joystick/yoke for the trims you will have to find the correct file to edit. Start in Flightgear/data/input/joysticks and look for the folder with the manufacturer's name of your joystick. Then look in that folder. You will see an .xml file with a name that matches the model of your joystick. Store a copy of this file in a safe place before editing it. Edit it with Wordpad, putting Wordpad into Landscpae mode under Page Setup.

Do a find for elevator-trim (or elevator, or trim - can't guarantee the spelling.) Keep searching until you find the correct section. It will look something like this:
Code: Select all
   <button n="2">
      <desc>Elevator trim up</desc>
      <repeatable type="bool">true</repeatable>
      <binding>
         <command>nasal</command>
         <script>controls.elevatorTrim(1)</script>
      </binding>
   </button>

   <button n="3">
      <desc>Elevator trim down</desc>
      <repeatable type="bool">true</repeatable>
      <binding>
         <command>nasal</command>
         <script>controls.elevatorTrim(-1)</script>
      </binding>
   </button>


The lines <button n="2"> and <button n="3"> will most likely not be the same.
Delete the lines between <binding> and </binding> in both areas and replace them so that they look like this:
Code: Select all
   <button n="2">
      <desc>Elevator trim up</desc>
      <repeatable type="bool">true</repeatable>
      <binding>
        <command>nasal</command>
        <script>
          controls.elevatorTrim(0.75);
          gui.popupTip(sprintf("Elevator-trim: %.2f", 4.5 * getprop("/controls/flight/elevator-trim")));
        </script>
      </binding>
   </button>

   <button n="3">
      <desc>Elevator trim down</desc>
      <repeatable type="bool">true</repeatable>
      <binding>
             <command>nasal</command>
             <script>
               controls.elevatorTrim(-0.75);
               gui.popupTip(sprintf("Elevator-trim: %.2f", 4.5 * getprop("/controls/flight/elevator-trim")));
             </script>
      </binding>
   </button>


Now try to find aileron trim. It probably is not there. If it is, change both sets of lines between <binding> and </binding> so you have something like this:
Code: Select all
    <button n="6">
      <desc>Aileron trim left</desc>
      <repeatable>true</repeatable>
      <binding>
        <command>nasal</command>
        <script>
          controls.aileronTrim(-0.75);
          gui.popupTip(sprintf("Aileron-trim: %.3f", getprop("/controls/flight/aileron-trim")));
        </script>
      </binding>
    </button>

    <button n="7">
      <desc>Aileron trim right</desc>
      <repeatable>true</repeatable>
      <binding>
        <command>nasal</command>
        <script>
          controls.aileronTrim(0.75);
          gui.popupTip(sprintf("Aileron-trim: %.3f", getprop("/controls/flight/aileron-trim")));
        </script>
      </binding>
    </button>

This will give you an on-screen display between -1 and +1 while adjusting the aileron trim.

Good luck!
macnab
 
Posts: 886
Joined: Tue Aug 02, 2011 7:20 am
Location: Johannesburg, South Africa
Callsign: ZS-ILH
Version: Git
OS: Win7Pro 64bit SP1

Re: Idea for Elevator- and Aileron-trim

Postby Johan G » Mon Oct 08, 2012 1:42 pm

Many real aircraft have trim indicators, however in FlightGear I do not know of any except those with moving trim controls (mostly elevator trim wheels). :(
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Johan G
Moderator
 
Posts: 5451
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 3.0.0
OS: Windows 7, 32 bit

Re: Idea for Elevator- and Aileron-trim

Postby macnab » Mon Oct 08, 2012 1:49 pm

except those with moving trim controls (mostly elevator trim wheels).

And even then you have to look right down to the right to see it, and models such as the c172 you can't see the setting unless it is very close to 0.
macnab
 
Posts: 886
Joined: Tue Aug 02, 2011 7:20 am
Location: Johannesburg, South Africa
Callsign: ZS-ILH
Version: Git
OS: Win7Pro 64bit SP1

Re: Idea for Elevator- and Aileron-trim

Postby Philosopher » Mon Oct 08, 2012 1:57 pm

Some do in Flightgear, I'm pretty sure. Piper pa-24 should, and maybe the pa-28 (sorry, I'm giving the folder names! :P), but also the B-29 and one, if not both, of the Connies. Probably some other aircraft that I don't remember off the top of my head. But I do like this numerical approach as it could help with getting more consistent trim every time and getting a better estimation of where you are, and I'll definitely incorporate it into my (new) joystick file. Thanks for the idea, macnab :D.
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1590
Joined: Sun Aug 12, 2012 6:29 pm
Location: Stuck in my head...
Callsign: AFTI
Version: Git
OS: Mac OS X 10.7.5

Re: Idea for Elevator- and Aileron-trim

Postby Peteguam » Mon Oct 08, 2012 8:29 pm

Philosopher> Thanks for this.
Mac Pro, Dual Core 2.66, 11 GB ram, OSX 10.7
Peteguam
 
Posts: 15
Joined: Sat Sep 22, 2012 1:16 am
Location: Guam
Version: 2.8
OS: OS X


Return to Hardware

Who is online

Users browsing this forum: No registered users and 2 guests