Ask Your Question

Revision history [back]

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()