Board index FlightGear Support Hardware

Assigning Flight Controls to Yoke

Joysticks, pedals, monitors.

Assigning Flight Controls to Yoke

Postby judster » Wed Jan 09, 2008 5:09 am

Need some Help! I am running flightgear on Mac OSX 10.4 and my CH yoke works fine except I would like to assign the buttons on the yoke to certain aircraft commands. Example I would like to assign button 8 to be "Altitude Hold". This should be very simple and should not have to enter a bunch of PC code etc.

Thanks!

David
judster
 
Posts: 8
Joined: Tue Jan 08, 2008 6:29 pm

Postby Stefan Riemens » Wed Jan 09, 2008 12:29 pm

Have a look at this wiki page 8)

I hope that will help, as you are right: no need for a whole bunch of pc-programming :wink:

Stefan
Stefan Riemens
 
Posts: 51
Joined: Wed Dec 12, 2007 8:35 pm
Location: Eersel, Holland

Postby stuart » Wed Jan 09, 2008 12:31 pm

Have a look at the file

Code: Select all
data\Input\Joysticks\CH\pro-yoke-usb.xml


It is the the configuration file for your yoke.

You should then be able to identify the button you wish to change, and bind it to whatever command you wish.

If you are intending to bind it to a command that is currently available from the keyboard, then have a look in data\keyboard.xml and copy the appropriate binding from there.

Have fun!

-Stuart
G-MWLX
User avatar
stuart
Moderator
 
Posts: 1629
Joined: Wed Nov 29, 2006 10:56 am
Location: Edinburgh
Callsign: G-MWLX

Postby judster » Wed Jan 09, 2008 2:16 pm

Stefan Riemens wrote:Have a look at this wiki page 8)

I hope that will help, as you are right: no need for a whole bunch of pc-programming :wink:

Stefan


Stefan,

I'm still lost. Where are all these files, like (/FlightGear/joysticks.xml) and (/FlightGear/Input/Joysticks/CH). They are not on my HD. Remember I'm on a MAC. Its all windows and no code files. It's not all that Linux stuff.
They constantly talk about all these xml files. I don't even know what they are where they belong.
judster
 
Posts: 8
Joined: Tue Jan 08, 2008 6:29 pm

Postby judster » Wed Jan 09, 2008 2:20 pm

stuart wrote:Have a look at the file

Code: Select all
data\Input\Joysticks\CH\pro-yoke-usb.xml


It is the the configuration file for your yoke.

You should then be able to identify the button you wish to change, and bind it to whatever command you wish.

If you are intending to bind it to a command that is currently available from the keyboard, then have a look in data\keyboard.xml and copy the appropriate binding from there.

Have fun!

-Stuart


Stuart.

Again I don't even know where this file is. When I'm downloading the program to my Apple MAC, I have the application icon a couple readme files and 2 userguides and that is it. I have been on MACs for 20 years now and know them very well and use them everyday for my job and I'm beginning to think that the joystick program files are strictly for Windows/Windows Vista and not MAC
judster
 
Posts: 8
Joined: Tue Jan 08, 2008 6:29 pm

finding data files on os x

Postby buti » Wed Jan 09, 2008 5:37 pm

ok, i'll try to give you step-by-step instructions:

  1. get a decent editor to edit your xml-files. e.g. smultron at http://smultron.sourceforge.net
  2. assuming you have put FlightGear in Applications:
    • go to Applications
    • ctrl-click on Flightgear
    • "Show package contents"
    • Navigate to Contents/Resources/data/Input/Joysticks/CH/
    • ctrl-click on pro-yoke-usb.xml and open it with smultron (or drag it to smultron if you have put it in the dock)
    • follow directions elsewhere on how to change the file
    • save the file and launch FlightGear

NOTE: all applications in os x are in fact folders with the extension .app. they usually contain all sorts of application-related data and can be opened and used like any other folder (by using "show package contents")

hope that helps,

- till
buti
 
Posts: 3
Joined: Wed Jan 09, 2008 4:32 pm

Re: finding data files on os x

Postby judster » Thu Jan 10, 2008 4:28 am

buti wrote:ok, i'll try to give you step-by-step instructions:

  1. get a decent editor to edit your xml-files. e.g. smultron at http://smultron.sourceforge.net
  2. assuming you have put FlightGear in Applications:
    • go to Applications
    • ctrl-click on Flightgear
    • "Show package contents"
    • Navigate to Contents/Resources/data/Input/Joysticks/CH/
    • ctrl-click on pro-yoke-usb.xml and open it with smultron (or drag it to smultron if you have put it in the dock)
    • follow directions elsewhere on how to change the file
    • save the file and launch FlightGear
NOTE: all applications in os x are in fact folders with the extension .app. they usually contain all sorts of application-related data and can be opened and used like any other folder (by using "show package contents")

hope that helps,

- till



I'm almost there, your explanation was very helpful. Below is a code that I copied from the file that I want to change. I want this button to be Altitude Hold or maybe Heading Hold. I can't right code, is there a code reference page that I can copy off of. Or at lease maybe you can do this example for me.

Thanks!

David


<button n="8">
<desc>Increase Engine Boost</desc>
<repeatable>true</repeatable>
<binding>
<command>property-adjust</command>
<property>/controls/engines/engine[0]/boost</property>
<step type="double">+0.01</step>
</binding>
<binding>
<command>property-adjust</command>
<property>/controls/engines/engine[1]/boost</property>
<step type="double">+0.01</step>
</binding>
</button>
judster
 
Posts: 8
Joined: Tue Jan 08, 2008 6:29 pm

Re: finding data files on os x

Postby tat » Fri Jan 11, 2008 5:38 am

You can see /Applications/FlightGear.app/Contents/Resources/data/keyboard.xml to check what command is assigned to what key.

I'll show you an example of assigning "Toggle autopilot altitude lock" so you can do the rest.

1) search "altitude" in keyboard.xml
1.0.0 has a key binding section for locking altitude as shown below:
Code: Select all
 <key n="1">
  <name>Ctrl-A</name>
  <desc>Toggle autopilot altitude lock.</desc>   <!-- you need this -->
  <binding>         <!-- and this (including sub tags) -->
   <command>nasal</command>
   <script>
     var node = props.globals.getNode("/autopilot/locks/altitude", 1);
     if ( node.getValue() == "altitude-hold" ) {
       node.setValue( "" );
     } else {
       node.setValue( "altitude-hold" );
     }
   </script>
  </binding>
 </key>


2) copy & paste the content of <desc> tag to your joystick file
3) copy and paste the lines from <binding> through </binding> to the joystick file

After doing step 2 and 3, the code for button 8 looks like this:
Code: Select all
 <button n="8">
  <desc>Toggle autopilot altitude lock.</desc>
  <binding>
   <command>nasal</command>
   <script>
     var node = props.globals.getNode("/autopilot/locks/altitude", 1);
     if ( node.getValue() == "altitude-hold" ) {
       node.setValue( "" );
     } else {
       node.setValue( "altitude-hold" );
     }
   </script>
  </binding>
 </button>


If you want to use js_demo or jgfs, these are at /Applications/FlightGear.app/Contents/Resources
in 1.0.0 binary package.
Tat Nishioka
FlightGear Mac OS X Project
http://macflightgear.sourceforge.net
User avatar
tat
 
Posts: 174
Joined: Fri Dec 28, 2007 1:58 pm
Location: Yokohama, Japan
Callsign: tat


Return to Hardware

Who is online

Users browsing this forum: No registered users and 5 guests