1
0
Fork 0
Commit graph

17 commits

Author SHA1 Message Date
Florent Rougon
9037441778 Fix bearing calculation in the GPS Settings dialog
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).
2015-12-08 22:46:47 +01:00
Stuart Buchanan
0581ad323d GUI Cleanup from Michael HABARTA. Part 2 2015-03-14 23:03:31 +00:00
James Turner
70dee4a029 Avoid a warning from GPS dialog. 2014-03-16 16:21:06 +00:00
James Turner
2ce4fcbf31 Make GPS dialog remember search results.
Restore pre-2.12 functionality where GPS search was persistent across
opening and closing the GPS dialog. Since the state is now in Nasal
we need to ensure a couple of variables outlive the dialog itself.
2013-10-02 22:53:56 +01:00
James Turner
3b15c3c039 GPS dialog
* fix initial type selection
* fix nearest search on 'any'
2013-10-02 22:29:53 +01:00
James Turner
37044ed754 Fix GPS dialog scratch.
Legacy GPS and Nasal replacement were both writing to the
same props, which doesn't work so great. Use different props
for the GPS dialog now.
2013-06-16 15:07:19 +01:00
James Turner
b64dd768d3 Move more high-level GPS logic to Nasal/XML. 2013-04-10 18:52:34 +01:00
James Turner
4d3a00bf68 Use Nasal to provide GPS search functions. 2013-04-10 18:52:34 +01:00
Stuart Buchanan
3d7d00ead9 Minor changes various dialogs to make generally consistent:
- Title bar with cancel button in top left hand side.
- horizontal line dividing main dialog from bottom buttons
- Minor layout and Nasal fixes.
2010-12-27 20:19:31 +00:00
jmt
cca70e4e6a Fix 'active route waypoint' button to actually load the current wp, instead of wp0. 2010-03-27 11:36:14 +00:00
jmt
26607856c6 GPS: updated generic GPS dialog, with OBS course selection dial. 2010-03-25 16:42:37 +00:00
jmt
98f75bed75 Dialog fix for impending new C++ feature - reset scratch lon/lat before executing 'nearest'. 2009-12-09 18:13:03 +00:00
jmt
3b275abc32 Allow the NAV/GPS slave to be toggled from the generic GPS dialog. 2009-10-08 22:07:09 +00:00
jmt
1f345e1cda Updated GPS and route-manager dialogs, in sync with the core FGFS changes. 2009-10-05 21:10:11 +00:00
mfranz
9fa98151db use <key>Esc</key> instead of <keynum>27</keynum> 2005-11-05 18:42:28 +00:00
mfranz
9c49dccd5b let all dialogs in $FG_ROOT/gui/dialogs be closed/canceled/dismissed on
Escape key; nasal generated dialogs will follow
2005-11-05 13:59:06 +00:00
ehofman
6ff20282a1 Add a dialog box to set the GPS waypoints. 2004-05-03 19:06:02 +00:00