Warn instead of fail for non-Earth Dem's on 20.04 (#2828) #2882
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A test failure related to the
gazebo::common::Dem
class on Ubuntu 20.04 was reported in #2828 and seems to be caused by loading Dem's that are based on a celestial body other than earth. The code doesn't fail like this in 18.04 (though I believe it computes Dem sizes incorrectly as reported in #2881) but it is now failing in 20.04 by returning anullptr
fromOGRCreateCoordinateTransformation
if the source and target coordinate reference systems refer to different celestial bodies. SinceDem::GetGeoReference
returnsvoid
instead ofbool
, I've added agzthrow
to that function if the coordinate transformation is unsuccessful along with try / catch blocks that printgzwarn
console messages in the two places that call this API:Dem::Load
callsDem::GetGeoReference
for the corners of theDem
to compute the sizeHeightmapShape::LoadTerrainFile
callsDem::GetGeoReferenceOrigin
in order to configure theSphericalCoordinates
class used by the gazebo gui and theGpsSensor
The
UNIT_Dem_TEST
will still fail on 20.04 with these changes, but at least it won't crash.