@@ -0,0 +1,140 @@
1+From fffc383c10c7c194e427d78c83802c3b910fa1c2 Mon Sep 17 00:00:00 2001
2+From: Patrick Callahan <pxcallahan@gmail.com>
3+Date: Thu, 24 Mar 2016 18:17:57 -0700
4+Subject: [PATCH] fix gcc cmath namespace issues
5+
6+---
7+ src/Vehicle/Vehicle.cc | 6 +++---
8+ src/comm/QGCFlightGearLink.cc | 4 ++--
9+ src/comm/QGCJSBSimLink.cc | 4 ++--
10+ src/uas/UAS.cc | 8 ++++----
11+ src/ui/QGCDataPlot2D.cc | 4 ++--
12+ 5 files changed, 13 insertions(+), 13 deletions(-)
13+
14+diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc
15+index a0d3605..205b1de 100644
16+--- a/src/Vehicle/Vehicle.cc
17++++ b/src/Vehicle/Vehicle.cc
18+@@ -638,17 +638,17 @@ void Vehicle::setLongitude(double longitude){
19+
20+ void Vehicle::_updateAttitude(UASInterface*, double roll, double pitch, double yaw, quint64)
21+ {
22+- if (isinf(roll)) {
23++ if (std::isinf(roll)) {
24+ _rollFact.setRawValue(0);
25+ } else {
26+ _rollFact.setRawValue(roll * (180.0 / M_PI));
27+ }
28+- if (isinf(pitch)) {
29++ if (std::isinf(pitch)) {
30+ _pitchFact.setRawValue(0);
31+ } else {
32+ _pitchFact.setRawValue(pitch * (180.0 / M_PI));
33+ }
34+- if (isinf(yaw)) {
35++ if (std::isinf(yaw)) {
36+ _headingFact.setRawValue(0);
37+ } else {
38+ yaw = yaw * (180.0 / M_PI);
39+diff --git a/src/comm/QGCFlightGearLink.cc b/src/comm/QGCFlightGearLink.cc
40+index 2a520fb..886aecf 100644
41+--- a/src/comm/QGCFlightGearLink.cc
42++++ b/src/comm/QGCFlightGearLink.cc
43+@@ -230,7 +230,7 @@ void QGCFlightGearLink::updateControls(quint64 time, float rollAilerons, float p
44+ Q_UNUSED(systemMode);
45+ Q_UNUSED(navMode);
46+
47+- if(!isnan(rollAilerons) && !isnan(pitchElevator) && !isnan(yawRudder) && !isnan(throttle))
48++ if(!std::isnan(rollAilerons) && !std::isnan(pitchElevator) && !std::isnan(yawRudder) && !std::isnan(throttle))
49+ {
50+ QString state("%1\t%2\t%3\t%4\t%5\n");
51+ state = state.arg(rollAilerons).arg(pitchElevator).arg(yawRudder).arg(true).arg(throttle);
52+@@ -240,7 +240,7 @@ void QGCFlightGearLink::updateControls(quint64 time, float rollAilerons, float p
53+ }
54+ else
55+ {
56+- qDebug() << "HIL: Got NaN values from the hardware: isnan output: roll: " << isnan(rollAilerons) << ", pitch: " << isnan(pitchElevator) << ", yaw: " << isnan(yawRudder) << ", throttle: " << isnan(throttle);
57++ qDebug() << "HIL: Got NaN values from the hardware: std::isnan output: roll: " << std::isnan(rollAilerons) << ", pitch: " << std::isnan(pitchElevator) << ", yaw: " << std::isnan(yawRudder) << ", throttle: " << std::isnan(throttle);
58+ }
59+ }
60+
61+diff --git a/src/comm/QGCJSBSimLink.cc b/src/comm/QGCJSBSimLink.cc
62+index 1210621..89db371 100644
63+--- a/src/comm/QGCJSBSimLink.cc
64++++ b/src/comm/QGCJSBSimLink.cc
65+@@ -242,7 +242,7 @@ void QGCJSBSimLink::updateControls(quint64 time, float rollAilerons, float pitch
66+ Q_UNUSED(systemMode);
67+ Q_UNUSED(navMode);
68+
69+- if(!isnan(rollAilerons) && !isnan(pitchElevator) && !isnan(yawRudder) && !isnan(throttle))
70++ if(!std::isnan(rollAilerons) && !std::isnan(pitchElevator) && !std::isnan(yawRudder) && !std::isnan(throttle))
71+ {
72+ QString state("%1\t%2\t%3\t%4\t%5\n");
73+ state = state.arg(rollAilerons).arg(pitchElevator).arg(yawRudder).arg(true).arg(throttle);
74+@@ -250,7 +250,7 @@ void QGCJSBSimLink::updateControls(quint64 time, float rollAilerons, float pitch
75+ }
76+ else
77+ {
78+- qDebug() << "HIL: Got NaN values from the hardware: isnan output: roll: " << isnan(rollAilerons) << ", pitch: " << isnan(pitchElevator) << ", yaw: " << isnan(yawRudder) << ", throttle: " << isnan(throttle);
79++ qDebug() << "HIL: Got NaN values from the hardware: isnan output: roll: " << std::isnan(rollAilerons) << ", pitch: " << std::isnan(pitchElevator) << ", yaw: " << std::isnan(yawRudder) << ", throttle: " << std::isnan(throttle);
80+ }
81+ //qDebug() << "Updated controls" << state;
82+ }
83+diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc
84+index 4d5c1c2..ac88852 100644
85+--- a/src/uas/UAS.cc
86++++ b/src/uas/UAS.cc
87+@@ -558,7 +558,7 @@ void UAS::receiveMessage(mavlink_message_t message)
88+
89+ setAltitudeAMSL(hud.alt);
90+ setGroundSpeed(hud.groundspeed);
91+- if (!isnan(hud.airspeed))
92++ if (!std::isnan(hud.airspeed))
93+ setAirSpeed(hud.airspeed);
94+ speedZ = -hud.climb;
95+ emit altitudeChanged(this, altitudeAMSL, altitudeRelative, -speedZ, time);
96+@@ -654,7 +654,7 @@ void UAS::receiveMessage(mavlink_message_t message)
97+
98+ float vel = pos.vel/100.0f;
99+ // Smaller than threshold and not NaN
100+- if ((vel < 1000000) && !isnan(vel) && !isinf(vel)) {
101++ if ((vel < 1000000) && !std::isnan(vel) && !std::isinf(vel)) {
102+ setGroundSpeed(vel);
103+ emit speedChanged(this, groundSpeed, airSpeed, time);
104+ } else {
105+@@ -1439,8 +1439,8 @@ void UAS::setExternalControlSetpoint(float roll, float pitch, float yaw, float t
106+ if (countSinceLastTransmission++ >= 5) {
107+ sendCommand = true;
108+ countSinceLastTransmission = 0;
109+- } else if ((!isnan(roll) && roll != manualRollAngle) || (!isnan(pitch) && pitch != manualPitchAngle) ||
110+- (!isnan(yaw) && yaw != manualYawAngle) || (!isnan(thrust) && thrust != manualThrust) ||
111++ } else if ((!std::isnan(roll) && roll != manualRollAngle) || (!std::isnan(pitch) && pitch != manualPitchAngle) ||
112++ (!std::isnan(yaw) && yaw != manualYawAngle) || (!std::isnan(thrust) && thrust != manualThrust) ||
113+ buttons != manualButtons) {
114+ sendCommand = true;
115+
116+diff --git a/src/ui/QGCDataPlot2D.cc b/src/ui/QGCDataPlot2D.cc
117+index 2e530b2..9d5a774 100644
118+--- a/src/ui/QGCDataPlot2D.cc
119++++ b/src/ui/QGCDataPlot2D.cc
120+@@ -535,7 +535,7 @@ void QGCDataPlot2D::loadCsvLog(QString file, QString xAxisName, QString yAxisFil
121+ {
122+ bool okx = true;
123+ x = text.toDouble(&okx);
124+- if (okx && !isnan(x) && !isinf(x))
125++ if (okx && !std::isnan(x) && !std::isinf(x))
126+ {
127+ headerfound = true;
128+ }
129+@@ -561,7 +561,7 @@ void QGCDataPlot2D::loadCsvLog(QString file, QString xAxisName, QString yAxisFil
130+ y = text.toDouble(&oky);
131+ // Only INF is really an issue for the plot
132+ // NaN is fine
133+- if (oky && !isnan(y) && !isinf(y) && text.length() > 0 && text != " " && text != "\n" && text != "\r" && text != "\t")
134++ if (oky && !std::isnan(y) && !std::isinf(y) && text.length() > 0 && text != " " && text != "\n" && text != "\r" && text != "\t")
135+ {
136+ // Only append definitely valid values
137+ xValues.value(curveName)->append(x);
138+--
139+2.7.4
140+