ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

What is the intended way of clearing MoveIt's octomap?

asked 2020-08-14 01:45:20 -0500

HappyBit gravatar image

This question relates to the planing framework MoveIt. I use the python interface to send messages to the planning scene managed by the move group node. So far I'm able to represent the environment using a depth camera and linking it to the octomap.

Now I want to clear a specific area of this octomap. I allready tried adding a collision object to the planning scene but in rviz the voxel were still visible inside the added object. Hence the octomap wasn't cleared in this area as I suspected.

My question is, what is the intended way of clearing parts of the octomap? Is it possible to use predefined shapes and meshes? Can anyone link me some project/code were this kind of use-case/issue is addressed?

Thanks to anyone reading this :)

I'm using kinetic on a Ubuntu Xenial 16.04.

edit retag flag offensive close merge delete


Hi! I am looking at this problem as well. Have you had any progress?

geotsam gravatar image geotsam  ( 2020-12-22 04:00:35 -0500 )edit

@geotsam please do not post answers that are not answers; this is a Q&A site not a discussion forum. If you have a question please add a comment or open your own question. I've moved your answer to a comment. Good luck with your problem!

jarvisschultz gravatar image jarvisschultz  ( 2020-12-22 10:47:58 -0500 )edit

Unfortunately not I have a messy workaround with my use case. A solution for the problem would still be interesting.

HappyBit gravatar image HappyBit  ( 2020-12-22 12:32:24 -0500 )edit

@HappyBit are you modifying the octomap directly or are you doing something different (like ignoring the octomap for a short period of time)?

geotsam gravatar image geotsam  ( 2020-12-23 06:57:38 -0500 )edit

im using the python bindings of moveit. I save the current planning_scene, clear_octomap service call, do_action, apply the saved octomap

HappyBit gravatar image HappyBit  ( 2020-12-24 03:54:45 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-12-23 17:35:58 -0500

Hi I've just figured this out for myself so thought I'd share my solution.

Clear Octomap is a service that is setup by the moveit planner that takes an Empty service call to activate. To see that it is running properly, use the rosservice list and rosservice info /clear_octomap commands. To use this service, you need to set up a service client by adding the following to whatever python file you're using for motion planning.

from std_srvs.srv import Empty
rospy.wait_for_service('/clear_octomap') #this will stop your code until the clear octomap service starts running
clear_octomap = rospy.ServiceProxy('/clear_octomap', Empty)

More documentation on services and service clients here:

Whenever you want to clear the octomap, you now just have to call: clear_octomap()

edit flag offensive delete link more


Thanks for the answer. I knew this procedure. The question is: how to clear parts of the octomap? ie not the whole octomap but eg a box or marker. Say you have clutter in the map and want to clear it because you know the space there is free. Is there an alternative to clear the whole octomap using the service call you just described?

HappyBit gravatar image HappyBit  ( 2020-12-28 06:01:34 -0500 )edit

@HappyBit the clear octomap service doesn't take any arguments so there is no way to use it to clear just a section. You can filter the input pointcloud/depthmap to remove noise on the input or if you want to remap a specific area you can point the camera at that area and the octomap will update itself.

How do you know the space there is free without either confirming it with the depth camera or knowing that you removed an object yourself, which could be added and manipulated as a collision object?

jland10 gravatar image jland10  ( 2020-12-28 21:59:21 -0500 )edit

@jland10 For me the problem arises when adding a collision object for manipulation. The octomap, being not super accurate, leaves some occupied voxels around the object, which in turn makes the manipulation of the object more difficult and sometimes even dangerous. So in this case, it would be helpful, if the area around the object could be cleared.

geotsam gravatar image geotsam  ( 2021-01-05 04:44:03 -0500 )edit

@HappyBit i was having issues with the octomap clearing out near the collision object and i found that it was because i was too close to the object and no longer in my octomap update range. When I added the collision object from further away it fixed the problem and cleared a really wide area with just a small collision object

jland10 gravatar image jland10  ( 2021-01-12 18:37:16 -0500 )edit

@jland10 This sounds interesting. I presumed that a way like this exist, but was not able to implement it. What exactly do you mean with: i was too close to the object and no longer in my octomap update range. Do you mean the parameters from sensor_manager.launch.xml:

 <param name="octomap_frame" type="string" value="odom" />
 <param name="octomap_resolution" type="double" value="0.08" /> 
 <param name="max_range" type="double" value="1.5" /> 
 <!-- specifies the maximum range value to be applied for any sensor input to this node. -->
HappyBit gravatar image HappyBit  ( 2021-01-13 01:05:20 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-08-14 01:45:20 -0500

Seen: 1,130 times

Last updated: Aug 14 '20