ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
In your code, the only CollisionObject
message you send to the planning scene contains the ADD
operation. You can remove the object by sending the message with the REMOVE
flag instead.
[...]
moveit_msgs::CollisionObject collision_object;
collision_object.id = "BOX_" + str;
collision_object.operation = collision_object.REMOVE;
planning_scene_interface.applyCollisionObject(collision_object);
On another note, it seems like you are sending a vector with a single element to the planning scene inside your for-loop. It would make more sense to construct the vector of collision objects inside the loop and the apply them to the planning scene once the vector is complete.
Also, the line in your code that says bool applyCollisionObject(const moveit_msgs::CollisionObject& collision_objects);
does not really make sense (that's a function declaration, but you are not defining the function anywhere). The question where you copied this from was referring to this applyCollisionObject method, which you can use as described in the example code above.
2 | No.2 Revision |
In your code, the only CollisionObject
message you send to the planning scene contains the ADD
operation. You can remove the object by sending the message with the REMOVE
flag instead.
[...]
moveit_msgs::CollisionObject collision_object;
collision_object.id = "BOX_" + str;
collision_object.operation = collision_object.REMOVE;
planning_scene_interface.applyCollisionObject(collision_object);
On another note, it seems like you are sending a vector with a single element to the planning scene inside your for-loop. It would make more sense to construct the vector of collision objects inside the loop and the apply them to the planning scene once the vector is complete.
Also, the line in your code that says bool applyCollisionObject(const moveit_msgs::CollisionObject& collision_objects);
does not really make sense (that's a function declaration, but you are not defining the function anywhere). The question where you copied this from was referring to this applyCollisionObject method, which you can use as described in the example code above. above.