-
Notifications
You must be signed in to change notification settings - Fork 516
Fix UNIT_Dem_TEST failure on Ubuntu 20.04 #3275
base: gazebo11
Are you sure you want to change the base?
Conversation
Signed-off-by: Aditya <[email protected]>
Signed-off-by: Aditya <[email protected]>
Signed-off-by: Aditya <[email protected]>
Signed-off-by: Aditya <[email protected]>
Signed-off-by: Aditya <[email protected]>
Signed-off-by: Aditya <[email protected]>
Signed-off-by: Aditya <[email protected]>
Signed-off-by: Aditya <[email protected]>
Signed-off-by: Aditya <[email protected]>
Signed-off-by: Aditya <[email protected]>
| public: double worldWidth = 0; | ||
|
|
||
| /// \brief Real height of the world in meters. | ||
| public: double worldHeight; | ||
| public: double worldHeight = 0; |
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
| // 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); |
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.
Is it possible to use the libproj macros? https://github.com/OSGeo/PROJ/blob/35e4207a9d9eb86b4e5188f00eae1f152306dad3/src/proj.h#L175-L177
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
...
#endifThere 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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that will be resolved if you add find_package(PROJ REQUIRED) then add ${PROJ_INCLUDE_DIRS} to include_directories, and ${PROJ_LIBRARIES} to target_link_libraries
eg.,
Update:
gazebo-classic/gazebo/common/CMakeLists.txt
Lines 16 to 18 in 09fb1bc
| if (HAVE_GDAL) | |
| include_directories(${GDAL_INCLUDE_DIR}) | |
| endif() |
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 PROJ is being used but it may need PROJ4 instead: https://github.com/OSGeo/PROJ/blob/65f60f6e27482920aa5007af5357d1f37b220b90/cmake/CMakeLists.txt#L51-L56
Signed-off-by: Aditya [email protected]
🦟 Bug fix
Fixes ##2828
Summary
Differences in versions of
libprojleads to different results in coordiante transformation. This PR proposes worksarounds for that.Checklist
codecheckpassed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-bymessages.🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸