diff --git a/src/QGC.h b/src/QGC.h index e6660abb6fbdc8e9fe6af8009f1377931065846a..19675520b985305df8e40c59bb3c54a2cd7311c6 100644 --- a/src/QGC.h +++ b/src/QGC.h @@ -30,40 +30,6 @@ #include "QGCConfig.h" - -/* Windows fixes */ -#ifdef _MSC_VER -#if (_MSC_VER < 1800) /* only PRIOR to Visual Studio 2013 */ -/* Needed define for Eigen */ -//#define NOMINMAX -#include -template -inline bool isnan(T value) -{ - return value != value; - -} - -// requires #include -template -inline bool isinf(T value) -{ - return (value == std::numeric_limits::infinity() || (-1 * value) == std::numeric_limits::infinity()) && std::numeric_limits::has_infinity; -} -#endif -#elif defined __APPLE__ || defined Q_OS_LINUX -#include -#ifndef isnan -#define isnan(x) std::isnan(x) -#endif -#ifndef isinf -#define isinf(x) std::isinf(x) -#endif -#endif -#ifdef __android__ -#define isinf(x) std::isinf(x) -#endif - namespace QGC { const static int defaultSystemId = 255; diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index 840e6fdf696033b248a2ce9eeba544b099db0cab..ab953efb381bd33dfb38a12dcd874dddb3c43435 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -783,17 +783,17 @@ void Vehicle::setLongitude(double longitude){ void Vehicle::_updateAttitude(UASInterface*, double roll, double pitch, double yaw, quint64) { - if (isinf(roll)) { + if (qIsInf(roll)) { _rollFact.setRawValue(0); } else { _rollFact.setRawValue(roll * (180.0 / M_PI)); } - if (isinf(pitch)) { + if (qIsInf(pitch)) { _pitchFact.setRawValue(0); } else { _pitchFact.setRawValue(pitch * (180.0 / M_PI)); } - if (isinf(yaw)) { + if (qIsInf(yaw)) { _headingFact.setRawValue(0); } else { yaw = yaw * (180.0 / M_PI); diff --git a/src/comm/QGCFlightGearLink.cc b/src/comm/QGCFlightGearLink.cc index 2a520fbe83bec3bce31cde1f1c3670da5104fd8a..16d2ed28305743612ed353972a35728a258f05c2 100644 --- a/src/comm/QGCFlightGearLink.cc +++ b/src/comm/QGCFlightGearLink.cc @@ -230,7 +230,7 @@ void QGCFlightGearLink::updateControls(quint64 time, float rollAilerons, float p Q_UNUSED(systemMode); Q_UNUSED(navMode); - if(!isnan(rollAilerons) && !isnan(pitchElevator) && !isnan(yawRudder) && !isnan(throttle)) + if(!qIsNaN(rollAilerons) && !qIsNaN(pitchElevator) && !qIsNaN(yawRudder) && !qIsNaN(throttle)) { QString state("%1\t%2\t%3\t%4\t%5\n"); state = state.arg(rollAilerons).arg(pitchElevator).arg(yawRudder).arg(true).arg(throttle); @@ -240,7 +240,7 @@ void QGCFlightGearLink::updateControls(quint64 time, float rollAilerons, float p } else { - qDebug() << "HIL: Got NaN values from the hardware: isnan output: roll: " << isnan(rollAilerons) << ", pitch: " << isnan(pitchElevator) << ", yaw: " << isnan(yawRudder) << ", throttle: " << isnan(throttle); + qDebug() << "HIL: Got NaN values from the hardware: isnan output: roll: " << qIsNaN(rollAilerons) << ", pitch: " << qIsNaN(pitchElevator) << ", yaw: " << qIsNaN(yawRudder) << ", throttle: " << qIsNaN(throttle); } } diff --git a/src/comm/QGCJSBSimLink.cc b/src/comm/QGCJSBSimLink.cc index 1210621bc6a61f10aa103f68bd93765ca814568f..487240c92aeaada598b50d09d71969e9fdb1f60c 100644 --- a/src/comm/QGCJSBSimLink.cc +++ b/src/comm/QGCJSBSimLink.cc @@ -242,7 +242,7 @@ void QGCJSBSimLink::updateControls(quint64 time, float rollAilerons, float pitch Q_UNUSED(systemMode); Q_UNUSED(navMode); - if(!isnan(rollAilerons) && !isnan(pitchElevator) && !isnan(yawRudder) && !isnan(throttle)) + if(!qIsNaN(rollAilerons) && !qIsNaN(pitchElevator) && !qIsNaN(yawRudder) && !qIsNaN(throttle)) { QString state("%1\t%2\t%3\t%4\t%5\n"); state = state.arg(rollAilerons).arg(pitchElevator).arg(yawRudder).arg(true).arg(throttle); @@ -250,7 +250,7 @@ void QGCJSBSimLink::updateControls(quint64 time, float rollAilerons, float pitch } else { - qDebug() << "HIL: Got NaN values from the hardware: isnan output: roll: " << isnan(rollAilerons) << ", pitch: " << isnan(pitchElevator) << ", yaw: " << isnan(yawRudder) << ", throttle: " << isnan(throttle); + qDebug() << "HIL: Got NaN values from the hardware: isnan output: roll: " << qIsNaN(rollAilerons) << ", pitch: " << qIsNaN(pitchElevator) << ", yaw: " << qIsNaN(yawRudder) << ", throttle: " << qIsNaN(throttle); } //qDebug() << "Updated controls" << state; } diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index 6aba1c4b54ce18ab4264cd1f333f2d0e318f1982..07d7b829f65a493b6cd078137f6aabeb7d9074bd 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -441,7 +441,7 @@ void UAS::receiveMessage(mavlink_message_t message) setAltitudeAMSL(hud.alt); setGroundSpeed(hud.groundspeed); - if (!isnan(hud.airspeed)) + if (!qIsNaN(hud.airspeed)) setAirSpeed(hud.airspeed); speedZ = -hud.climb; emit altitudeChanged(this, altitudeAMSL, altitudeRelative, -speedZ, time); @@ -537,7 +537,7 @@ void UAS::receiveMessage(mavlink_message_t message) float vel = pos.vel/100.0f; // Smaller than threshold and not NaN - if ((vel < 1000000) && !isnan(vel) && !isinf(vel)) { + if ((vel < 1000000) && !qIsNaN(vel) && !qIsInf(vel)) { setGroundSpeed(vel); emit speedChanged(this, groundSpeed, airSpeed, time); } else { @@ -1309,8 +1309,8 @@ void UAS::setExternalControlSetpoint(float roll, float pitch, float yaw, float t if (countSinceLastTransmission++ >= 5) { sendCommand = true; countSinceLastTransmission = 0; - } else if ((!isnan(roll) && roll != manualRollAngle) || (!isnan(pitch) && pitch != manualPitchAngle) || - (!isnan(yaw) && yaw != manualYawAngle) || (!isnan(thrust) && thrust != manualThrust) || + } else if ((!qIsNaN(roll) && roll != manualRollAngle) || (!qIsNaN(pitch) && pitch != manualPitchAngle) || + (!qIsNaN(yaw) && yaw != manualYawAngle) || (!qIsNaN(thrust) && thrust != manualThrust) || buttons != manualButtons) { sendCommand = true; diff --git a/src/ui/QGCDataPlot2D.cc b/src/ui/QGCDataPlot2D.cc index 2e530b21eee9a5cb80824f58fbc3bc8b02c255ce..bcfaecf8ae38ea014a6419423a73fad5331eded9 100644 --- a/src/ui/QGCDataPlot2D.cc +++ b/src/ui/QGCDataPlot2D.cc @@ -535,7 +535,7 @@ void QGCDataPlot2D::loadCsvLog(QString file, QString xAxisName, QString yAxisFil { bool okx = true; x = text.toDouble(&okx); - if (okx && !isnan(x) && !isinf(x)) + if (okx && !qIsNaN(x) && !qIsInf(x)) { headerfound = true; } @@ -561,7 +561,7 @@ void QGCDataPlot2D::loadCsvLog(QString file, QString xAxisName, QString yAxisFil y = text.toDouble(&oky); // Only INF is really an issue for the plot // NaN is fine - if (oky && !isnan(y) && !isinf(y) && text.length() > 0 && text != " " && text != "\n" && text != "\r" && text != "\t") + if (oky && !qIsNaN(y) && !qIsInf(y) && text.length() > 0 && text != " " && text != "\n" && text != "\r" && text != "\t") { // Only append definitely valid values xValues.value(curveName)->append(x);