1
0
Fork 0

Remove alignLocaliserWithRunway(): deemed to be a "misfeature" :-)

In the thread at
<https://sourceforge.net/p/flightgear/mailman/flightgear-devel/thread/87tw7sm5uw.fsf%40frougon.crabdance.com/#msg35673402>,
it was decided that alignLocaliserWithRunway() was a bad idea overall,
and should just be removed. The feature was already disabled by default
in recent releases via defaults.xml (since FlightGear 2017.1, precisely
FGData commit ea76305e42fd245e79a2b5bb569c8c61161f5721). Remove the code
entirely now.

The properties /sim/navdb/localizers/auto-align and
/sim/navdb/localizers/auto-align-threshold-deg have no effect anymore,
you may remove them from your configs if you somehow set them.

This goes with FGData commit 6dd9f6e8d962b00a1ccddc6af487c404cc935b92.

In case someone wanted to reuse the removed code, please consider
Szymon's proposed change at
<https://sourceforge.net/p/flightgear/flightgear/merge-requests/76/>,
which was:

,----
| Fixed bug in alignLocaliserWithRunway when building NavCacheDb
|
| The position of the localizer was converted to a distance from
| the displaced threshold, and then back to the posistion on the
| centerline, but the origin of the second computation was
| non-displaced threshold.
|
| --- a/src/Navaids/navdb.cxx
| +++ b/src/Navaids/navdb.cxx
| @@ -104,8 +104,8 @@
|  void alignLocaliserWithRunway(FGRunway* rwy, const string& ident, SGGeod& pos, double& heading)
|  {
|    assert(rwy);
| -  // find the distance from the threshold to the localizer
| -  double dist = SGGeodesy::distanceM(pos, rwy->threshold());
| +  // find the distance from the (non-displaced) threshold to the localizer
| +  double dist = SGGeodesy::distanceM(pos, rwy->geod());
|
|    // back project that distance along the runway center line
|    SGGeod newPos = rwy->pointOnCenterline(dist);
`----
This commit is contained in:
Florent Rougon 2017-06-07 14:03:32 +02:00
parent 444864c7ba
commit 889c1bf0cb

View file

@ -96,38 +96,6 @@ mapRobinTypeToFGPType(int aTy)
}
}
static bool autoAlignLocalizers = false;
static double autoAlignThreshold = 0.0;
/**
* Given a runway, and proposed localizer data (ident, positioned and heading),
* precisely align the localizer with the actual runway heading, providing the
* difference between the localizer course and runway heading is less than a
* threshold. (To allow for localizers such as Kai-Tak requiring a turn on final).
*
* The positioned and heading argument are modified if changes are made.
*/
void alignLocaliserWithRunway(FGRunway* rwy, const string& ident, SGGeod& pos, double& heading)
{
assert(rwy);
// find the distance from the threshold to the localizer
double dist = SGGeodesy::distanceM(pos, rwy->threshold());
// back project that distance along the runway center line
SGGeod newPos = rwy->pointOnCenterline(dist);
double hdg_diff = heading - rwy->headingDeg();
SG_NORMALIZE_RANGE(hdg_diff, -180.0, 180.0);
if ( fabs(hdg_diff) <= autoAlignThreshold ) {
pos = SGGeod::fromGeodFt(newPos, pos.getElevationFt());
heading = rwy->headingDeg();
} else {
SG_LOG(SG_NAVAID, SG_DEBUG, "localizer:" << ident << ", aligning with runway "
<< rwy->ident() << " exceeded heading threshold");
}
}
static double defaultNavRange(const string& ident, FGPositioned::Type type)
{
// Ranges are included with the latest data format, no need to
@ -440,12 +408,8 @@ PositionedID NavLoader::processNavLine(
} // of type is runway-related
bool isLoc = (type == FGPositioned::ILS) || (type == FGPositioned::LOC);
if (runway && autoAlignLocalizers && isLoc) {
alignLocaliserWithRunway(runway, ident, pos, multiuse);
}
PositionedID r = cache->insertNavaid(type, ident, name, pos, freq, range, multiuse,
arp.first, arp.second);
PositionedID r = cache->insertNavaid(type, ident, name, pos, freq, range,
multiuse, arp.first, arp.second);
if (isLoc) {
cache->setRunwayILS(arp.second, r);
@ -472,9 +436,6 @@ void NavLoader::loadNav(const SGPath& path, std::size_t bytesReadSoFar,
sg_location(path));
}
autoAlignLocalizers = fgGetBool("/sim/navdb/localizers/auto-align", true);
autoAlignThreshold = fgGetDouble( "/sim/navdb/localizers/auto-align-threshold-deg", 5.0 );
string line;
// Skip the first two lines