Board index FlightGear Support Hardware

FAQs: customizing joystick controls; XP/Vista joystick issue

Joysticks, pedals, monitors.

FAQs: customizing joystick controls; XP/Vista joystick issue

Postby MD-Terp » Mon Nov 03, 2008 6:25 pm

Hello all --

This post, written at Stuart's request, is meant to answer two of the forum's frequently asked questions, regarding joystick configuration in Flightgear.

Q1: Why does my joystick seem messed up? I run Flightgear on Windows [XP / Vista].
Q2: How can I change the controls assigned to each button on my joystick?

(EDIT: Even if you are reading this for Q2 and not Q1, you should still read most of it, as the explanation will give you the knowledge necessary to create your own customized controls.)

1. How Flightgear handles joysticks.
In layman's terms, Flightgear firsts attempts to detect whether a joystick is connected, and if so, what it is called. After checking /Flightgear/data/joysticks.xml for any instructions to the contrary, it will then scan through all of the various XML files under /Flightgear/data/Input/Joysticks looking for an XML file which defines "bindings" (i.e. command or control assignments for each axis and button) for that particular joystick. For example, if the stick is being reported as a "Saitek ST290 Pro", Flightgear will come across the file /Flightgear/data/Input/Joysticks/Saitek/ST290-Pro.xml which contains the tags:
Code: Select all
 <name>Saitek ST290 Pro</name>
 <name>SAITEK Saitek ST290 Pro</name>

... and it will use the control assignments found in that file to assign functions to each axis and button.

If it doesn't find an XML file for your particular joystick, it will substitute a "generic" one (/Flightgear/data/Input/Joysticks/Default/) which only maps the basic functions of elevator, aileron, rudder (if available), throttle, brakes, and elevator trim. Those assignments may or may not end up in logical-seeming places for your joystick.

2. The problem, as "caused" by Windows XP/Vista.
It seems as if Windows XP and/or Vista tend to report all joystick names as "Microsoft PC-Joystick Driver" regardless of what they are. This may or may not hold true if the user has taken the time to install the manufacturer's specific driver for that device; all feedback we have received so far seems to indicate that Windows defaults to a "generic" MS driver regardless, but your mileage may vary.

If the name is being mis-reported, this then prevents Flightgear from automatically assigning controls logically (using one of its many pre-defined XML bindings files) based on how the various axis numbers are assigned and how the buttons are laid out. Flightgear will then revert to the "generic" (aka default) bindings. For some joysticks the default file might make perfect sense; for others, it might cause odd behavior.

3. The solution; several different approaches.
There are three main solutions to this issue; however, both are similar in that they involve modifying one or more of the .xml files contained under /Flightgear/data/, and that they are both "temporary" solutions which are only good as long as you continue to use the same joystick. If you should change joysticks, you will have to re-employ this solution to allow Flightgear to assign the appropriate "new" XML bindings.

Wordpad is the recommended Windows application with which to do the modification, although Notepad or any other text-based editor usually suffices. Wordpad is usually a better choice because of a difference in the way line-feeds and carriage-returns are represented in one versus the other, but aside from some formatting issues, Notepad should work out okay.

a. Force the Name issue.
The first solution to this issue is to add the name "Microsoft PC-Joystick Driver" to whichever XML bindings file you wish to use. In the above example, you have a Saitek ST290 Pro joystick and would like to use the bindings file which Flightgear provides. In /Flightgear/data/Input/Joysticks/Saitek/ST290-Pro.xml, where you see the following:
Code: Select all
 <name>Saitek ST290 Pro</name>
 <name>SAITEK Saitek ST290 Pro</name>

... you would want to add a third <name> tag, the result reading as thus:
Code: Select all
 <name>Saitek ST290 Pro</name>
 <name>SAITEK Saitek ST290 Pro</name>
 <name>Microsoft PC-Joystick Driver</name>

Thereafter, when Flightgear reads your joystick name as "Microsoft PC-Joystick Driver" and finds the tag <name>Microsoft PC-Joystick Driver</name> in /Flightgear/data/Input/Joysticks/Saitek/ST290-Pro.xml, it will then use that file to assign controls.

b. Override the automatic selection.
Recall in the initial explanation that before Flightgear begins scanning through XML files in /Flightgear/data/Input/Joysticks/, it first checks /Flightgear/data/joysticks.xml for any overriding instructions? This is where you can manually supersede its automatic assignment with a manually-specified filename. You will need to know which virtual position your joystick is in; js_demo will tell you, but if not, you can usually assume "0" and then try other values if the results don't seem to work out. To specify the joystick in position "0" is a Saitek ST-290 Pro, and that you wish to use the XML bindings file Flightgear provides for that model, you would add the following to /Flightgear/data/joysticks.xml, in between the <PropertyList> tags:
Code: Select all
<PropertyList>
<js n="0" include="Input/Joysticks/Saitek/ST290-Pro.xml"/>
</PropertyList>

EDIT: ... just make sure that the <!-- and --> tags (which tell the program to ignore what's between, as a "comment" or "example") are removed. You want that section of code to be considered "live" code by the program, not a "comment" or "example."

c. Create your own custom control assignments.
My preferred way to deal with joystick axis and button assignments has been to create my own customized bindings file and point js n="0" to it using the method shown above. I start by opening the bindings file for my model of joystick and then re-saving it as /Flightgear/data/Input/Joysticks/custom.xml, and then changing /Flightgear/data/joysticks.xml to read as follows (and you can remove EVERYTHING except what's shown here):
Code: Select all
<PropertyList>
<js n="0" include="Input/Joysticks/custom.xml"/>
</PropertyList>


In that custom.xml file, I then take note of what controls are currently assigned to each axis and button and make notes as to where each one is physically located. (NOTE: some joysticks have numbers printed on each button; however, those numbers do not necessarily correspond to the numbers that the software assigns to them. The ST290 Pro is an excellent example of this.) Alternately I could use js_demo.exe, if available, to determine which axis and which button are given what numbers.

Then, I use the existing XML file as a template, but modify what appears between each set of <binding></binding> tags to suit my needs. There are many examples of how to accomplish each desired action, and these may be found in the other included XML joystick binding files, or also here on the forums. I personally have borrowed (and further adapted) many ideas I have discovered here on the forums, as well as exploring some of my own, to create what I believe to be a very high-functioning set of controls for the ST290 Pro, even though it has a very limited number of buttons. Here are some I've created or seen in the forum, some of which I have used and some I have not:

    For joysticks that have no rudder control (twist axis), I've seen (a) a binding which automatically changes the left/right stick movement to control the rudder instead of the ailerons when on the ground, as well as (b) a binding that allowed for "auto-coordination" of aileron and rudder controls ONLY while a certain button was depressed (again, to improve ground steering).

    For joysticks which have the rudder on twist but don't have the ability to command left- and right-hand wheelbrakes independently (i.e. the wheelbrakes are only available in an on-off mode), I personally have a script with a formula so that when I am simultaneously braking and steering with rudder, the wheelbrakes are applied differentially to assist in ground steering.

    For use with FGCOM (voice communication add-on), I have personally mapped the push-to-talk onto the joystick trigger.

    For gear-up and down, I personally have a binding which coordinates this with the arrestor hook used in aircraft carrier operations. I also include a ground-altitude check, so that the gear cannot be commanded "up" via joystick when the aircraft is on the ground.

    I have seen a binding for a button which, while depressed momentarily, allows the pilot view (cockpit view) to "glance down" at the instrument panel -- a very useful function in aircraft where certain critical gauges are below the default field-of-view.

    I have even seen a very complex set of bindings which turn one or more buttons into "Alternate" command buttons -- meaning, that the other buttons have one set of effects if the "Alternate" button is not pressed, versus different effects if it is!

Please feel free to search the forum for, or else ask for, help in using any of the above ideas or any others of your own which you would like to implement. Virtually any command can be mapped to a joystick button, and virtually any "conditional test" can be added to make that button carry out or not carry out that action, depending, or carry out a different action, or even more than one action, as a result.

4. Further information.
To get additional information or help with joysticks, please see the following:
Last edited by MD-Terp on Fri Dec 18, 2009 7:02 pm, edited 4 times in total.
Cheers,
-Rob.

"Retired" from FlightGear involvement as of July 2010.
viewtopic.php?f=3&t=8809
User avatar
MD-Terp
 
Posts: 2410
Joined: Wed Jan 23, 2008 7:37 am
Location: Baltimore, Maryland, USA
Callsign: N531MD, AVA0025

Re: FAQs: customizing joystick controls; XP/Vista joystick issue

Postby MD-Terp » Sat Jan 03, 2009 2:10 am

I just edited this post's title for some additional clarity -- i.e. the explanation for how to customize controls given here is not supposed to be XP/Vista specific. (The file paths are written in Windows style, but so far as I know, the Mac users should be able to follow along fairly easily, right?)
Cheers,
-Rob.

"Retired" from FlightGear involvement as of July 2010.
viewtopic.php?f=3&t=8809
User avatar
MD-Terp
 
Posts: 2410
Joined: Wed Jan 23, 2008 7:37 am
Location: Baltimore, Maryland, USA
Callsign: N531MD, AVA0025

Re: FAQs: customizing joystick controls; XP/Vista joystick issue

Postby sirlancelot » Sun Jan 18, 2009 5:26 pm

Hi everybody:

Please need your help: I have a SAITEK CYBORG EVO joystick, and it works fine within FG using the "Midifier" options; but I don´t understand why I can adjust mixture, but I can´t adjust propellers.


MD-Terp wrote:Hello all --

This post, written at Stuart's request, is meant to answer two of the forum's frequently asked questions, regarding joystick configuration in Flightgear.

Q1: Why does my joystick seem messed up? I run Flightgear on Windows [XP / Vista].
Q2: How can I change the controls assigned to each button on my joystick?

(EDIT: Even if you are reading this for Q2 and not Q1, you should still read most of it, as the explanation will give you the knowledge necessary to create your own customized controls.)

1. How Flightgear handles joysticks.
In layman's terms, Flightgear firsts attempts to detect whether a joystick is connected, and if so, what it is called. After checking /Flightgear/data/joysticks.xml for any instructions to the contrary, it will then scan through all of the various XML files under /Flightgear/data/Input/Joysticks looking for an XML file which defines "bindings" (i.e. command or control assignments for each axis and button) for that particular joystick. For example, if the stick is being reported as a "Saitek ST290 Pro", Flightgear will come across the file /Flightgear/data/Input/Joysticks/Saitek/ST290-Pro.xml which contains the tags:
Code: Select all
 <name>Saitek ST290 Pro</name>
 <name>SAITEK Saitek ST290 Pro</name>

... and it will use the control assignments found in that file to assign functions to each axis and button.

If it doesn't find an XML file for your particular joystick, it will substitute a "generic" one (/Flightgear/data/Input/Joysticks/Default/) which only maps the basic functions of elevator, aileron, rudder (if available), throttle, brakes, and elevator trim. Those assignments may or may not end up in logical-seeming places for your joystick.

2. The problem, as "caused" by Windows XP/Vista.
It seems as if Windows XP and/or Vista tend to report all joystick names as "Microsoft PC-Joystick Driver" regardless of what they are. This may or may not hold true if the user has taken the time to install the manufacturer's specific driver for that device; all feedback we have received so far seems to indicate that Windows defaults to a "generic" MS driver regardless, but your mileage may vary.

If the name is being mis-reported, this then prevents Flightgear from automatically assigning controls logically (using one of its many pre-defined XML bindings files) based on how the various axis numbers are assigned and how the buttons are laid out. Flightgear will then revert to the "generic" (aka default) bindings. For some joysticks the default file might make perfect sense; for others, it might cause odd behavior.

3. The solution; several different approaches.
There are three main solutions to this issue; however, both are similar in that they involve modifying one or more of the .xml files contained under /Flightgear/data/, and that they are both "temporary" solutions which are only good as long as you continue to use the same joystick. If you should change joysticks, you will have to re-employ this solution to allow Flightgear to assign the appropriate "new" XML bindings.

Wordpad is the recommended Windows application with which to do the modification, although Notepad or any other text-based editor usually suffices. Wordpad is usually a better choice because of a difference in the way line-feeds and carriage-returns are represented in one versus the other, but aside from some formatting issues, Notepad should work out okay.

a. Force the Name issue.
The first solution to this issue is to add the name "Microsoft PC-Joystick Driver" to whichever XML bindings file you wish to use. In the above example, you have a Saitek ST290 Pro joystick and would like to use the bindings file which Flightgear provides. In /Flightgear/data/Input/Joysticks/Saitek/ST290-Pro.xml, where you see the following:
Code: Select all
 <name>Saitek ST290 Pro</name>
 <name>SAITEK Saitek ST290 Pro</name>

... you would want to add a third <name> tag, the result reading as thus:
Code: Select all
 <name>Saitek ST290 Pro</name>
 <name>SAITEK Saitek ST290 Pro</name>
 <name>Microsoft PC-Joystick Driver</name>

Thereafter, when Flightgear reads your joystick name as "Microsoft PC-Joystick Driver" and finds the tag <name>Microsoft PC-Joystick Driver</name> in /Flightgear/data/Input/Joysticks/Saitek/ST290-Pro.xml, it will then use that file to assign controls.

b. Override the automatic selection.
Recall in the initial explanation that before Flightgear begins scanning through XML files in /Flightgear/data/Input/Joysticks/, it first checks /Flightgear/data/joysticks.xml for any overriding instructions? This is where you can manually supersede its automatic assignment with a manually-specified filename. You will need to know which virtual position your joystick is in; js_demo will tell you, but if not, you can usually assume "0" and then try other values if the results don't seem to work out. To specify the joystick in position "0" is a Saitek ST-290 Pro, and that you wish to use the XML bindings file Flightgear provides for that model, you would add the following to /Flightgear/data/joysticks.xml, in between the <PropertyList> tags:
Code: Select all
<js n="0" include="Input/Joysticks/Saitek/ST290-Pro.xml"/>


c. Create your own custom control assignments.
My preferred way to deal with joystick axis and button assignments has been to create my own customized bindings file and point js n="0" to it using the method shown above. I start by opening the bindings file for my model of joystick and then re-saving it as /Flightgear/data/Input/Joysticks/custom.xml, and then changing /Flightgear/data/joysticks.xml to read as follows:
Code: Select all
<PropertyList>
<js n="0" include="Input/Joysticks/custom.xml"/>
</PropertyList>


In that custom.xml file, I then take note of what controls are currently assigned to each axis and button and make notes as to where each one is physically located. (NOTE: some joysticks have numbers printed on each button; however, those numbers do not necessarily correspond to the numbers that the software assigns to them. The ST290 Pro is an excellent example of this.) Alternately I could use js_demo.exe, if available, to determine which axis and which button are given what numbers.

Then, I use the existing XML file as a template, but modify what appears between each set of <binding></binding> tags to suit my needs. There are many examples of how to accomplish each desired action, and these may be found in the other included XML joystick binding files, or also here on the forums. I personally have borrowed (and further adapted) many ideas I have discovered here on the forums, as well as exploring some of my own, to create what I believe to be a very high-functioning set of controls for the ST290 Pro, even though it has a very limited number of buttons. Here are some I've created or seen in the forum, some of which I have used and some I have not:

    For joysticks that have no rudder control (twist axis), I've seen (a) a binding which automatically changes the left/right stick movement to control the rudder instead of the ailerons when on the ground, as well as (b) a binding that allowed for "auto-coordination" of aileron and rudder controls ONLY while a certain button was depressed (again, to improve ground steering).

    For joysticks which have the rudder on twist but don't have the ability to command left- and right-hand wheelbrakes independently (i.e. the wheelbrakes are only available in an on-off mode), I personally have a script with a formula so that when I am simultaneously braking and steering with rudder, the wheelbrakes are applied differentially to assist in ground steering.

    For use with FGCOM (voice communication add-on), I have personally mapped the push-to-talk onto the joystick trigger.

    For gear-up and down, I personally have a binding which coordinates this with the arrestor hook used in aircraft carrier operations. I also include a ground-altitude check, so that the gear cannot be commanded "up" via joystick when the aircraft is on the ground.

    I have seen a binding for a button which, while depressed momentarily, allows the pilot view (cockpit view) to "glance down" at the instrument panel -- a very useful function in aircraft where certain critical gauges are below the default field-of-view.

    I have even seen a very complex set of bindings which turn one or more buttons into "Alternate" command buttons -- meaning, that the other buttons have one set of effects if the "Alternate" button is not pressed, versus different effects if it is!

Please feel free to search the forum for, or else ask for, help in using any of the above ideas or any others of your own which you would like to implement. Virtually any command can be mapped to a joystick button, and virtually any "conditional test" can be added to make that button carry out or not carry out that action, depending, or carry out a different action, or even more than one action, as a result.

4. Further information.
To get additional information or help with joysticks, please see the following:
sirlancelot
 
Posts: 3
Joined: Tue Dec 30, 2008 11:23 pm

Re: FAQs: customizing joystick controls; XP/Vista joystick issue

Postby GrumpyXIII » Tue Jan 20, 2009 2:28 pm

Don't know if this would be any help for further development with the auto detect of the Joystick, but the problem mentioned in

"
2. The problem, as "caused" by Windows XP/Vista.
It seems as if Windows XP and/or Vista tend to report all joystick names as "Microsoft PC-Joystick Driver" regardless of what they are.
"

appears to be caused by the following:

"
It seems that Vista has, without any documented warning, changed the location of this information in the registry ( well, from LOCAL_MACHINE to CURRENT_USER ). This causes M$ not to return the correct name of the joystick, but to return the generic "Microsoft PC-Joystick Driver" string instead for all USB joysticks.
"

Is this auto detecting embedded in the FlightGear programming, or is it an add-on module that is called by the FlightGear program and returns parameters /values to the program? Is it easy to alter?

I'm going to try the "b. Override the automatic selection." to sort out my problem with a Saitek X52 on one USB port and the Saitek Rudder Pro on another port. Wonder if I can get it to work! Fun assured tonight ...

Kind regards
Grumpy
GrumpyXIII
 
Posts: 2
Joined: Tue Jan 20, 2009 2:02 pm

Re: FAQs: customizing joystick controls; XP/Vista joystick issue

Postby Jester » Tue Jan 20, 2009 3:52 pm

Thank you for this information. Joystick handling is done by external library called "plib", and indeed, it looks in HKEY_LOCAL_MACHINE.
Jester
 
Posts: 1191
Joined: Wed Feb 28, 2007 4:53 pm
Location: Hungary
Callsign: BA996,Rescue1
IRC name: Jester01
Version: GIT
OS: Debian Linux

Re: FAQs: customizing joystick controls; XP/Vista joystick issue

Postby Jester » Tue Jan 20, 2009 8:12 pm

Okay, I have made an experimental unofficial mingw-based windows build.
This uses an updated plib for the vista joystick problem. It also contains various patches I happen to be running, including numerous NaN fixes.

Try at your own risk, it might blow up your machine or worse :) Make sure you have a backup.
Feedback for the joystick issue would be welcome, so we can push the change into plib if it really works.
Jester
 
Posts: 1191
Joined: Wed Feb 28, 2007 4:53 pm
Location: Hungary
Callsign: BA996,Rescue1
IRC name: Jester01
Version: GIT
OS: Debian Linux

Re: FAQs: customizing joystick controls; XP/Vista joystick issue

Postby GrumpyXIII » Wed Jan 21, 2009 2:58 pm

Hey Jester,

fast work on the joystick thingy, trying to download your zip, will check it out tonight ...

Meanwhile, the b solution is working like a charm for me. (Still have to figure out which button is linked to what command ... but I'm getting there :D )

I'll let you know.
GrumpyXIII
 
Posts: 2
Joined: Tue Jan 20, 2009 2:02 pm

Re: FAQs: customizing joystick controls; XP/Vista joystick issue

Postby MD-Terp » Thu Jan 22, 2009 8:30 am

GrumpyXIII wrote:Meanwhile, the b solution is working like a charm for me.

Glad to hear you're making your way. Personally, I've found myself not completely satisfied with the default configs for any of the three joysticks I've owned this past year, so I'm loving the ability to code my own preferred assignments. And, the more I learn about scripting, the more multi-functionality I can put into each button, so that by the time I'm done I can pretty much disconnect my keyboard entirely if I want to... :)
Cheers,
-Rob.

"Retired" from FlightGear involvement as of July 2010.
viewtopic.php?f=3&t=8809
User avatar
MD-Terp
 
Posts: 2410
Joined: Wed Jan 23, 2008 7:37 am
Location: Baltimore, Maryland, USA
Callsign: N531MD, AVA0025

Re: FAQs: customizing joystick controls; XP/Vista joystick issue

Postby Wolle » Fri Feb 13, 2009 9:30 pm

Hi all,

I'm currently at my joystick configuration. I never had a look (don't know where to look) on nasal, the fg-property-tree or anything, but I managed to have a button returning to cockpit view, centering view direction and resetting zoom factor. For those who are interested:

Code: Select all
<button n="2">
    <desc>Cockpit View, Reset View Direction, Reset Distances</desc>
    <repeatable>false</repeatable>
    <binding>
        <command>nasal</command>
        <script>
     setprop("/sim/current-view/view-number",0);
          view.resetViewDir();
          view.resetFOV();
          view.resetViewPos();
        </script>
    </binding>
</button>


Now I would like to improve this in the following way:
AS LONG AS the button is held down, zoom in a little and glance down on the panel. When button is released, reset view (as in the code above).
The problem is, that I don't know how to implement an "if-clause" that checks whether the button is pressed. Which properties to check?

I would like to have a look on the code for the below mentioned bindings:

MD-Terp wrote:
    For joysticks that have no rudder control (twist axis), I've seen (a) a binding which automatically changes the left/right stick movement to control the rudder instead of the ailerons when on the ground, as well as (b) a binding that allowed for "auto-coordination" of aileron and rudder controls ONLY while a certain button was depressed (again, to improve ground steering).

    For joysticks which have the rudder on twist but don't have the ability to command left- and right-hand wheelbrakes independently (i.e. the wheelbrakes are only available in an on-off mode), I personally have a script with a formula so that when I am simultaneously braking and steering with rudder, the wheelbrakes are applied differentially to assist in ground steering.

    I have seen a binding for a button which, while depressed momentarily, allows the pilot view (cockpit view) to "glance down" at the instrument panel -- a very useful function in aircraft where certain critical gauges are below the default field-of-view.


Additionally, I would like to add full rudder left/right to 2 buttons, overriding the auto-coordination settings. This way I think one could be able to steer on ground or perform cross wind landings by pressing the buttons repeatedly (each time pressing applies FULL rudder left/right) or continously, but can also use auto-coordination while flying.

It seems to me, that the default keyboard settings override auto-coordination too, but in contrast, they don't apply full rudder, but increase it's deflection by steps.

So I guess I had to do something like that:

Code: Select all
 <button n="7">
  <desc>Move rudder FULL right</desc>
  <repeatable type="bool">true</repeatable>
  <binding>
<!--   <condition>
     <property>/devices/status/joysticks/joystick[0]/button[7]</property>
   </condition>-->
   <command>property-adjust</command>
   <property>/controls/flight/rudder</property>
   <value>1</value>
  </binding>
 </button>


Problem is, that the rudder doesn't come back to center position, as the button is released. When I uncomment the condition, it doesn't work at all. Same thing as above: how to check for a pressed (held down) button?


And as a final question (please note, that I really try to understand and manage that stuff by myself): Where can I get information on the joystick/binding/xml thing? My throttle does work, but 0% axis = 0% throttle and 50% axis = 100% throttle. The last 50% it stays at 100% throttle. How to fix this?

Cheers
Wolle

@mods: If you think this should be placed into a seperate thread... feel free to move it.
Wolle
 
Posts: 98
Joined: Tue Jan 27, 2009 8:45 am

Re: FAQs: customizing joystick controls; XP/Vista joystick issue

Postby sambar » Mon Feb 16, 2009 4:35 pm

Hello,Wolle.


So I guess I had to do something like that:

Code: Select all
    <button n="7">
      <desc>Move rudder FULL right</desc>
      <repeatable type="bool">true</repeatable>
      <binding>
    <!--   <condition>
         <property>/devices/status/joysticks/joystick[0]/button[7]</property>
       </condition>-->
       <command>property-adjust</command>
       <property>/controls/flight/rudder</property>
       <value>1</value>
      </binding>
    </button>


Problem is, that the rudder doesn't come back to center position, as the button is released. When I uncomment the condition, it doesn't work at all. Same thing as above: how to check for a pressed (held down) button?


You must use <mod-up> tag if your hope is rudder come back to center position.

Try this.(not tested yet:but this is modified sample code from /data/Docs/Readme.Joysticks)
Code: Select all
<button n="7">
 <desc>Move rudder FULL right</desc>
   <binding>
    <!--   <condition>
         <property>/devices/status/joysticks/joystick[0]/button[7]</property>
       </condition>-->
    <command>property-assign</command>
    <property>/controls/flight/rudder</property>
     <value type="double">1.0</value>    <!-- rudder are a toggle so 1.0 represents on -->
   </binding>
   <mod-up>
    <binding>
    <command>property-assign</command>
    <property>/controls/flight/rudder</property>
    <value type="double">0.0</value>
   </binding>
  </mod-up>
</button>

Regarts.
#Sorry,bad English!
JA26FB(new callsign) , sambar(old callsign)
sambar
 
Posts: 39
Joined: Sun Feb 17, 2008 10:48 am
Location: Okayama, Japan
Callsign: JA26FB
Version: Git_Next
OS: Ubuntu(Trusty,amd64)

Re: FAQs: customizing joystick controls; XP/Vista joystick issue

Postby Wolle » Mon Feb 16, 2009 9:15 pm

Hello Sambar,

this <mod-up> solution works exactly as I intended! Thank you very much! I used -values 1.0 for full left and 1.0 for full right. And you can manage crosswind landings very well by using those buttons like a flipper - I just tried!

But in order not to spread any confusion: rudders seem NOT to be only a toggle. Just try that solution by using 0.2 for example... the rudder will move only to 20% of its maximum deflection. I knew this in advance, because if you have a look on the keyboard bindings, you'll see, that NUM-0 and NUM-Enter adds or takes away a specific value (e.g. 0.1) to the rudder variable.

The <mod-up> thing also serves very well for my view-button issue. Pressing the button switches to cockpit view (from any other one) and looks down on the panel, releasing gives default view straight forward.
Code: Select all
  <button n="2">
    <desc>cockpit view - glance down at the panel while pressed, then reset view direction and reset zoom when released</desc>
    <repeatable>false</repeatable>
    <binding>
      <command>nasal</command>
      <script>
   setprop("/sim/current-view/view-number",0);
        view.resetViewPos();
        view.resetViewDir();
        setprop("/sim/current-view/field-of-view", 32); <!-- zoom in a little, default is 50 -->
        setprop("/sim/current-view/goal-heading-offset-deg", 354); <!-- looking 6degrees to the right -->
        setprop("/sim/current-view/goal-pitch-offset-deg", -22); <!-- looking 22degrees downward -->
      </script>
    </binding>
    <mod-up>
      <binding>
        <command>nasal</command>
        <script>
     setprop("/sim/current-view/view-number",0);
          view.resetViewDir();
          view.resetFOV();
          view.resetViewPos();
        </script>
      </binding>
    </mod-up>
  </button>


I found these values good for the Seneca II - they might want to be adjusted for use with other planes.

Thanks a lot!

Ciao
Wolle

-----------------
EDIT
------------------

Now, that I seem to have understood a little of this, I've got a new idea! Every time I want to take a look at others in multiplayer mode (just from KSFO tower or searching white planes in winter landscapes in order not to get totally lost) using the coolie hat is very difficult in zoom mode. The standard routine just goes left/right by a constant factor, which isn't adapted to the zoom factor. So I guess, in order to fix that, one might set the factor (in my case it's negative) in the following code to something like

factor = (-1) * (current-fov/default-fov)

(but maybe it's not linear), so it would take smaller steps when changing view directions in zoom mode. I could manage to find the exact equivalents of the above named things in the property tree, but how do I set the factor then? Are algebra formulas allowed in xml or do I have to set up a nasal script, calculating a new variable and then setting the factor (which is which property in this case?)?

Code: Select all
  <axis n="3">
    <desc>View Direction</desc>
    <direction>left</direction>
    <low>
      <repeatable>true</repeatable>
      <binding>
        <command>nasal</command>
        <script>view.panViewDir(1)</script>
      </binding>
    </low>
    <high>
      <repeatable>true</repeatable>
      <binding>
        <command>nasal</command>
        <script>view.panViewDir(-1)</script>
      </binding>
    </high>
    <dead-band type="double">0</dead-band>
    <binding>
      <factor type="double">-1</factor>
    </binding>
  </axis>


Cheers again
Wolle
Wolle
 
Posts: 98
Joined: Tue Jan 27, 2009 8:45 am

Re: FAQs: customizing joystick controls; XP/Vista joystick issue

Postby sambar » Tue Feb 24, 2009 10:49 am

Wolle wrote:Just try that solution by using 0.2 for example... the rudder will move only to 20% of its maximum deflection. I knew this in advance, because if you have a look on the keyboard bindings, you'll see, that NUM-0 and NUM-Enter adds or takes away a specific value (e.g. 0.1) to the rudder variable.


Are you want increase/decrease value each push button?
if so,use this code.
Code: Select all
<button n="7">                        <!-- target a button -->
 <desc>Move rudder right 0.1</desc>  <!-- optional description -->
 <repeatable>true</repeatable>  <!-- Ok, repeatable is outside the command manager too -->
  <binding>                           <!-- Open the "binding" node of the tree-->
   <command>property-adjust</command>           <!-- pick a command type to bind -->
   <property>/controls/flight/rudder</property>   <!-- target a property -->
   <step>0.1</step>
  </binding>
</button>



"Move rudder left" was chenge <step> value.(mean step == -1 * step for move rudder right

note:fgroot/Docs/Readme.joysticks.html is useful document (and include good sample code.)
Regarts.
#Sorry,bad English!
JA26FB(new callsign) , sambar(old callsign)
sambar
 
Posts: 39
Joined: Sun Feb 17, 2008 10:48 am
Location: Okayama, Japan
Callsign: JA26FB
Version: Git_Next
OS: Ubuntu(Trusty,amd64)

Re: FAQs: customizing joystick controls; XP/Vista joystick issue

Postby tbaac » Tue Mar 03, 2009 8:05 pm

Hi

I am trying to learn control using the mouse. I've gathered that when taking off I can either use comma and dot to aim down the runway, or left mouse button to use mouse for the rudder.
Are there any spare letter keys that I can reassign rudder keys to for in the air?

Anyway, sorry, here is my main question regarding controls configuration: (I've searched these forums and google and couldn't find it, sorry)

Can I use the mouse scroll wheel to control throttle up and throttle down? (hopefully by editing mice.xml and adding the scroll wheel)

Is this possible and what would I need to add?

The reason is that obviously using pageup and pagedown for throttle is a little less friendly and slower than using a joystick.

Also, any good mice for controlling FG and is there a general opinion that joysticks are a far better choice?

Thanks :D
tbaac
 
Posts: 5
Joined: Mon Jul 21, 2008 9:19 pm

Re: FAQs: customizing joystick controls; XP/Vista joystick issue

Postby Jester » Tue Mar 03, 2009 8:12 pm

Reading the mice.xml shows that the scroll wheel is bound to elevator trim. You can of course replace that with the throttle, just copy the relevant binding from the keyboard.xml.
Rudder is by default numeric keypad 0 and enter, you can remap them as you like.
Yeah, a joystick is considered better, simply because of realism if nothing else.
Jester
 
Posts: 1191
Joined: Wed Feb 28, 2007 4:53 pm
Location: Hungary
Callsign: BA996,Rescue1
IRC name: Jester01
Version: GIT
OS: Debian Linux

Re: FAQs: customizing joystick controls; XP/Vista joystick issue

Postby tbaac » Tue Mar 03, 2009 9:11 pm

Thanks for the reply Jester :D

I hadn't realised that it was buttons 3 & 4 until just now, I thought that they were just special buttons that my cheap mouse didn't have :mrgreen:
tbaac
 
Posts: 5
Joined: Mon Jul 21, 2008 9:19 pm

Next

Return to Hardware

Who is online

Users browsing this forum: No registered users and 2 guests