[Flightgear-devel] two questions about joysticks and flightgear

2004-05-03 Thread ima . sudonim
js_demo returns the following values for my MacAlly joystick on mac os 
x 10.3.3

JS.0

Axis 0: Ailerons (-0.5 to +0.4)
Axis 1: Elevator (-0.5 to +0.5)
Axis 2: Throttle (-1 to +0.0)
Axis 3:  Horiz. Hat (-1.0 to +1.0)
Axis 4: Vert. Hat (-1.0 to +1.0)
Q1: How can I use the above information to figure out what values 
should go in my xml file? I've been looking at 
data/Docs/README.Joystick.html, but I am probably missing something 
obvious. How can I calculate what the factor should be: when I move the 
stick, it only moves about 1/8th of the way down the HUD even when I'm 
yanking the stick all of the way back/forward/whatever.  Changing the 
factor to 5, 20, 100 doesn't seem to change anything for me.  Also the 
throttle can only change between 50% and 100% throttle via the 
joystick, nothing I change in the XML file seems to have any effect.

Q2:  Is there documentation on the Nasal information? What needs to be 
done to use nasal to control the joystick as shown below (from the 
default joystick)? Is this the official way to go now for joysticks?
	axis n=2
  	descThrottle/desc
  		binding
   		commandnasal/command
   		scriptcontrols.throttleAxis()/script
  		/binding
 	/axis



I am using the following .xml file for my sort-of working joystick:
?xml version=1.0?
!--

Setup for a MacALLY USB iStick joystick with
one stick, one wheel, one digital hat, and four buttons.
Layout:
  Axis 0: ailerons
  Axis 1: elevator
  Axis 2: throttle
  Hat:
Axes 3 and 4
  Button 0: brakes (front button)
  Button 1: center rudder (side button)
  Button 2: trim up
  Button 3: trim down

--
PropertyList

 nameMacAlly USB Joystick /name

 axis n=0
  descAileron/desc
  dead-band type=double0.02/dead-band
  binding
   commandproperty-scale/command
   property/controls/flight/aileron/property
   offset type=double0.0/offset
   factor type=double1.0/factor !-- 1.0 --
  /binding
 /axis
 axis n=1
  descElevator/desc
  dead-band type=double0.02/dead-band
  binding
   commandproperty-scale/command
   property/controls/flight/elevator/property
   offset type=double0.0/offset
   factor type=double1.0/factor
  /binding
 /axis
  axis n=2
  descThrottle/desc
  binding
   commandproperty-scale/command
   property/controls/flight/engines/engine[3]/throttle/property
   offset type=double-1.0/offset   !-- -1.0 --
   factor type=double-0.5/factor   !-- -0.5 --
  /binding
 /axis
  axis n=3
  descRudder/desc
  dead-band type=double0.02/dead-band
  binding
   commandproperty-scale/command
   property/controls/flight/rudder/property
   offset type=double0.0/offset   !-- -1.0 --
   factor type=double1.0/factor   !-- -0.5 --
  /binding
 /axis

!--

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


 axis n=2
  descThrottle/desc
  binding
   commandnasal/command
   scriptcontrols.throttleAxis()/script
  /binding
 /axis

--
 button n=0
  descBrakes/desc
  binding
   commandproperty-assign/command
   property/controls/gear/wheel[0]/brake/property
   value type=double1.0/value
  /binding
  binding
   commandproperty-assign/command
   property/controls/gear/wheel[1]/brake/property
   value type=double1.0/value
  /binding
  binding
   commandproperty-assign/command
   property/controls/gear/wheel[2]/brake/property
   value type=double1.0/value
  /binding
  mod-up
   binding
commandproperty-assign/command
property/controls/gear/wheel[0]/brake/property
value type=double0.0/value
   /binding
   binding
commandproperty-assign/command
property/controls/gear/wheel[1]/brake/property
value type=double0.0/value
   /binding
   binding
commandproperty-assign/command
property/controls/gear/wheel[2]/brake/property
value type=double0.0/value
   /binding
  /mod-up
 /button
 button n=1
  descElevator trimup/desc
  repeatabletrue/repeatable
   binding
   commandproperty-adjust/command
   property/controls/flight/flaps/property
   step type=double0.001/step
  /binding
 /button
 button n=2
  descCenter rudder/desc
  binding
   commandproperty-assign/command
   property/controls/flight/rudder/property
   value type=double0.0/value
  /binding
 /button
 button n=3
  descElevator trim down/desc
  repeatabletrue/repeatable
   binding
   commandproperty-adjust/command
   property/controls/flight/elevator-trim/property
   step type=double0.001/step
  /binding
 /button
/PropertyList

!-- end of MAUSBJS.xml --


Re: [Flightgear-devel] two questions about joysticks and flightgear

2004-05-03 Thread Andy Ross
ima.sudonim wrote:
 Axis 0: Ailerons (-0.5 to +0.4)
 Axis 1: Elevator (-0.5 to +0.5)
 Axis 2: Throttle (-1 to +0.0)

These three all indicate what appears to be a calibration error.
By convention, all axes have always reported between -1 and 1.

 Q2: Is there documentation on the Nasal information? What needs
 to be done to use nasal to control the joystick as shown
 below (from the default joystick)? Is this the official way to
 go now for joysticks?

There isn't much written documentation for the input system
specifically (Nasal documentation in general is at
http://plausible.org/nasal and
http://plausible.org/nasal/flightgear.html).  For the most part,
you can simply copy what you see in other joystick files.

Andy

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