Ask Your Question

Clearing PlanningScene at beginning of script (moveit_commander)

asked 2018-01-29 03:47:09 -0500

cschindlbeck gravatar image

updated 2018-01-29 03:56:09 -0500

Hello everyone,

i have a script where i add objects to the Planning Scene in MoveIt!. I want to clear all previously added objects at the beginning of the script, however, that does not work. What am i doing wrong? I also tried to iterate over all known objects but without success.

Is it because every time i start the script i create a new node and the objects of the "previous" node are not accessible?

rospy.init_node('planningscenenode', anonymous=True)
scene = moveit_commander.PlanningSceneInterface()

scene.remove_world_object()  # Does not work at the beginning

co = CollisionObject() = 'plate'+str(0)
co.meshes = rospkg.RosPack().get_path('agilus')+"/meshes/" + "plate.stl"
ps = PoseStamped()
ps.pose.position.x = -0.6
ps.pose.position.y = -0.6
ps.pose.position.z = 0
ps.pose.orientation = Quaternion(*tf.transformations.quaternion_from_euler(np.deg2rad(float(0)), np.deg2rad(float(0)), np.deg2rad(float(0))))

co.mesh_poses = ps
co.mesh_poses.header.frame_id = '/base_link'
scene.add_mesh(, co.mesh_poses, co.meshes)

Thanks in advance!

edit retag flag offensive close merge delete


This doesn't answer your question, but why are you using the built-in sleep vs the rospy version?

jayess gravatar image jayess  ( 2018-01-29 04:28:21 -0500 )edit

Lack of knowledge. I will consider it in future code.

cschindlbeck gravatar image cschindlbeck  ( 2018-01-29 07:18:40 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-01-29 10:07:23 -0500

cschindlbeck gravatar image

updated 2018-01-30 02:06:26 -0500

I found a dirty fix


There should be a better way right?

Edit: The problem could be related to

edit flag offensive delete link more

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: 2018-01-29 03:47:09 -0500

Seen: 142 times

Last updated: Jan 30 '18