gazebosim / gazebo-classic

Gazebo classic. For the latest version, see https://github.com/gazebosim/gz-sim
http://classic.gazebosim.org/
Other
1.21k stars 484 forks source link

Lunar DEMs : Make Heightmap loader use spherical coordinates. #3258

Closed adityapande-1995 closed 2 years ago

adityapande-1995 commented 2 years ago

This PR is an ongoing set of PRs to make lunar dem support available in gazebo classic.

Problem tackled

For gzserver

HeightmapDataLoader::LoadDEMAsTerrain() needs access to the world's spherical coordiantes object to load lunar DEMs correctly. This in turn is called by HeightmapDataLoader::LoadTerrain() , which is loaded by HeightmapShape::LoadTerrainFile() which ultimately has access to the spherical coordiantes object.

This PR overloads the above functions so that the spherical coordinates pointer is available to the DEM object.

# Inside gazebo/gazebo/physics/
HeightmapDataLoader::LoadDEMAsTerrain() --> Loads DEMs, needs access to SphericalCoordinates
  |
HeightmapDataLoader::LoadTerrainFile()
  |
HeightmapShape::LoadTerrain() --> Has access to SphericalCoordinates

For gzclient

# inside gazebo/rendering

HeightmapLoader::LoadTerrainFile() --> Needs SphericalCoordiantesPtr
 | 
Heightmap::Load() --> queries spherical coordinates using a service
 |
World.cc --> Exposes service to return world surface type.

Possible issues

This might still lead to some ABI incompatibility issues, and I can go for a different approach then, probably by renaming functions or deprecating old ones.

It is also possible to direct use the service in HeightmapDataLoader::LoadDEMAsTerrain(), but that might slow down the loading of DEMs even in server mode.

adityapande-1995 commented 2 years ago

I'd like to see a unit test for the new HeightmapData::LoadTerrainFile overload in HeightmapData_TEST.cc

I made several other comments as well that I have implemented in 9cdeebc that you may consider cherry-picking

Added test https://github.com/osrf/gazebo/pull/3258/commits/8dc627054d2297c34de55794fc63438875c188e5