Skip to content
Snippets Groups Projects
Commit 62d6baf5 authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

undef PI of RTKLIB to avoid conflicts with other libraries

parent c9bb44b8
No related branches found
No related tags found
1 merge request!29Devel
Pipeline #21183 passed
...@@ -34,14 +34,6 @@ extern "C" { ...@@ -34,14 +34,6 @@ extern "C" {
// eigen // eigen
#include <Eigen/Dense> #include <Eigen/Dense>
#ifndef RAD2DEG
#define RAD2DEG 180.0 / 3.14159265358979323846
#endif
#ifndef DEG2RAD
#define DEG2RAD 3.14159265358979323846 / 180.0
#endif
namespace GnssUtils namespace GnssUtils
{ {
...@@ -226,5 +218,6 @@ enum Combination ...@@ -226,5 +218,6 @@ enum Combination
}; };
#undef PI // avoid conflict with other libraries that may define PI
} }
...@@ -29,25 +29,22 @@ namespace GnssUtils ...@@ -29,25 +29,22 @@ namespace GnssUtils
Eigen::Vector3d ecefToLatLonAlt(const Eigen::Vector3d& _ecef, bool in_rads) Eigen::Vector3d ecefToLatLonAlt(const Eigen::Vector3d& _ecef, bool in_rads)
{ {
Eigen::Vector3d latlonalt; Eigen::Vector3d latlonalt;
ecef2pos(_ecef.data(), latlonalt.data()); ecef2pos(_ecef.data(), latlonalt.data()); // in rads
if (not in_rads) // requested in degrees
latlonalt.head<2>() *= 180.0 / M_PI;
if (not in_rads)
{
latlonalt(0) = RAD2DEG * latlonalt(0);
latlonalt(1) = RAD2DEG * latlonalt(1);
}
return latlonalt; return latlonalt;
} }
Eigen::Vector3d latLonAltToEcef(const Eigen::Vector3d& _latlon, bool in_rads) Eigen::Vector3d latLonAltToEcef(const Eigen::Vector3d& _latlon, bool in_rads)
{ {
Eigen::Vector3d ecef; Eigen::Vector3d ecef;
if (not in_rads) if (not in_rads) // provided in degrees
{ {
Eigen::Vector3d latlon_rads = _latlon; Eigen::Vector3d latlon_rads = _latlon;
latlon_rads(0) = DEG2RAD * _latlon(0); latlon_rads.head<2>() *= M_PI / 180.0;
latlon_rads(1) = DEG2RAD * _latlon(1);
latlon_rads(2) = _latlon(2);
pos2ecef(latlon_rads.data(), ecef.data()); pos2ecef(latlon_rads.data(), ecef.data());
} }
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment