-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix UNIT_Dem_TEST failure on Ubuntu 20.04 #3275
base: gazebo11
Are you sure you want to change the base?
Changes from 10 commits
82b92ca
5958b37
883ac12
07f2aed
944e78f
3a87ff4
0e48fd4
7ad85cb
eb21501
09fb1bc
128a66c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -180,8 +180,19 @@ TEST_F(DemTest, NegDem) | |||||||
// Check the heights and widths | ||||||||
EXPECT_EQ(33, static_cast<int>(dem.GetHeight())); | ||||||||
EXPECT_EQ(33, static_cast<int>(dem.GetWidth())); | ||||||||
EXPECT_FLOAT_EQ(293.51068, dem.GetWorldHeight()); | ||||||||
EXPECT_FLOAT_EQ(293.51089, dem.GetWorldWidth()); | ||||||||
// This DEM model is from the moon. Older versions | ||||||||
// of libproj will calculate the size assuming it | ||||||||
// is of the Earth, unless we specify the surface. | ||||||||
bool sizeSameAsEarth = | ||||||||
(std::abs(293.51089 - dem.GetWorldWidth()) < 0.1) | ||||||||
&& (std::abs(293.51068 - dem.GetWorldHeight()) < 0.1); | ||||||||
// Newer versions give invalid sizes, 0 in this case. | ||||||||
bool invalidSize = | ||||||||
(dem.GetWorldHeight() < 0.001) && | ||||||||
(dem.GetWorldWidth() < 0.001); | ||||||||
|
||||||||
EXPECT_TRUE(sizeSameAsEarth || invalidSize); | ||||||||
Comment on lines
+183
to
+194
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to use the or https://github.com/OSGeo/PROJ/blob/35e4207a9d9eb86b4e5188f00eae1f152306dad3/src/proj.h#L188 eg. #if PROJ_AT_LEAST_VERSION(<ubuntu 18.04 version>)
EXPECT_FLOAT_EQ(293.51068, dem.GetWorldHeight());
EXPECT_FLOAT_EQ(293.51089, dem.GetWorldWidth());
#else
...
#endif There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did try that initially (82b92ca), but the CI was complaining that it couldn't find "proj.h". Worked for me locally though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe that will be resolved if you add eg., Update: gazebo-classic/gazebo/common/CMakeLists.txt Lines 16 to 18 in 09fb1bc
To be: if (HAVE_GDAL)
include_directories(${GDAL_INCLUDE_DIR})
if (PROJ_FOUND)
include_directories(${PROJ_INCLUDE_DIRS})
endif()
endif() I'm not sure what version of |
||||||||
|
||||||||
EXPECT_FLOAT_EQ(-212.29616, dem.GetMinElevation()); | ||||||||
EXPECT_FLOAT_EQ(-205.44009, dem.GetMaxElevation()); | ||||||||
} | ||||||||
|
@@ -236,8 +247,18 @@ TEST_F(DemTest, LunarDemLoad) | |||||||
// as the celestial bodies in DEM file and | ||||||||
// default spherical coordinates do not match. | ||||||||
EXPECT_EQ(dem.Load(path.string()), 0); | ||||||||
EXPECT_NEAR(293.51, dem.GetWorldWidth(), 0.1); | ||||||||
EXPECT_NEAR(293.51, dem.GetWorldHeight(), 0.1); | ||||||||
|
||||||||
// Older versions of libproj will default the size | ||||||||
// calculation to Earth's size. | ||||||||
bool sizeSameAsEarth = | ||||||||
(std::abs(293.51 - dem.GetWorldWidth()) < 0.1) | ||||||||
&& (std::abs(293.51 - dem.GetWorldHeight()) < 0.1); | ||||||||
// Newer versions of libproj will output a zero. | ||||||||
bool invalidSize = | ||||||||
(dem.GetWorldWidth() < 0.001) && | ||||||||
(dem.GetWorldHeight() < 0.001); | ||||||||
|
||||||||
EXPECT_TRUE(sizeSameAsEarth || invalidSize); | ||||||||
|
||||||||
// Setting the spherical coordinates solves the | ||||||||
// problem. | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
= 0
isn't necessary