[Flightgear-devel] Re: [PATCH] CH Pro Yoke USB XML patch

2005-12-14 Thread Vassilii Khachaturov
And now comes the attachment... Sorry.

Vassilii
Index: ../data/Input/Joysticks/CH/pro-yoke-usb.xml
===
RCS file: /var/cvs/FlightGear-0.9/data/Input/Joysticks/CH/pro-yoke-usb.xml,v
retrieving revision 1.19
diff -u -p -r1.19 pro-yoke-usb.xml
--- ../data/Input/Joysticks/CH/pro-yoke-usb.xml 22 Jun 2005 13:08:02 -  
1.19
+++ ../data/Input/Joysticks/CH/pro-yoke-usb.xml 14 Dec 2005 20:17:06 -
@@ -4,6 +4,33 @@
 
  nameCH PRODUCTS CH FLIGHT SIM YOKE USB /name
  nameCH FLIGHT SIM YOKE USB /name
+ nasal
+  script![CDATA[
+   view_mod = 0;
+   reset_view = func {
+ setprop(/sim/current-view/field-of-view, 
+   getprop(/sim/view/config/default-field-of-view-deg));
+ view_mod = 0;
+   }
+   if (props.globals.getNode(/rotors) != nil) {
+   disable_pref = 
+   
props.globals.getNode(/input/joysticks/disable-cyclic-yoke);
+   if (disable_pref != nil and disable_pref.getBoolValue()) {
+grove = props.globals.getNode(this);
+
+grove.getNode(axis[0]).removeChildren(binding);
+grove.getNode(axis[1]).removeChildren(binding);
+   }
+   else {
+   print (Forcing cyclic control with your yoke. Change 
by adding\n
+   ~ \tdisable-cyclic-yoke 
type=\bool\true/disable-cyclic-yoke
+   ~ \nto your joysticks.xml (the buttons/collective 
control will still work then!)\n);
+   }
+   }
+  ]]
+  /script
+ /nasal
+
 
  axis n=0
   descAileron/desc
@@ -110,7 +137,7 @@
binding
 commandproperty-adjust/command
 property/sim/current-view/goal-pitch-offset-deg/property
-step type=double2.0/step
+step type=double-2.0/step
/binding
   /low
   high
@@ -118,29 +145,25 @@
binding
 commandproperty-adjust/command
 property/sim/current-view/goal-pitch-offset-deg/property
-step type=double-2.0/step
+step type=double2.0/step
/binding
   /high
  /axis
 
  button n=0
-descFire Starter on Selected Engine(s)/desc
+  repeatablefalse/repeatable
+  descScroll in reverse through views./desc
   binding
commandnasal/command
-   scriptcontrols.startEngine()/script
+   scriptview.stepView(-1)/script
   /binding
-  mod-up
-   binding
-commandnasal/command
-scriptprops.setAll(/controls/engines/engine, starter, 0)/script
-   /binding
-  /mod-up 
  /button
 
 button n=1
   repeatablefalse/repeatable
   binding
-   commandview-cycle/command
+   commandnasal/command
+   scriptview.stepView(1)/script
   /binding
  /button
 
@@ -221,31 +244,46 @@
  /button
 
  button n=8
-  repeatabletrue/repeatable
-   binding
-commandproperty-adjust/command
-property/controls/engines/engine[0]/boost/property
-step type=double+0.01/step
-   /binding
+  descDecrease field of view./desc
+  repeatable type=boolfalse/repeatable
+  binding
+   commandnasal/command
+   script![CDATA[
+ view.decrease(); 
+ if(view_mod0) { reset_view(); } else { view_mod = -1; }
+   ]]
+   /script
+  /binding
+  mod-up
binding
-commandproperty-adjust/command
-property/controls/engines/engine[1]/boost/property
-step type=double+0.01/step
+commandnasal/command
+script![CDATA[
+  if (view_mod0) { view_mod += 1;} 
+]]/script
/binding
+  /mod-up
  /button
 
  button n=9
-  repeatabletrue/repeatable
-   binding
-commandproperty-adjust/command
-property/controls/engines/engine[0]/boost/property
-step type=double-0.01/step
-   /binding
+  descIncrease field of view./desc
+  repeatable type=boolfalse/repeatable
+  binding
+   commandnasal/command
+   script![CDATA[ 
+view.increase(); 
+   if(view_mod0) { reset_view(); } else { view_mod = 1; }
+   ]]
+   /script
+  /binding
+  mod-up
binding
-commandproperty-adjust/command
-property/controls/engines/engine[1]/boost/property
-step type=double-0.01/step
+commandnasal/command
+script![CDATA[ 
+   if (view_mod0) { view_mod -= 1;} 
+]]
+/script
/binding
+  /mod-up
  /button
 
   button n=10
Index: ../data/joysticks.xml
===
RCS file: /var/cvs/FlightGear-0.9/data/joysticks.xml,v
retrieving revision 1.34
diff -u -p -r1.34 joysticks.xml
--- ../data/joysticks.xml   24 Nov 2005 13:04:31 -  1.34
+++ ../data/joysticks.xml   14 Dec 2005 20:17:59 -
@@ -20,6 +20,7 @@
 
js n=0 include=Input/Joysticks/Local/joystick_0.xml/
 --
+   disable-cyclic-yoke type=boolfalsedisable-cyclic-yoke
 
js-named/ !-- dummy to keep SimGear happy --
 /PropertyList
___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

[Flightgear-devel] Re: [PATCH] CH Pro Yoke USB XML patch

2005-12-14 Thread Vassilii Khachaturov
Following Melchior's suggestions of not disabling the axis0/1
as somebody might want to fly a rotorcraft with the yoke nevertheless,
I have modified the patch. Here's what it does now:

 1) it's really difficult to fly a helicopter with the yoke,
 but one can make good use of the throttle as the collective.
 If one wants to fly and use the mouse as the cyclic control,
 it's impossible unless the yoke doesn't send the axis0/1 position
 as aileron/elevator control bindings. Thus, the patched file
 checks at startup if the /rotors property exists (thanks to Melchior
 for the tip on what to check!) and then ruthlessly removes
 the bindings at runtime.
...if the /input/joysticks/disable-cyclic-yoke property is set to true.
Otherwise, it prints a message on the NASAL's stdout:
 Forcing cyclic control with your yoke. Change by adding
 disable-cyclic-yoke type=booltrue/disable-cyclic-yoke
 to your joysticks.xml

I've also included a patch to the joysticks.xml to provide the
default false (current behaviour); note that if somebody doesn't
have the property node at all, it'll work as well.

(I initially thought of using the menu for doing this (and have it
disabled unless /rotors are present), but then
I realized how annoying this must be for somebody who disables
(or enables - depending on the default) this thing on every startup,
and thus understood this should be a 1-time preference thing).

 2) the view pitch change is reversed so that the hat movement
 now corresponds to one's head (view) movement (tilting it forward means
 tilting your head forward)

About this one I think the important thing is to be consistent about all
the joysticks. I wonder how other joysticks with the hat thing are mapped?

 3) remap of some buttons:
 #0: instead of firing the starter, this one cycles the views in the
 reverse direction

I think this is pretty safe to do along my patch, because starter is a
pretty much one-time thing, whereas the view change is really handy to
do while flying w/o removing the hands off the yoke.

 #1: this one uses the nasal view cycle wrapper instead of the old
 view-cycle command, thus we get the tip popup with the new view name
 #8/#9: these get to work as x/X on the keyboard, and pressing them
 together gives the same as Ctrl-X on the keyboard. For this,
 I removed the /controls/engines/engine[?]/boost control bound to them

Here I really don't know what to do, and would be happy to hear David's
and Erik's opinion first of all, as those having priority over mapping
this hardware. (Actually, I'd love their and others' input on
everything else in the patch as well, but here I am telling in advance
that I am at a loss).

The aircrafts affected are
b29 (but it has 4 engines which are not selectable individually
w/o the keyboard, and the current binding was broken anyway for b29
as it only moves the 1st 2 engines' boost!)
dc3
p51d
Hurricane
Spitfire

For all the other aircraft the buttons remained wasted anyway.
It would be possible to create an ugly if to just remap around
these 5 aircraft (or maybe if the boost control is present),
or if the original authors don't object, just change the default
to what the patch proposes.

Safe flying,
Vassilii


___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d


[Flightgear-devel] Re: [PATCH] CH Pro Yoke USB XML patch

2005-12-14 Thread Melchior FRANZ
* Vassilii Khachaturov -- Wednesday 14 December 2005 21:41:
 And now comes the attachment... Sorry.

1) You didn't even try the patch. I didn't either, but I see that
   it can't work. Hint: xmllint  :-}

2) Polluting joysticks.xml with driver specific stuff is a no-go.
   Drivers need to be self-contained, and must not spread their
   internals elsewhere. (You can check in the nasal init block
   if the property exists, and if so, which value it has.)

m.



PS: I still don't like the whole idea.  :-

___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d


Re: [Flightgear-devel] Re: [PATCH] CH Pro Yoke USB XML patch

2005-12-14 Thread Vassilii Khachaturov
 1) You didn't even try the patch. I didn't either, but I see that
it can't work. Hint: xmllint  :-}

I don't know how you see that, because I picked it off working tree.
I tested after that with the new property set to false, true, and
absent.

If you mean the markup in the print statement, it's harmless as
it's wrapped with a CDATA block.

 2) Polluting joysticks.xml with driver specific stuff is a no-go.
Drivers need to be self-contained, and must not spread their
internals elsewhere. (You can check in the nasal init block
if the property exists, and if so, which value it has.)

I don't think it is driver specific --- since there may be other
yokes, not just CH Products' one. Also, even if you say it should
be a per-driver thing, I didn't understand which property do you
suggest to check instead.

 PS: I still don't like the whole idea.  :-

What is so wrong? Asking the developers if the button defaults I propose
are more sensible, or the idea of disabling the cyclic control via
the yoke so that the rotorcraft flying is more real? or the way
via which the disablement is customized even in the revised version?

Constructive criticism welcome.

V.


___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d


Re: [Flightgear-devel] Re: [PATCH] CH Pro Yoke USB XML patch

2005-12-14 Thread Vassilii Khachaturov
oh, I see what you mean -- the closing tag in the joystick.xml file.
Strange thing I didn't caught it while testing...

Vassilii


___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d


Re: [Flightgear-devel] Re: [PATCH] CH Pro Yoke USB XML patch

2005-12-14 Thread Vassilii Khachaturov
 oh, I see what you mean -- the closing tag in the joystick.xml file.
 Strange thing I didn't caught it while testing...

I know what happened. First, I tested it without the joystick.xml change
and it worked (yoke controls the cyclic). Then I put the true in, and it
worked (yoke control of cyclic disabled). Then I changed
it to what you have seen, and it still was controlling the cyclic,
yet in the very startup (which had scrolled off my screen) there
was an XML parser warning (which didn't harm the rest of the startup).

V.


___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d


[Flightgear-devel] Re: [PATCH] CH Pro Yoke USB XML patch

2005-12-14 Thread Melchior FRANZ
* Vassilii Khachaturov -- Wednesday 14 December 2005 23:13:
  1) You didn't even try the patch. I didn't either, but I see that
 it can't work. Hint: xmllint  :-}
 
 I don't know how you see that,

+   disable-cyclic-yoke type=boolfalsedisable-cyclic-yoke
  ^^^

m.

___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d


[Flightgear-devel] Re: [PATCH] CH Pro Yoke USB XML patch

2005-12-05 Thread Melchior FRANZ
We discussed it a bit on irc://irc.flightgear.org/flightgear
already ...

* Vassilii Khachaturov -- Saturday 03 December 2005 02:52:
 1) it's really difficult to fly a helicopter with the yoke,
 but one can make good use of the throttle as the collective.
 If one wants to fly and use the mouse as the cyclic control,
 it's impossible [...]

And if not? I someone *wants* to use the yoke for helicopters, too?
Then this joystick driver will be/look quite broken and inconsistent
with every other js driver. It's a matter of personal preferences,
and I would only commit bugfixes (e.g. nasalifying throttle, etc.),
additions (more names), or changes on which the original submitter
agrees, especially if this is a fgfs core developer (David). It
would also be fine if at least a few users of this js agree with the
changes. But I won't replace the original submitter's personal
preferences with someone else's preferences. The zooming function
makes sense, and I like the way how the axes are disabled. But I
don't like *that* they are disabled. I'll look away, though, if
someone else commits it.  :-)

m.

___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d