ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Visualization in changed occupancy threshold case

asked 2017-12-04 09:38:10 -0500

tonyParker gravatar image


Default value of Occupancy Threshold is 0.5. In my code, I changed it to 0.2 by using setOccupancyThres(0.2).

It works fine in Octree e.g. all nodes having probability greater 0.2 considered as occupied.

But in RVIZ, the nodes with probability less than 0.5 does not shown up.

I think, I have to changed value somewhere in octomap_rviz plugins ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-12-21 10:57:33 -0500

cwalt gravatar image

I've been investigating this problem myself. The short answer is yes, the octomap_rviz plugin does not seem to support this.

Looking at 'occupancy_grid_display.cpp', within 'incomingMessageCallback()':

if (octomap->isNodeOccupied(*it))

'isNodeOccupied()' looks up the log of the threshold which you are presumably setting.

Unfortunately, it seems the 'octomap' variable being referenced here is not the same as the one you are setting the threshold of. It is created from the message in the callback:

octomap::AbstractOcTree* tree = octomap_msgs::msgToMap(*msg);
    if (tree){
        octomap = dynamic_cast<OcTreeType*>(tree);

Seeing as there is no field in the message to carry the threshold data, I don't know how to solve your problem.

Of course, you could hard code the value, but it is hardly ideal. Instead of isNodeOccupied()', use:

if (it->getOccupancy() > 0.5)

...where the value is between 0 and 1.

This applies to any other part which uses 'isNodeOccupied()', such as the neighbour checking.

Having said that, I have noticed that the Occupancy Map does show more cells as occupied. This could be down to it using a binary tree or something.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-12-04 09:38:10 -0500

Seen: 431 times

Last updated: Dec 21 '17