about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/robotics/qgroundcontrol/0001-fix-gcc-cmath-namespace-issues.patch
blob: e6c9ca38a989a924a168cad98d107bd654522d0c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
From fffc383c10c7c194e427d78c83802c3b910fa1c2 Mon Sep 17 00:00:00 2001
From: Patrick Callahan <pxcallahan@gmail.com>
Date: Thu, 24 Mar 2016 18:17:57 -0700
Subject: [PATCH] fix gcc cmath namespace issues

---
 src/Vehicle/Vehicle.cc        | 6 +++---
 src/comm/QGCFlightGearLink.cc | 4 ++--
 src/comm/QGCJSBSimLink.cc     | 4 ++--
 src/uas/UAS.cc                | 8 ++++----
 src/ui/QGCDataPlot2D.cc       | 4 ++--
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc
index a0d3605..205b1de 100644
--- a/src/Vehicle/Vehicle.cc
+++ b/src/Vehicle/Vehicle.cc
@@ -638,17 +638,17 @@ void Vehicle::setLongitude(double longitude){
 
 void Vehicle::_updateAttitude(UASInterface*, double roll, double pitch, double yaw, quint64)
 {
-    if (isinf(roll)) {
+    if (std::isinf(roll)) {
         _rollFact.setRawValue(0);
     } else {
         _rollFact.setRawValue(roll * (180.0 / M_PI));
     }
-    if (isinf(pitch)) {
+    if (std::isinf(pitch)) {
         _pitchFact.setRawValue(0);
     } else {
         _pitchFact.setRawValue(pitch * (180.0 / M_PI));
     }
-    if (isinf(yaw)) {
+    if (std::isinf(yaw)) {
         _headingFact.setRawValue(0);
     } else {
         yaw = yaw * (180.0 / M_PI);
diff --git a/src/comm/QGCFlightGearLink.cc b/src/comm/QGCFlightGearLink.cc
index 2a520fb..886aecf 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(!std::isnan(rollAilerons) && !std::isnan(pitchElevator) && !std::isnan(yawRudder) && !std::isnan(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: std::isnan output: roll: " << std::isnan(rollAilerons) << ", pitch: " << std::isnan(pitchElevator) << ", yaw: " << std::isnan(yawRudder) << ", throttle: " << std::isnan(throttle);
     }
 }
 
diff --git a/src/comm/QGCJSBSimLink.cc b/src/comm/QGCJSBSimLink.cc
index 1210621..89db371 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(!std::isnan(rollAilerons) && !std::isnan(pitchElevator) && !std::isnan(yawRudder) && !std::isnan(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: " << std::isnan(rollAilerons) << ", pitch: " << std::isnan(pitchElevator) << ", yaw: " << std::isnan(yawRudder) << ", throttle: " << std::isnan(throttle);
     }
     //qDebug() << "Updated controls" << state;
 }
diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc
index 4d5c1c2..ac88852 100644
--- a/src/uas/UAS.cc
+++ b/src/uas/UAS.cc
@@ -558,7 +558,7 @@ void UAS::receiveMessage(mavlink_message_t message)
 
             setAltitudeAMSL(hud.alt);
             setGroundSpeed(hud.groundspeed);
-            if (!isnan(hud.airspeed))
+            if (!std::isnan(hud.airspeed))
                 setAirSpeed(hud.airspeed);
             speedZ = -hud.climb;
             emit altitudeChanged(this, altitudeAMSL, altitudeRelative, -speedZ, time);
@@ -654,7 +654,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) && !std::isnan(vel) && !std::isinf(vel)) {
                         setGroundSpeed(vel);
                         emit speedChanged(this, groundSpeed, airSpeed, time);
                     } else {
@@ -1439,8 +1439,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 ((!std::isnan(roll) && roll != manualRollAngle) || (!std::isnan(pitch) && pitch != manualPitchAngle) ||
+             (!std::isnan(yaw) && yaw != manualYawAngle) || (!std::isnan(thrust) && thrust != manualThrust) ||
              buttons != manualButtons) {
         sendCommand = true;
 
diff --git a/src/ui/QGCDataPlot2D.cc b/src/ui/QGCDataPlot2D.cc
index 2e530b2..9d5a774 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 && !std::isnan(x) && !std::isinf(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 && !std::isnan(y) && !std::isinf(y) && text.length() > 0 && text != " " && text != "\n" && text != "\r" && text != "\t")
                         {
                             // Only append definitely valid values
                             xValues.value(curveName)->append(x);
-- 
2.7.4