Board index FlightGear Support Hardware

FAQs: customizing joystick controls; XP/Vista joystick issue

Joysticks, pedals, monitors.

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

Postby simong » Sun Feb 21, 2010 6:21 pm

This is a question concerning xml joystick remapping, i'm not sure if it belongs here.
I fly with a logitech Extreme 3D Pro joystick. It runs well and i have done some remapping on it in the past. (changing a button to the PTT command, etc.) I am now trying to make it that so when i push a button, it will command FGFS to "press" the 'e' key. I'm doing this for the bombable dogfighting, and instead of only being able to configure it for one aircraft at a time, i'd like to do it this way so it works for any aircraft.
Thanks, Simong
EDIT: Does this have to do with scripting or is there a more simple xml binding that can be used?
simong
 
Posts: 62
Joined: Sun Feb 21, 2010 6:14 pm

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

Postby sim » Wed Feb 24, 2010 12:55 pm

OK Simong,
The answer is no you can't. Although you might have format editor to specify "e" for one of your buttons using software from your stick maker. Not clear what you expect "e" to do since you don't say (something to do with armaments presumably). Wouldn't recommend the format editing using "e" anyway as it does not mix well with stick xml scripting which gives better results, without knocking out alternate uses for that button using modifiers, if only you can tell us what function you intend that button to perform. The answer to your question is a question. What are you flying and what do you want this button to do?
Cheers, sim
User avatar
sim
 
Posts: 1431
Joined: Tue Jun 30, 2009 3:13 pm
Location: Shropshire England
Callsign: Fly4Fun
Version: 0.9.10 up
OS: 64 Win 10 HD6450

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

Postby simong » Thu Feb 25, 2010 12:11 am

Alrighty,
What i'm working with is the bombable patch. Every aircraft that is equipped with bombable includes a script that fires the weapons when the 'e' key is pressed. What i'm trying to do is instead of assigning (with xml) the button of my joystick so that instead of running the script that will fire the weapons on one aircraft, it will give fgfs the same command as if i had pressed the 'e' key. The purpose is so that it will work with ALL bombable aircraft, instead of just the one i specify.
Simong
simong
 
Posts: 62
Joined: Sun Feb 21, 2010 6:14 pm

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

Postby MD-Terp » Thu Feb 25, 2010 1:35 am

This may or may not help -- but I found that the arrestor hook as well as thrust reversers are dealt with differently on YASim aircraft than on JSBSim aircraft. To make my binding work with both types, I basically include both commands in my button binding. One is ignored and one is effective, depending on which aircraft I happen to be flying at the time. (Note that I have one button that controls both, depending on altitude):
Code: Select all
<button n="10">
<desc>Hook down, or deploy reversers</desc>
<repeatable>false</repeatable>
<binding>
<command>nasal</command>
<script>
if (getprop("/position/altitude-agl-ft") > 100)
  {
    setprop("/controls/gear/tailhook",1);
    setprop("/fdm/jsbsim/systems/hook/tailhook-cmd-norm",1)
  }
else
  {
    setprop("/controls/engines/engine[0]/reverser", 1);
    setprop("/controls/engines/engine[1]/reverser", 1);
    setprop("/controls/engines/engine[2]/reverser", 1);
    setprop("/controls/engines/engine[3]/reverser", 1);
    setprop("/fdm/jsbsim/systems/reverser/command", 1);
  }
</script>
</binding>
</button>

You might be able to employ a similar approach to make your button effective on multiple aircraft.
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 simong » Thu Feb 25, 2010 2:57 am

MD-Terp,
That worked great! Thank you so much :D
Simong
simong
 
Posts: 62
Joined: Sun Feb 21, 2010 6:14 pm

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

Postby redneck » Mon Mar 01, 2010 1:55 am

Here's an easy one (well, not for me lol). I want to make button 2 reset my view.
Your help is appreciated.
Never mind, I found a solution.
Call Signs: redneck, ATCredn (unspecified freq atc)
FGFSCopilot
FGFSCopilotATCEdition
System Specs
Model: Alienware M15x, OS: Windows 7 Professional 64-bit, RAM: 3 GB, CPU: Intel i3 quad core at 2.4 GHz, GPU: Nvidea GeForce GTX 460M 1.5 GB GDDR5
redneck
 
Posts: 3617
Joined: Mon Feb 02, 2009 3:17 am
Location: Pennsylvania, USA
Version: 240

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

Postby Mitchell0001 » Fri Apr 09, 2010 4:17 pm

Could someone please help me with how to make a joystick button fire the starter, I tried:
Code: Select all
 <button n="2">
  <desc>Fire Starter on Selected Engine(s)</desc>
  <binding>
   <command>nasal</command>
   <script>controls.startEngine(1)</script>
  </binding>
 </button>

but it didnt work.

Thanks
Mitchell0001
 
Posts: 14
Joined: Fri Apr 09, 2010 2:55 pm

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

Postby sim » Sun Apr 11, 2010 1:00 pm

You missed the final semi-colon i.e. ; </script>
Are you sure the button itself is making contact? Try again on another button you know is working.
User avatar
sim
 
Posts: 1431
Joined: Tue Jun 30, 2009 3:13 pm
Location: Shropshire England
Callsign: Fly4Fun
Version: 0.9.10 up
OS: 64 Win 10 HD6450

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

Postby TrainsCPC » Sun Jun 13, 2010 12:15 am

All the above discussion is fascinating and even informative, but one bit of advice I cannot agree with more is - if you are going to modify a file, make a copy first and put it in a safe place ! Then, when your computer goes pair-shaped, you can always reinstate the original, even if it didn't do what you wanted it to.
My problem is that Flight Gear doesn't seem to want to recognise my joystick - a Cyborg Gold 3d USB - at all. Control panel/ Game controllers recognises it; MS FSX and FS 2004 recognise it; as do CFS 1, 2 and 3; even Ilyushin2 recognises it, and that's Joe Stalin's ! But every time I fire up Flight Gear, I have no rudder control ! This is a bit of a handicap, and checking file/ . . . / inputs I find joystick name 'Cyborg 3d USB', joystick = default. JS_DEMO demo lists it, even though the axis are not in the exact sequence as listed in Franz Melchior's Cyborg . . .xml file .
I think Flight Gear is a good sim, with huge potential, but it can drive you nuts at times. Still, I shall persist. I am convinced I can work out some coding that allows me to use my joystick to work my rudder, and allow me to look left and right out of the cockpit. One of the nicest things about Flight Gear though, is if you do make so many amendments you cannot put it back to a working condition, it only takes about 10 minutes to do a complete uninstall / re-install !

Chris Cosgrove
TrainsCPC
 
Posts: 1
Joined: Tue Jun 08, 2010 8:53 pm

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

Postby MD-Terp » Sun Jun 13, 2010 6:32 pm

TrainsCPC wrote:My problem is that Flight Gear doesn't seem to want to recognise my joystick - a Cyborg Gold 3d USB - at all. Control panel/ Game controllers recognises it; MS FSX and FS 2004 recognise it; as do CFS 1, 2 and 3; even Ilyushin2 recognises it, and that's Joe Stalin's ! But every time I fire up Flight Gear, I have no rudder control ! This is a bit of a handicap, and checking file/ . . . / inputs I find joystick name 'Cyborg 3d USB', joystick = default. JS_DEMO demo lists it, even though the axis are not in the exact sequence as listed in Franz Melchior's Cyborg . . .xml file .

Chris -- I think you may have glossed over an important part of the above discussion.

You can make all of the mofidication you want to /data/Input/Joysticks/Saitek/Cyborg-Evo.xml -- and none of it'll have any effect if FlightGear is still loading /data/Input/Joysticks/default/joystick.xml.

To fix the problem, you need to modify /data/joysticks.xml and "point" it to the correct bindings file:

<PropertyList>
<js n="0" include="Input/Joysticks/name-of-the-bindings-file-i-want-to-use.xml"/>
</PropertyList>


Hope that's more clear...
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 Bummer » Wed Oct 06, 2010 8:44 am

MD-Terp wrote:To fix the problem, you need to modify /data/joysticks.xml and "point" it to the correct bindings file


All I've ever had to do is make sure there's a 'name' field that specifies the name of the joystick exactly as it appears in js_demo/Joysticks/Input Devices/whatever ...

The end of my joysticks.xml:
Code: Select all
<PropertyList>
<!--
    <js-named include="Input/Joysticks/Local/X45-modified.xml"/>

    <js n="0" include="Input/Joysticks/Local/joystick_0.xml"/>
-->
</PropertyList>


The beginning of my joystick's config file:
Code: Select all
<PropertyList>
    <name type="string">T.Flight Hotas X</name>
    <name type="string">Thrustmaster T.Flight Hotas X</name>
    <name type="string">Hotas X</name>
    <name type="string">Thrustmaster Hotas X</name>


Linux's js_demo shows it as 'Thrustmaster T.Flight Hotas X', while in Windows it shows up as 'Thrustmaster Hotas X'. I've used this .xml in both operating systems, without problems, and without setting anything in joysticks.xml.
Bummer
 
Posts: 30
Joined: Sat May 15, 2010 1:23 am

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

Postby sim » Sun Oct 17, 2010 10:42 pm

Thanks for sharing your thoughts Bummer, prompted by your post ver 2.0.0 finds my AV8R xml ok.
Second name should get ver 1.9.1 to see it to!
Cheers, sim
<PropertyList>
<name type="string">Saitek Aviator Stick</name>
<name type="string">Microsoft PC-joystick driver</name>
<data>
User avatar
sim
 
Posts: 1431
Joined: Tue Jun 30, 2009 3:13 pm
Location: Shropshire England
Callsign: Fly4Fun
Version: 0.9.10 up
OS: 64 Win 10 HD6450

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

Postby callumwk » Tue Aug 30, 2011 12:56 pm

Hi, I know nothing about coding or anything that you have been talking about above :( but when I open flight gear, all of my controls work fine. But the view is constantly rotating/spinning apart from the tower view...but that's understandable. I've put it down to my hat switch as it only has little effect on this rotating and only a few positions of the hat work. I'm using a Saitek Pro Flight System, with a yoke, quadrant,rudder and a switch panel that also doesn't work in flight gear, but I'm not worried about that.


Any Help would be appreciated!

Thanks
Callum
callumwk
 
Posts: 1
Joined: Tue Aug 30, 2011 12:48 pm

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

Postby durk » Tue Aug 30, 2011 4:55 pm

Hi Callum,

The problem is that windows uses different numbers for te joystick axes than linux and/or macOSX. The Saitek yoke configuration supplied with FlightGear had only been tested under linux, and therefore does not work properly for windows. I have very recently committed an update to GIT which solves this problem, which was based on a sample file posted by a forum member. You might be able to pull a snapshot of this file from git:

https://www.gitorious.org/fg/fgdata/trees/master/Input/Joysticks/Saitek

(Just right-click the file you want and select save as might work. But I have to admit never having tried obtaining files from git this way)

Cheers,
Durk
durk
 
Posts: 354
Joined: Mon Nov 17, 2008 2:01 pm
Location: Ghent, Belgium
Callsign: PH-DRK
Version: git
OS: linux

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

Postby EGQK1 » Wed Feb 29, 2012 11:14 am

hi all
would anyone care to correct my homework please



<?xml version="1.0" encoding="utf-8"?>
<!--
************************************************************************
* Bindings for Microsoft SideWinder Joystick.
*
*
* Axis 0: ailerons
* Axis 1: elevator
* Axis 2: throttle
*
* Button 1: guns
* Button 1+2: cannon
* Button 2: brake
* Button 3: left rudder
* Button 4: right rudder
* Button 5: aileron right trim.
* Button 6: elevator down trim
* Button 7: aileron left trim
* Button 8: elevator up trim

************************************************************************
$Id$
-->
<PropertyList>
<name>Microsoft SideWinder Joystick</name>
<axis n="0">
<desc>Aileron</desc>
<binding>
<command>property-scale</command>
<property>/controls/flight/aileron</property>
<squared type="bool">true</squared>
</binding>
</axis>
<axis n="1">
<desc>Elevator</desc>
<binding>
<command>property-scale</command>
<property>/controls/flight/elevator</property>
<factor type="double">-1.0</factor>
<squared type="bool">true</squared>
</binding>
</axis>
<axis n="2">
<desc>Throttle</desc>
<binding>
<command>nasal</command>
<script>controls.throttleAxis(1)</script>
</binding>
</axis>
<button n="2">
<desc>Brakes</desc>
<binding>
<command>nasal</command>
<script>controls.applyBrakes(1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.applyBrakes(0)</script>
</binding>
</mod-up>
</button>
<button n="1">
<desc> trigger guns</desc>
<binding>
<command>nasal</command>
<script>controls.armament.trigger.guns(1, -1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.armament.trigger.guns(0, -1)</script>
</binding>
</mod-up>
</button>
<button n="1+2">
<desc>trigger cannon</desc>
<binding>
<command>nasal</command>
<script>controls.armament.trigger.cannon(1,-1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.armament.trigger.cannon(0,-1)</script>
</binding>
</mod-up>
</button>
<button n="3">
<desc>left rudder</desc>
<binding>
<command>nasal</command>
<script>controls.flight.left rudder(1, 1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.flight.left rudder(0, 1)</script>
</binding>
</mod-up>
</button>
<button n="4">
<desc>right rudder</desc>
<binding>
<command>nasal</command>
<script>controls.flight.right rudder(1, 1)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.flight.right rudder(0, 1)</script>
</binding>
</mod-up>
</button>
<button n="5">
<desc>trim aileron right</desc>
<binding>
<command>nasal</command>
<script>controls.flight.airelon right(1, 0.15)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.flight.airelon right(0, 0.15)</script>
</binding>
</mod-up>
</button>
<button n="6">
<desc>trim elevator down</desc>
<binding>
<command>nasal</command>
<script>controls.flight.elevator down(1, 0.15)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.flight.elevator down(0, 0.15)</script>
</binding>
</mod-up>
</button>
<button n="7">
<desc>trim aileron left</desc>
<binding>
<command>nasal</command>
<script>controls.flight.aileron left(1, 0.15)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.flight.aileron left(0, 0.15)</script>
</binding>
</mod-up>
</button>
<button n="8">
<desc>trim elevator up</desc>
<binding>
<command>nasal</command>
<script>controls.flight.elevator up(1, 0.15)</script>
</binding>
<mod-up>
<binding>
<command>nasal</command>
<script>controls.flight.elevator up(0, 0.15)</script>
</binding>
</mod-up>
</button>
</PropertyList>

as you can clearly see I have verry little idear of what I am doing ! but I am trying, some times very

EGQK1
EGQK1
 
Posts: 3
Joined: Mon Feb 27, 2012 10:14 pm

PreviousNext

Return to Hardware

Who is online

Users browsing this forum: No registered users and 3 guests