mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-16 04:07:35 +08:00
Generalized isfinite() in similar form as done in ekf.cpp https://github.com/PX4/ecl/blob/e3b9800cac459e7c279395c18191a872f465f848/EKF/ekf.cpp#L45-L52
This commit is contained in:
+13
-4
@@ -50,6 +50,15 @@
|
||||
#include <string.h>
|
||||
#include <float.h>
|
||||
|
||||
#ifndef __PX4_QURT
|
||||
#if defined(__cplusplus) && !defined(__PX4_NUTTX)
|
||||
#include <cmath>
|
||||
#define ISFINITE(x) std::isfinite(x)
|
||||
#else
|
||||
#define ISFINITE(x) isfinite(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2014 MAV GEO Library (MAVGEO). All rights reserved.
|
||||
@@ -709,7 +718,7 @@ float mavlink_wpm_distance_to_point_local(float x_now, float y_now, float z_now,
|
||||
float _wrap_pi(float bearing)
|
||||
{
|
||||
/* value is inf or NaN */
|
||||
if (!isfinite(bearing)) {
|
||||
if (!ISFINITE(bearing)) {
|
||||
return bearing;
|
||||
}
|
||||
|
||||
@@ -739,7 +748,7 @@ float _wrap_pi(float bearing)
|
||||
float _wrap_2pi(float bearing)
|
||||
{
|
||||
/* value is inf or NaN */
|
||||
if (!isfinite(bearing)) {
|
||||
if (!ISFINITE(bearing)) {
|
||||
return bearing;
|
||||
}
|
||||
|
||||
@@ -769,7 +778,7 @@ float _wrap_2pi(float bearing)
|
||||
float _wrap_180(float bearing)
|
||||
{
|
||||
/* value is inf or NaN */
|
||||
if (!isfinite(bearing)) {
|
||||
if (!ISFINITE(bearing)) {
|
||||
return bearing;
|
||||
}
|
||||
|
||||
@@ -799,7 +808,7 @@ float _wrap_180(float bearing)
|
||||
float _wrap_360(float bearing)
|
||||
{
|
||||
/* value is inf or NaN */
|
||||
if (!isfinite(bearing)) {
|
||||
if (!ISFINITE(bearing)) {
|
||||
return bearing;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user