Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
39b220f8
Commit
39b220f8
authored
Mar 23, 2016
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3061 from tcanabrava/math_to_qmath
Change calls to isnan / isinf to qIsNan / qIsInf
parents
4ee458b9
0abc2add
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
47 deletions
+13
-47
QGC.h
src/QGC.h
+0
-34
Vehicle.cc
src/Vehicle/Vehicle.cc
+3
-3
QGCFlightGearLink.cc
src/comm/QGCFlightGearLink.cc
+2
-2
QGCJSBSimLink.cc
src/comm/QGCJSBSimLink.cc
+2
-2
UAS.cc
src/uas/UAS.cc
+4
-4
QGCDataPlot2D.cc
src/ui/QGCDataPlot2D.cc
+2
-2
No files found.
src/QGC.h
View file @
39b220f8
...
...
@@ -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 <limits>
template
<
typename
T
>
inline
bool
isnan
(
T
value
)
{
return
value
!=
value
;
}
// requires #include <limits>
template
<
typename
T
>
inline
bool
isinf
(
T
value
)
{
return
(
value
==
std
::
numeric_limits
<
T
>::
infinity
()
||
(
-
1
*
value
)
==
std
::
numeric_limits
<
T
>::
infinity
())
&&
std
::
numeric_limits
<
T
>::
has_infinity
;
}
#endif
#elif defined __APPLE__ || defined Q_OS_LINUX
#include <cmath>
#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
;
...
...
src/Vehicle/Vehicle.cc
View file @
39b220f8
...
...
@@ -783,17 +783,17 @@ void Vehicle::setLongitude(double longitude){
void
Vehicle
::
_updateAttitude
(
UASInterface
*
,
double
roll
,
double
pitch
,
double
yaw
,
quint64
)
{
if
(
isi
nf
(
roll
))
{
if
(
qIsI
nf
(
roll
))
{
_rollFact
.
setRawValue
(
0
);
}
else
{
_rollFact
.
setRawValue
(
roll
*
(
180.0
/
M_PI
));
}
if
(
isi
nf
(
pitch
))
{
if
(
qIsI
nf
(
pitch
))
{
_pitchFact
.
setRawValue
(
0
);
}
else
{
_pitchFact
.
setRawValue
(
pitch
*
(
180.0
/
M_PI
));
}
if
(
isi
nf
(
yaw
))
{
if
(
qIsI
nf
(
yaw
))
{
_headingFact
.
setRawValue
(
0
);
}
else
{
yaw
=
yaw
*
(
180.0
/
M_PI
);
...
...
src/comm/QGCFlightGearLink.cc
View file @
39b220f8
...
...
@@ -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
);
}
}
...
...
src/comm/QGCJSBSimLink.cc
View file @
39b220f8
...
...
@@ -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;
}
...
...
src/uas/UAS.cc
View file @
39b220f8
...
...
@@ -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.0
f
;
// Smaller than threshold and not NaN
if
((
vel
<
1000000
)
&&
!
isnan
(
vel
)
&&
!
isi
nf
(
vel
))
{
if
((
vel
<
1000000
)
&&
!
qIsNaN
(
vel
)
&&
!
qIsI
nf
(
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
;
...
...
src/ui/QGCDataPlot2D.cc
View file @
39b220f8
...
...
@@ -535,7 +535,7 @@ void QGCDataPlot2D::loadCsvLog(QString file, QString xAxisName, QString yAxisFil
{
bool
okx
=
true
;
x
=
text
.
toDouble
(
&
okx
);
if
(
okx
&&
!
isnan
(
x
)
&&
!
isi
nf
(
x
))
if
(
okx
&&
!
qIsNaN
(
x
)
&&
!
qIsI
nf
(
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
)
&&
!
isi
nf
(
y
)
&&
text
.
length
()
>
0
&&
text
!=
" "
&&
text
!=
"
\n
"
&&
text
!=
"
\r
"
&&
text
!=
"
\t
"
)
if
(
oky
&&
!
qIsNaN
(
y
)
&&
!
qIsI
nf
(
y
)
&&
text
.
length
()
>
0
&&
text
!=
" "
&&
text
!=
"
\n
"
&&
text
!=
"
\r
"
&&
text
!=
"
\t
"
)
{
// Only append definitely valid values
xValues
.
value
(
curveName
)
->
append
(
x
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment