mars-robot-simulation / mars_core

BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Loading HeightMaps requires mars_graphics #1

Open jliersch opened 1 week ago

jliersch commented 1 week ago

Situation

The loader for heightmaps is implemented in mars_graphics and assigned in mars_core::Simulator (see below) to be used in mars_scene_loader. In the mars_scene_loader it is used not only to set up the graphics, but also to set up the collisions for the height field.

https://github.com/mars-robot-simulation/mars_core/blob/bd5c975c611ebd4a5a8f4932ed8cad2993b968a2/src/Simulator.cpp#L328

Task

Make the height map loader accessible even if mars_graphics is not loaded to enable using heightfields if mars_app is started without gui (mars_app --no-gui ...).

haider8645 commented 1 week ago

Yes, in the current version that is the case. Based on the changes from the open PR's, the visual of the height map is added from the envire_mars_graphics. If this is not loaded then there are no subscribers to the graph events, so even if the mars_scene_loader adds a visual item, it will not be handled by anyone. The collisions are added from the envire_mars_ode_collision. If this is loaded then without the gui, the collisions should still be added. What do you think?

jliersch commented 1 week ago

But don't we need to still read the pixel data to create the envire heightfield object which would be handled by envire_mars_ode_collisions and optionally also envire_mars_graphics? cf.:

https://github.com/mars-robot-simulation/mars_scene_loader/blob/aead83a72c9c6904a8c5b5ba5b706f411e71e423/src/MarsSceneLoader.cpp#L353

haider8645 commented 1 week ago

That's right. Then as you said initially, we need to make the interface available for reading the pixel data outside of graphics.

haider8645 commented 2 days ago

The loading of Mesh collisons data also requires mars_graphics. This is more difficult to factor out as compared to the heightmap interface because the meshinterface needs functions more tightly coupled in the mars_graphics lib https://github.com/mars-robot-simulation/envire_mars_ode_collision/blob/21848156c7b4e79b59f6feda01d978e3453ec1f4/src/EnvireOdeCollisionPlugins.cpp#L244

jliersch commented 2 days ago

How heightmaps and meshes should be loaded may depend on which library is used for the visualization and thus may depend on mars_graphics. But how the collision objects for meshes and heightmaps are loaded should not depend on mars_graphics but may depend on mars_ode_collision. We should discuss how we want to deal with this @malter & @haider8645