#include "rnav_waypt_controller.hxx"
+#include <cassert>
+
#include <simgear/sg_inlines.h>
#include <simgear/structure/exception.hxx>
double crs12 = SGGeodesy::courseRad(a, b),
crs21 = SGGeodesy::courseRad(b, a);
- double degCrs12 = crs12 * SG_RADIANS_TO_DEGREES;
- double degCrs21 = crs21 * SG_RADIANS_TO_DEGREES;
+ //double degCrs12 = crs12 * SG_RADIANS_TO_DEGREES;
+ //double degCrs21 = crs21 * SG_RADIANS_TO_DEGREES;
/*
if (sin(diffLon) < 0.0) {
{
public:
BasicWayptCtl(RNAV* aRNAV, const WayptRef& aWpt) :
- WayptController(aRNAV, aWpt)
+ WayptController(aRNAV, aWpt),
+ _distanceM(0.0),
+ _courseDev(0.0)
{
if (aWpt->flag(WPT_DYNAMIC)) {
throw sg_exception("BasicWayptCtrl doesn't work with dynamic waypoints");
/**
* Special controller for runways. For runways, we want very narrow deviation
- * contraints, and to understand that any point along the paved area is
+ * constraints, and to understand that any point along the paved area is
* equivalent to being 'at' the runway.
*/
class RunwayCtl : public WayptController
{
public:
RunwayCtl(RNAV* aRNAV, const WayptRef& aWpt) :
- WayptController(aRNAV, aWpt)
+ WayptController(aRNAV, aWpt),
+ _runway(NULL),
+ _distanceM(0.0),
+ _courseDev(0.0)
{
}
double _courseDev = brg - _targetTrack;
SG_NORMALIZE_RANGE(_courseDev, -180.0, 180.0);
- if (fabs(_courseDev) > 90.0) {
+ if ((fabs(_courseDev) > 90.0) && (_distanceM < _rnav->overflightArmDistanceM())) {
setDone();
}
}
case RESTRICT_NONE:
assert(false);
break;
+ case SPEED_RESTRICT_MACH:
+ assert(false);
+ break;
}
}
{
public:
InterceptCtl(RNAV* aRNAV, const WayptRef& aWpt) :
- WayptController(aRNAV, aWpt)
-
+ WayptController(aRNAV, aWpt),
+ _trueRadial(0.0)
{
if (_waypt->type() != "radialIntercept") {
throw sg_exception("invalid waypoint type", "InterceptCtl ctor");
{
public:
DMEInterceptCtl(RNAV* aRNAV, const WayptRef& aWpt) :
- WayptController(aRNAV, aWpt)
-
+ WayptController(aRNAV, aWpt),
+ _dme(NULL),
+ _distanceNm(0.0)
{
if (_waypt->type() != "dmeIntercept") {
throw sg_exception("invalid waypoint type", "DMEInterceptCtl ctor");
DirectToController::DirectToController(RNAV* aRNAV, const WayptRef& aWpt, const SGGeod& aOrigin) :
WayptController(aRNAV, aWpt),
- _origin(aOrigin)
+ _origin(aOrigin),
+ _distanceM(0.0),
+ _courseDev(0.0)
{
}
///////////////////////////////////////////////////////////////////////////////
OBSController::OBSController(RNAV* aRNAV, const WayptRef& aWpt) :
- WayptController(aRNAV, aWpt)
+ WayptController(aRNAV, aWpt),
+ _distanceM(0.0),
+ _courseDev(0.0)
{
}