Re: [Flightgear-devel] ANN: Customized Joystick Bindings and Autodetection

2002-07-07 Thread David Megginson

Andy:

Thanks for the info.  I'd be reluctant to put together an
Input/Joysticks/Saitek/X45.xml file that I couldn't actually test.  If
you have a chance to hobble one together some time, I'll be very
grateful.


All the best,


David

-- 
David Megginson, [EMAIL PROTECTED], http://www.megginson.com/

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] ANN: Customized Joystick Bindings and Autodetection

2002-07-07 Thread Andy Ross

David Megginson wrote:
 Thanks for the info.  I'd be reluctant to put together an
 Input/Joysticks/Saitek/X45.xml file that I couldn't actually test.  If
 you have a chance to hobble one together some time, I'll be very
 grateful.

I was afraid you'd say that. :) Here is an X45.xml file that I've
verified to work on my stick.  I've removed all the hacks, leaving
(hopefully) something that is generically useful.

Andy

-- 
Andrew J. RossNextBus Information Systems
Senior Software Engineer  Emeryville, CA
[EMAIL PROTECTED]  http://www.nextbus.com
Men go crazy in conflagrations.  They only get better one by one.
 - Sting (misquoted)


?xml version=1.0?
!--
Only a few auxiliary stick controls have been mapped here:
 + Rocker switch: Rudder
 + Top rotary dial: Mixture
 + Bottom rotary dial:  Prop Advance
 + Top stick hat:   Elevator  Aileron trim
 + Bottom stick hat:View direction
 + Top throttle hat:Flaps  Rudder trim
 + Stick button A:Gear toggle

Axis Numbers:
  0 Roll (positive == right)
  1 Pitch (positive == down/back/nose-up)
  2 top rotary dial on the throttle (positive == CCW)
  3 Rocker switch (rudder control) on the throttle (positive == right)
  4 Throttle (positive == back/down/idle)
  5 Bottom rotary dial on the throttle (positive == CW)
  6 Lower right hat horizontal axis (positive == right)
  7 Lower right hat vertical axis (positive == down)

Button Numbers:
 0 Trigger
 1 Stick top A switch
 2 Stick top B switch
 3 Stick top launch/fire switch
 4 Throttle D switch
 5 Throttle mouse switch (tiny black thumb button)
 6 Stick pinkie switch
 7 Stick front C switch
 8 -+left position   (M1)
 9  +- Throttle mode 3-way switch: middle position (M2)
10 -+right position  (M3)
11 -+left position
12  +- Throttle Aux 3-way switch:  middle position
13 -+right position
14 Upper left hat in up position
15 Upper left hat in right position
16 Upper left hat in down position
17 Upper left hat in left position
18 Throttle forefinger hat in up/back position
19 Throttle forefinger hat in right position
20 Throttle forefinger hat in down/forward position
21 Throttle forefinger hat in left position
22 Throttle thumb hat in up position
23 Throttle thumb hat in right position
24 Throttle thumb hat in down position
25 Throttle thumb hat in left position
--
PropertyList
 nameSaitek Saitek X45/name

 axis n=0
  descAileron/desc
  binding
   commandproperty-scale/command
   property/controls/aileron/property
   squared type=booltrue/squared
  /binding
 /axis

 axis n=1
  descElevator/desc
  binding
   commandproperty-scale/command
   property/controls/elevator/property
   factor type=double-1.0/factor
   squared type=booltrue/squared
  /binding
 /axis

 axis n=3
  descRudder/desc
  binding
   commandproperty-scale/command
   property/controls/rudder/property
  /binding
 /axis

 axis n=4
  descThrottle/desc
  binding
   commandproperty-scale/command
   property/controls/throttle[0]/property
   offset type=double-1.0/offset
   factor type=double-0.5/factor
  /binding
  binding
   commandproperty-scale/command
   property/controls/throttle[1]/property
   offset type=double-1.0/offset
   factor type=double-0.5/factor
  /binding
 /axis

 axis n=2
  descMixture/desc
  binding
   commandproperty-scale/command
   property/controls/mixture[0]/property
   offset type=double-1.0/offset
   factor type=double-0.5/factor
  /binding
  binding
   commandproperty-scale/command
   property/controls/mixture[1]/property
   offset type=double-1.0/offset
   factor type=double-0.5/factor
  /binding
 /axis

 axis n=5
  descPropeller Advance/desc
  binding
   commandproperty-scale/command
   property/controls/propeller-pitch[0]/property
  /binding
  binding
   commandproperty-scale/command
   property/controls/propeller-pitch[1]/property
  /binding
 /axis

 !-- View Direction Hat --

 axis n=6
  descView Direction/desc
  low
   repeatabletrue/repeatable
   binding
commandproperty-adjust/command
property/sim/current-view/goal-heading-offset-deg/property
step type=double1.0/step
   /binding
  /low
  high
   repeatabletrue/repeatable
   binding
commandproperty-adjust/command
property/sim/current-view/goal-heading-offset-deg/property
step type=double-1.0/step
   /binding
  /high
 /axis

 axis n=7
  descView Elevation/desc
  low
   repeatabletrue/repeatable
   binding
commandproperty-adjust/command
property/sim/current-view/goal-pitch-offset-deg/property
step type=double1.0/step
   /binding
  /low
  high
   repeatabletrue/repeatable
   binding
commandproperty-adjust/command
property/sim/current-view/goal-pitch-offset-deg/property
step type=double-1.0/step
   /binding
  /high
 /axis

 !-- The trigger operates the brakes --

 button n=0
  descBrakes/desc
  binding
   commandproperty-assign/command
   

Re: [Flightgear-devel] ANN: Customized Joystick Bindings and Autodetection

2002-07-06 Thread David Megginson

Thanks for the patch -- it's in CVS now.


All the best,


David

-- 
David Megginson, [EMAIL PROTECTED], http://www.megginson.com/

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] ANN: Customized Joystick Bindings and Autodetection

2002-07-06 Thread David Megginson

I've changed the squared default -- thanks for the patch.


All the best,


David

-- 
David Megginson, [EMAIL PROTECTED], http://www.megginson.com/

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] ANN: Customized Joystick Bindings and Autodetection

2002-07-06 Thread Andy Ross

David Megginson wrote:
  Please send me your bindings for your own device.  Under Linux, you
  can find the device name with a command like.

This is a great feature.  Very cool.

Here are button and axis assignments for my Saitek X-45 under Linux.
My actually joystick.xml file is in a terribly hacked state, and
probably not useful to anyone. :)

Note weirdnesses: The first hat acts like a normal hat under linux
-- it maps to two axis values.  The other three hats look like buttons
to the HID driver.  Contrary to documentation, all four hats are fully
8-way capable (this is a good thing, obviously).  The axes are in a
bizarre order -- nothing at all like a normal joystick.  The
coordinate convention for the two rotary dials are different (this
actually isn't so strange, they are both positive==forward as your
fingers interpret them).

Name: Saitek Saitek X45

Axes:
  0 Roll (positive == right)
  1 Pitch (positive == down/back/nose-up)
  2 top rotary dial on the throttle (positive == CCW)
  3 Rocker switch (rudder control) on the throttle (positive == right)
  4 Throttle (positive == back/down/idle)
  5 Bottom rotary dial on the throttle (positive == CW)
  6 Lower right hat horizontal axis (positive == right)
  7 Lower right hat vertical axis (positive == down)

Buttons:
  0 Trigger
  1 Stick top A switch
  2 Stick top B switch
  3 Stick top launch/fire switch
  4 Throttle D switch
  5 Throttle mouse switch (tiny black thumb button)
  6 Stick pinkie switch
  7 Stick front C switch
  8 -+left position   (M1)
  9  +- Throttle mode 3-way switch: middle position (M2)
10 -+right position  (M3)
11 -+left position
12  +- Throttle Aux 3-way switch:  middle position
13 -+right position
14 Upper left hat in up position
15 Upper left hat in right position
16 Upper left hat in down position
17 Upper left hat in left position
18 Throttle forefinger hat in up/back position
19 Throttle forefinger hat in right position
20 Throttle forefinger hat in down/forward position
21 Throttle forefinger hat in left position
22 Throttle thumb hat in up position
23 Throttle thumb hat in right position
24 Throttle thumb hat in down position
25 Throttle thumb hat in left position

-- 
Andrew J. RossNextBus Information Systems
Senior Software Engineer  Emeryville, CA
[EMAIL PROTECTED]  http://www.nextbus.com
Men go crazy in conflagrations.  They only get better one by one.
  - Sting (misquoted)


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] ANN: Customized Joystick Bindings and Autodetection

2002-07-05 Thread Julian Foad

David Megginson wrote:
 
 I've just checked in a new patch for automatic joystick type detection
 (where available).  NOTE: it will work *only* if you have a recent (2
 months or so) CVS version of plib.
 
...
 
 Please send me your bindings for your own device.  Under Linux, you
 can find the device name with a command like
 
   jstest /dev/js0 | less
 
 (You must include any trailing spaces.)

May I offer this patch which will help non-Linux users find their joysticks' names:

  Index: js_demo.cxx
  ===
  RCS file: /var/cvs/FlightGear-0.7/FlightGear/src/Input/js_demo.cxx,v
  retrieving revision 1.1
  diff -u -3 -p -d -r1.1 js_demo.cxx
  --- js_demo.cxx 4 Jun 2001 19:26:53 -   1.1
  +++ js_demo.cxx 5 Jul 2002 17:47:09 -
  @@ -26,9 +26,12 @@ int main ( int, char ** )
 t = 0;
 for ( i = 0; i  Z; i++ )
 { useful[i] = ! ( js[i]-notWorking () );
  -if ( useful[i] )
  +if ( useful[i] ) {
t++;
  -else printf ( Joystick %i not detected\n, i ) ;
  +#ifdef FG_PLIB_JOYSTICK_GETNAME
  + printf ( Joystick %i: \%s\\n, i, js[i]-getName() ) ;
  +#endif
  +} else printf ( Joystick %i not detected\n, i ) ;
 }
 if ( t == 0 ) exit ( 1 ) ;
  

For my Saitek Cyborg 3D Gold USB joystick, that gave:

  Joystick test program.
  ~~
  Joystick 0: Microsoft PC-joystick driver
  Joystick 1 not detected
  ...

which is presumably because I haven't bothered to install Saitek's driver, because the 
default Windows one does the job.  Some other people will have done the same, of 
course, but there's not a lot we can do about it.

On a related note (Windows compatibility), a given joystick's axes are sometimes 
numbered differently under Windows and under Linux.  This is nearly always true for 
the hat switch with the present version of PLIB.  Therefore we should either:
- provide different configurations for the same joystick under different OSs; or
- make PLIB present the axes numbered in the same way under all OSs.

PLIB is supposed to provide cross-platform portability, so obviously the latter should 
be attempted.  It is not a simple bug in PLIB, it is a slightly complicated issue due 
to the different ways the joystick interface is provided by the different OSs, and may 
rely on cooperation from the vendor driver writers.  I will raise the issue on the 
PLIB list.


One more point: it would be good to separate the joystick axis number-to-name mappings 
(axis 0 = left/right, axis 2 = twist, axis 3 = slider, etc) from the name-to-function 
mappings (left/right = ailerons, twist = rudder, etc.).  At least, if we don't 
separate them, we should probably make sure that all of our joystick mapping files 
give the same functions.  It would be silly if users find that the twist axis controls 
rudder when they use some types of joystick, but controls view direction when they use 
other types.

I have hat fwd/back mapped to elevator trim.  Are we standardising on the hat 
controlling view direction (for the supplied bindings; I know I can keep my local 
changes)?

- Julian

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] ANN: Customized Joystick Bindings and Autodetection

2002-07-05 Thread Julian Foad

I (Julian Foad) wrote:
 
 For my Saitek Cyborg 3D Gold USB joystick, that gave:
 
   Joystick test program.
   ~~
   Joystick 0: Microsoft PC-joystick driver
   Joystick 1 not detected
   ...
 
 which is presumably because I haven't bothered to install Saitek's driver, because 
the default Windows one does the job.  Some other people will have done the same, of 
course, but there's not a lot we can do about it.
 

Hmmm... Saitek's driver for the Cyborg 3D Gold USB is called Saitek Gaming 
Extensions (e.g. SGEv3.exe).  This is NOT a joystick driver (the default Windows 
driver is used) but just facilites for customising the joystick for different games.  
I installed it but it did not change the name reported.  Does this happen with all USB 
joysticks?

- Julian

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] ANN: Customized Joystick Bindings and Autodetection

2002-07-05 Thread Julian Foad

David Megginson wrote:
 
 I've just checked in a new patch for automatic joystick type detection
 (where available).  NOTE: it will work *only* if you have a recent (2
 months or so) CVS version of plib.

The present sets of bindings result in the throttle being squared about its centre, 
which is silly.  This is because the squared parameter is not set by the throttle 
binding, but the default is true.  We discussed this before and I think there was 
general agreement that the default should be false on the basis of generality.

Therefore may I request this change to the default (in src/Main/fg_commands.cxx):

  class PropertyCommandState : public SGCommandState
  {
  ...
virtual const SGPropertyNode * getSquared () const 
- { return _squared ? _squared : _dummy_1; }
+ { return _squared ? _squared : _dummy_0; }
  ...
  };

Thanks.

- Julian

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



[Flightgear-devel] ANN: Customized Joystick Bindings and Autodetection

2002-07-04 Thread David Megginson

I've just checked in a new patch for automatic joystick type detection
(where available).  NOTE: it will work *only* if you have a recent (2
months or so) CVS version of plib.

Now, instead of /input/joysticks/js, you can use
/input/joysticks/js-named to create bindings that will be used only
for specific devices; for example, to create bindings for the CH Pro
Yoke USB, you would use this:

  js-named
   nameCH PRODUCTS CH FLIGHT SIM YOKE USB /name
   ...
  /js-named

All of the axis and button bindings are as before.  If no named
bindings are found, FlightGear will revert to the regular js
bindings as a default, using the device number.

In the base package, I've added customized bindings for the four
controllers I have (CH Pro Yoke, CH Pro Pedals, Logitech Wingman
Rumblepad, and Logitech Extreme Digital 3D joystick): take a look at
the joysticks.xml and the Input/Joysticks/ directory in the base
package to see how it's done.

Although it required only a few lines of C++ code, this is a *big*
improvement to FlightGear -- it will allow new users to plug in their
devices and just have them work, out of the box, once we've collected
enough bindings.

Right now, all of the bindings are read into the main property tree.
I'm planning on moving bindings out into a separate property tree and
on some other changes as well, but this should make a good start.

Please send me your bindings for your own device.  Under Linux, you
can find the device name with a command like

  jstest /dev/js0 | less

(You must include any trailing spaces.)


Enjoy!


David

-- 
David Megginson, [EMAIL PROTECTED], http://www.megginson.com/

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel