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

Scene: support deletion of Heightmap Visuals #3171

Closed scpeters closed 2 years ago

scpeters commented 2 years ago

As noted in #3159, removing a model containing a heightmap causes its collision shape to be remove from the physics subsystem in gzserver, but the heightmap visual remains in gzclient. This pull request fixes that so that height map visuals should now disappear from gzclient when a heightmap model is deleted. The sequence of commits is described below:

scpeters commented 2 years ago

The heightmap will never be visited because it isn't part of visuals.

it should be fixed by https://github.com/osrf/gazebo/commit/e497d4d41ae87ba5c2c613f684b1d14b480a60c7

tekfr34k commented 2 years ago

Thank you for fixing this as it's a functionality I need for a project. I might've spotted a bug however: When using ROS for:

For some reason it uses the old visual representation (of the old heightmap) but the collisions work as intended (they're based on the new heightmap). A dirty work around that I'm using now is just to spawn the same new heightmap, delete it, then spawn it again, so that "buffer"-like anomaly disappears.

tekfr34k commented 2 years ago

Seems my previously described issue was caused by the cache problems with heightmaps similar to the comments in #2604. Deleting the ~/.gazebo/paging/MODELNAME folder within my script, each time I spawn a new heightmap fixed the problem without needing the workaround of double spawning (which didn't work that great after further testing).

scpeters commented 2 years ago

@tekfr34k can you open an issue describing how to reproduce the problem?

thanks!

tekfr34k commented 2 years ago

@scpeters I couldn't narrow down what exactly the problem is yet. The issue is very inconsistent, depending on if I start Gazebo from my launch scripts or just without any configuration at all it behaves differently. Maybe it has something to do with defining multiple model paths (even if the models are named differently in the SDF/config). Adding a model path in the "Insert" tab which contains the heightmap SDF gives an issue of not showing the model in the overview. Maybe that's something to start with...