ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
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: https://wiki.ros.org/rospy/Overview/Services

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