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
sleep(1)
co = CollisionObject()
co.id = '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.id, co.mesh_poses, co.meshes)
Thanks in advance!
↧