Chris:
This patch switches the rudder listening to the right property. The one being used now seems to be obsolete for a long time. Additionally it needs to change polarity to operate properly.
- Since joystick.PropertyScaleAxis instances have a 'prop' attribute
indicating the property name, it seems logical to have
joystick.PropertyScaleAxis.parse() set this attribute based on the
property name in its argument ('p').
- This commit also tries to improve readability by using a 'bindingNode'
variable instead of repeatedly calling 'p.getNode("binding", 1)'.
- Commit 5bcf58c7d6 forgot to set the
'inverted' attribute when there was no 'factor' node in the argument's
'binding' node. Fix this.
- Also copy the argument's 'factor' value to the 'factor' instance
attribute for consistency, since joystick.PropertyScaleAxis instances
have such an attribute initialized in the constructor.
As far as I can tell, the dead-band setting belongs to <axis> nodes, not
to <binding> nodes using property-scale. This can be seen in
do_property_scale()'s definition (flightgear/src/Main/fg_commands.cxx)
as well as in fgdata/Docs/README.Joystick.html.
joystick.PropertyScaleAxis creates <dead-band> nodes as children of
<binding> nodes in generated joystick binding files under
$FG_HOME/Input/Joysticks which, AFAICT, are completely useless and thus
confusing. The <dead-band> nodes should be created at a different level
to be effective (cf. FGJoystickInput::postinit() in
flightgear/src/Input/FGJoystickInput.cxx).
This commit removes the 'deadband' attribute from
joystick.PropertyScaleAxis, since it has nothing to do there IMHO.
As can be seen in do_property_scale()'s definition in
flightgear/src/Main/fg_commands.cxx, property-scale rightfully uses a
default factor of 1.0. However, if a joystick axis' property-scale
binding has no 'factor' node defined, and one opens the joystick
configuration dialog, then PropertyScaleAxis.parse() creates an empty
'factor' node that implicitely gets a value of 0. This method is called
by joystick.readConfig() when the joystick-config dialog is opened. This
has the effect of rendering the corresponding joystick axis inoperant.
How to reproduce the bug:
- take a joystick such as the SAITEK CYBORG 3D USB, with its default
binding file from
fgdata/Input/Joysticks/Saitek/Cyborg-Gold-3d-USB.xml (this file uses
property-scale for the aileron, with no explicitely defined factor);
- start FlightGear; move the joystick left or right while looking at
the plane wings -> the ailerons move, it works fine;
- now, open the joystick-config dialog and do the same test -> the
ailerons don't move anymore and the 'Aileron' value at the bottom of
the dialog stays at 0 (0.0 or -0.0...). Just opening the dialog to
test the joystick has "corrupted" its setup! This is very confusing
for users.
This fix corrects the problem by avoiding the apparently unneeded
creation of an empty 'factor' node when there is none inside the
<binding>. An alternative would be to create a 'factor' node with value
1.0. In any case, if someone later expands the joystick-config dialog to
allow modification of property-scale's factor, he should make sure to
use a default value of 1.0!
I created a substantial quantity of new work in the New Regional
Textures project and I would like to ask if anyone could review and
perhaps commit them into FGDATA. The modifications are:
- New textures and material definitions for California
- New textures and material definitions for Mexico
- New material definitions for Central America
- New textures and material definitions for Southern Europe
(Mediterranean region: Portugal, Spain, south of Italy, Greece, coast of
Balkans)
- New airport grass texture (global)
- New airport grass texture for Latin America
- New American town texture (global)
- Small improvement to grass blade textures (to better fit the airport
grass texture)
If this will be committed, we must add a note thanking the United States
Geological Survey (USGS) for the satellite images of California (
http://www.usgs.gov/ ) to the Thanks file.
I created a substantial quantity of new work in the New Regional
Textures project and I would like to ask if anyone could review and
perhaps commit them into FGDATA. The modifications are:
- New textures and material definitions for California
- New textures and material definitions for Mexico
- New material definitions for Central America
- New textures and material definitions for Southern Europe
(Mediterranean region: Portugal, Spain, south of Italy, Greece, coast of
Balkans)
- New airport grass texture (global)
- New airport grass texture for Latin America
- New American town texture (global)
- Small improvement to grass blade textures (to better fit the airport
grass texture)
If this will be committed, we must add a note thanking the United States
Geological Survey (USGS) for the satellite images of California (
http://www.usgs.gov/ ) to the Thanks file.
- Fix documentation for --aircraft-dir: the specified path is
interpreted relatively to the current directory, not to the path of
the fgfs executable.
- Add a few precisions (the option bypasses the <path-cache> from
autosave_X_Y.xml, as well as --fg-aircraft and FG_AIRCRAFT).
- Show the option documentation in 'fgfs --help -v' output (it was
"hidden" since 2010, but it works very well; cf.
<https://sourceforge.net/p/flightgear/mailman/message/34494887/> for
the most recent discussion about this option).
- Show the doc for --aircraft-dir right below that of --aircraft (both
being closely related).
- Add a pointer to --aircraft-dir in --fg-aircraft's doc, since the
former can be used as an alternative to the latter (or at least a
complement, since --fg-aircraft is used to determine some
permissions).
Magnetic declination being "the direction of the horizontal component of
the magnetic field measured clockwise from north" according to
MagneticField(1), it must be substracted, not added, from true bearings
in order to obtain the corresponding magnetic bearings.
Example illustrating the bug:
Start at KSFO, open Equipment -> GPS Settings, enter KHTH as the
destination and click on "Search". Before the bug fix, the dialog
gives a bearing of 85, whereas the correct magnetic bearing is 58.
Digging a bit further, the true bearings/azimuths for the shortest
path (geodesic line) from KSFO to KHTH are approx. 71.5 at KSFO and
73.8 at KHTH. This can be verified with two independent libraries
(GeographicLib and PROJ.4):
% echo "37d37'08N 122d22'30W 38d32'45N 118d38'00W" | \
GeodSolve -i
71.44943076 73.75785283 343987.398
% echo "37d37'08N 122d22'30W 38d32'45N 118d38'00W" | \
geod +ellps=WGS84 -I -f '%0.3f'
71.449 -106.242 343987.398
(-106.242 + 180 = 73.758: -106.242 is the "back azimuth" at KHTH for
this path)
The bearing of 85 given by the code in gui/dialogs/gps.xml before
this commit is indeed 71.5 + magnetic declination at the starting
point (KSFO), whereas it should be 71.5 - magnetic declination.
Another, more experimental way:
Start FlightGear with:
fgfs --aircraft=ufo --disable-real-weather-fetch \
'--metar=KSFO 070956Z 36000KT 10SM FEW023 11/07 A2977 RMK AO2 SLP080 T01060067' \
--lat=37.61867421 --lon=-122.37500761 --heading=71.45931
(just in case wind influences the ufo, I have no idea whether this is
the case or not...)
During your flight, progressively increase your heading (as seen in
the HUD, i.e., true heading) so that it smoothly changes from 71.5 at
KSFO to 73.8 at KHTH. You should arrive pretty close to KHTH, whereas
the initial heading of 85 given by the GPS Settings dialog is way too
high, be it interpreted as a magnetic heading (which was visibly the
intention---it would be nice to write that in the dialog BTW) or as a
true heading (in which case the result is even further from the
correct value).
- Small update to the main hydrodynamics system.
- Added initial versions of two systems for modelling hydrodynamic planing.
Signed-off-by: Anders Gidenstam <anders@gidenstam.org>