John Denker: move branch cut and apply clamps
fixed un-normalized outputs
This commit is contained in:
parent
214919da20
commit
3c3f3a096e
2 changed files with 27 additions and 8 deletions
src/Instrumentation
|
@ -608,9 +608,21 @@ void FGNavRadio::updateGlideSlope(double dt, const SGVec3d& aircraft, double sig
|
||||||
SGVec3d pos = aircraft - _gsCart; // relative vector from gs antenna to aircraft
|
SGVec3d pos = aircraft - _gsCart; // relative vector from gs antenna to aircraft
|
||||||
// The positive GS axis points along the runway in the landing direction,
|
// The positive GS axis points along the runway in the landing direction,
|
||||||
// toward the far end, not toward the approach area, so we need a - sign here:
|
// toward the far end, not toward the approach area, so we need a - sign here:
|
||||||
double dot_h = -dot(pos, _gsAxis);
|
double comp_h = -dot(pos, _gsAxis); // component in horiz direction
|
||||||
double dot_v = dot(pos, _gsVertical);
|
double comp_v = dot(pos, _gsVertical); // component in vertical direction
|
||||||
_gsDirect = atan2(dot_v, dot_h) * SGD_RADIANS_TO_DEGREES;
|
//double comp_b = dot(pos, _gsBaseline); // component in baseline direction
|
||||||
|
//if (comp_b) {} // ... (useful for debugging)
|
||||||
|
|
||||||
|
// _gsDirect represents the angle of elevation of the aircraft
|
||||||
|
// as seen by the GS transmitter.
|
||||||
|
_gsDirect = atan2(comp_v, comp_h) * SGD_RADIANS_TO_DEGREES;
|
||||||
|
// At this point, if the aircraft is centered on the glide slope,
|
||||||
|
// _gsDirect will be a small positive number, e.g. 3.0 degrees
|
||||||
|
|
||||||
|
// Aim the branch cut straight down
|
||||||
|
// into the ground below the GS transmitter:
|
||||||
|
if (_gsDirect < -90.0) _gsDirect += 360.0;
|
||||||
|
|
||||||
double deflectionAngle = target_gs - _gsDirect;
|
double deflectionAngle = target_gs - _gsDirect;
|
||||||
|
|
||||||
if (falseCoursesEnabledNode->getBoolValue()) {
|
if (falseCoursesEnabledNode->getBoolValue()) {
|
||||||
|
@ -631,10 +643,17 @@ void FGNavRadio::updateGlideSlope(double dt, const SGVec3d& aircraft, double sig
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GS is documented to be 1.4 degrees thick,
|
||||||
|
// i.e. plus or minus 0.7 degrees from the midline:
|
||||||
|
SG_CLAMP_RANGE(deflectionAngle, -0.7, 0.7);
|
||||||
|
|
||||||
|
// Many older instrument xml frontends depend on
|
||||||
|
// the un-normalized gs-needle-deflection.
|
||||||
|
// Apparently the interface standard is plus or minus 3.5 "volts"
|
||||||
|
// for a full-scale deflection:
|
||||||
_gsNeedleDeflection = deflectionAngle * 5.0;
|
_gsNeedleDeflection = deflectionAngle * 5.0;
|
||||||
_gsNeedleDeflection *= signal_quality_norm;
|
_gsNeedleDeflection *= signal_quality_norm;
|
||||||
|
|
||||||
SG_CLAMP_RANGE(deflectionAngle, -0.7, 0.7);
|
|
||||||
_gsNeedleDeflectionNorm = (deflectionAngle / 0.7) * signal_quality_norm;
|
_gsNeedleDeflectionNorm = (deflectionAngle / 0.7) * signal_quality_norm;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////
|
||||||
|
@ -957,9 +976,9 @@ void FGNavRadio::search()
|
||||||
_gsAxis = tangentVector(_gs->geod(), gs_radial);
|
_gsAxis = tangentVector(_gs->geod(), gs_radial);
|
||||||
|
|
||||||
// GS baseline unit tangent vector
|
// GS baseline unit tangent vector
|
||||||
// (perpendicular to the runay along the ground)
|
// (transverse to the runay along the ground)
|
||||||
SGVec3d baseline = tangentVector(_gs->geod(), gs_radial + 90.0);
|
_gsBaseline = tangentVector(_gs->geod(), gs_radial + 90.0);
|
||||||
_gsVertical = cross(baseline, _gsAxis);
|
_gsVertical = cross(_gsBaseline, _gsAxis);
|
||||||
} // of have glideslope
|
} // of have glideslope
|
||||||
} // of found LOC or ILS
|
} // of found LOC or ILS
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,7 @@ class FGNavRadio : public SGSubsystem, public SGPropertyChangeListener
|
||||||
// internal periodic station search timer
|
// internal periodic station search timer
|
||||||
double _time_before_search_sec;
|
double _time_before_search_sec;
|
||||||
|
|
||||||
SGVec3d _gsCart, _gsAxis, _gsVertical;
|
SGVec3d _gsCart, _gsAxis, _gsVertical, _gsBaseline;
|
||||||
|
|
||||||
FGNavRecordPtr _dme;
|
FGNavRecordPtr _dme;
|
||||||
bool _dmeInRange;
|
bool _dmeInRange;
|
||||||
|
|
Loading…
Add table
Reference in a new issue