1
0
Fork 0

Work around the penaltyForNav broken-ness, by ensuring GS behaves sanely even if non-matches LOC and GS transmitters are selected. Which happens. Yuck.

This commit is contained in:
jmt 2009-09-15 10:15:42 +00:00 committed by Tim Moore
parent c1598361ca
commit ebf5dcb828

View file

@ -552,7 +552,7 @@ void FGNavRadio::updateGlideSlope(double dt, const SGVec3d& aircraft, double sig
double dot_v = dot(pos, _gsVertical); double dot_v = dot(pos, _gsVertical);
double angle = atan2(dot_v, dot_h) * SGD_RADIANS_TO_DEGREES; double angle = atan2(dot_v, dot_h) * SGD_RADIANS_TO_DEGREES;
double deflectionAngle = target_gs - angle; double deflectionAngle = target_gs - angle;
// Construct false glideslopes. The scale factor of 1.5 // Construct false glideslopes. The scale factor of 1.5
// in the sawtooth gives a period of 6 degrees. // in the sawtooth gives a period of 6 degrees.
// There will be zeros at 3, 6r, 9, 12r et cetera // There will be zeros at 3, 6r, 9, 12r et cetera
@ -819,14 +819,22 @@ void FGNavRadio::search()
int tmp = (int)(_gs->get_multiuse() / 1000.0); int tmp = (int)(_gs->get_multiuse() / 1000.0);
target_gs = (double)tmp / 100.0; target_gs = (double)tmp / 100.0;
// until penaltyForNav goes away, we cannot assume we always pick
// paired LOC/GS trasmsitters. As we pass over a runway threshold, we
// often end up picking the 'wrong' LOC, but the correct GS. To avoid
// breaking the basis computation, ensure we use the GS radial and not
// the (potentially reversed) LOC radial.
double gs_radial = fmod(_gs->get_multiuse(), 1000.0);
SG_NORMALIZE_RANGE(gs_radial, 0.0, 360.0);
// GS axis unit tangent vector // GS axis unit tangent vector
// (along the runway) // (along the runway)
_gsCart = _gs->cart(); _gsCart = _gs->cart();
_gsAxis = tangentVector(_gs->geod(), _gsCart, target_radial); _gsAxis = tangentVector(_gs->geod(), _gsCart, gs_radial);
// GS baseline unit tangent vector // GS baseline unit tangent vector
// (perpendicular to the runay along the ground) // (perpendicular to the runay along the ground)
SGVec3d baseline = tangentVector(_gs->geod(), _gsCart, target_radial + 90.0); SGVec3d baseline = tangentVector(_gs->geod(), _gsCart, gs_radial + 90.0);
_gsVertical = cross(baseline, _gsAxis); _gsVertical = cross(baseline, _gsAxis);
} // of have glideslope } // of have glideslope
} // of found LOC or ILS } // of found LOC or ILS