OctoMap / octomap_rviz_plugins

RViz display plugins for visualizing octomap messages in ROS
http://ros.org/wiki/octomap_rviz_plugins
89 stars 63 forks source link

Inner nodes are not rendered correctly #28

Closed MatthiasNieuwenhuisen closed 6 years ago

MatthiasNieuwenhuisen commented 6 years ago

Hi,

the RViz plugin iterates over the neighboring keys of a node to determine if it is visible or not:

https://github.com/OctoMap/octomap_rviz_plugins/blob/0a80d0c6ac513836ba543346ba3776b708a0ecc5/src/occupancy_grid_display.cpp#L534

This does not work on other levels than the leaves of the octree, as keys to not consider the octree depth. Consequently, nodes on the lowest level are rendered, but inner nodes are not rendered correctly if visualizing a pruned octree.

current

If I change https://github.com/OctoMap/octomap_rviz_plugins/blob/0a80d0c6ac513836ba543346ba3776b708a0ecc5/src/occupancy_grid_display.cpp#L523

to be always true (nodes are rendered regardless of their visibility) then I get the expected behavior:

expected

I publish this octree: clusters.bt.gz

with rosrun octomap_server octomap_server_node clusters.bt.

Best, Matthias

ahornung commented 6 years ago

Thanks, and good catch! That file looks like a really a useful test for many cases.

Would you mind submitting a fix as pull request?

MatthiasNieuwenhuisen commented 6 years ago

I think the pull request solves this issue. Due to the lack of an easy method to get all neighboring voxels in a pruned OctoMap, I might have missed some corner cases, but it works with all my test cases including rendering the tree until a user specified depth.