Board index FlightGear Support Hardware

Bug in joystick dialog FG 3.0

Joysticks, pedals, monitors.

Bug in joystick dialog FG 3.0

Postby hvengel » Fri Mar 07, 2014 2:59 am

I used the 3.0 joystick dialog to set up the elevator trim controls to use an axis on my stick. But I found it was not working. I did some investigating and found that the XML created by the dialog was setting things up like a button rather than an axis.

It should have done something like this:

Code: Select all
  <axis n="2">
    <desc type="string">Elevator Trim</desc>
    <binding>
      <command type="string">property-scale</command>
      <property type="string">/controls/flight/elevator-trim</property>
      <dead-band type="double">0</dead-band>
      <factor type="double">-1</factor>
      <offset type="double">0</offset>
    </binding>
  </axis>


The key here is that this is doing a property-scale command.

But instead it did this:

Code: Select all
  <axis n="2">
    <desc type="string">Elevator Trim</desc>
    <low>
      <binding>
        <command type="string">nasal</command>
        <script type="string">controls.elevatorTrim(-1);</script>
      </binding>
    </low>
    <high>
      <binding>
        <command type="string">nasal</command>
        <script type="string">controls.elevatorTrim(1);</script>
      </binding>
    </high>
  </axis>


Which is clearly a button setup rather than an axis setup since it is using <high> and <low> and is not doing anything that would allow the axis to actually control the value. The above would probably work for a fake joystick axis that only has 3 values 1, 0 and -1. But it does not work for a real axis.

2.12 didn't have this issue. So this is a new bug.
hvengel
Retired
 
Posts: 1127
Joined: Sun Dec 24, 2006 4:35 am
Location: Minden Nevada

Re: Bug in joystick dialog FG 3.0

Postby Johan G » Fri Mar 07, 2014 6:49 pm

That might be worthy of a bug report. I wonder if the problem in this topic is because of this as well.
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: 6237
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Bug in joystick dialog FG 3.0

Postby Philosopher » Fri Mar 07, 2014 7:18 pm

FWIW, it hasn't really changed since Stuart originally committed it. There's our stalled project to revamp it, which would use Canvas and have more options: https://gitorious.org/fgjoystickgui/fgjoystickgui. We kinda ran out of steam, I think, so it would be great if someone else would help out - not necessarily you, hvengel, but whoever we could snag. (I'm currently working on other Nasal things though, but I could certainly help out again.) I personally think the right choice is to have both options - one proportional for your use, one ternary for hat switches - maybe exposing a simple sub-option to select (but that pretty much requires Canvas to generate another dialog, and hence why I would recommend sticking with the fgjoystickgui project to improve the whole dialog, versus just adding patches, so that we can really make it more configurable and flexible).

But if you want a short-term solution which could go into Git now, just copy these lines and add "-trim":
https://gitorious.org/fg/fgdata/source/ ... s#L255-257
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1588
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: Bug in joystick dialog FG 3.0

Postby hvengel » Fri Mar 07, 2014 8:13 pm

The code looks fairly simple and it is apparent that it would do what it is doing. I think that the "best" solution would be to have the code detect what kind of axis it is currently configuring for setting trim (or anything else for that matter) and then use the correct binding for that axis type. So if the axis is one that scales it used the scale binding and if it is a high low axis it uses the high low binding. But if it is not possible to figure out what kind of axis is being configure allowing the user to set the type would be OK as well.

Since I can commit changes to fgdata I will have a look at this and see if I can get this working better.
hvengel
Retired
 
Posts: 1127
Joined: Sun Dec 24, 2006 4:35 am
Location: Minden Nevada

Re: Bug in joystick dialog FG 3.0

Postby Philosopher » Fri Mar 07, 2014 8:26 pm

The only way to detect is to have the user move the corresponding axis and see if you get values other than -1, 0, 1, but I'm not too fond of that. Otherwise, FG doesn't know the difference. (Well, actually... Windows reserves the top axes - something like 7 & 8 IIRC - for a hat, but that's a bad hack to detect ;))
Thanks,
Philosopher
(inactive but lurking occasionally...)
Philosopher
 
Posts: 1588
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: Bug in joystick dialog FG 3.0

Postby hvengel » Fri Mar 07, 2014 8:52 pm

OK so it needs a radio button for each axis to allow the user to select the axis type.
hvengel
Retired
 
Posts: 1127
Joined: Sun Dec 24, 2006 4:35 am
Location: Minden Nevada


Return to Hardware

Who is online

Users browsing this forum: No registered users and 2 guests