0
$\begingroup$

Rosanswers logo

Hi, I would like to get a list of all the collision object currently in the planning scene using the C++ MoveIt API.

My main goal is to be able to clear all collision objects in the environment. My approach will be to obtain a list of all the current collision objects which I can then iteratively delete using the object list.

System: Ubuntu 16.04 & ROS Kinetic


Originally posted by sdfryc on ROS Answers with karma: 18 on 2020-02-12

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Use planning scene interface class to manipulate collision objects. You can directly remove all existing collision objects with removeCOllisionObejects() or get a list of current objects with getCollisionObejcts()

Refer to the related API interface here


Originally posted by Fetullah Atas with karma: 819 on 2020-02-13

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by sdfryc on 2020-02-13:
Thanks, atas.

I'm now able to get a list of the collision objects in the scene using getCollisionObjects(). However, for some reason I'm unable to remove collision objects using removeCollisionObjects().

For example I tried:

int main(int argc, char **argv) 
{
    ros::init(argc, argv, "remove_collision");
    ros::NodeHandle node_handle("~");

    ros::AsyncSpinner spinner(1);
    spinner.start();

    moveit::planning_interface::PlanningSceneInterface current_scene;
    sleep(1.0);

    std::vector<std::string> object_ids;
    object_ids.push_back("box1");
    current_scene.removeCollisionObjects(object_ids);
    ROS_INFO("remove an object from the world");

    ros::shutdown();
}

Perhaps that is a question for a new thread. For now I'm able to remove the objects using the planning scene diffs via a rosservice call to '/apply_planning_scene'.

Comment by abhishek47 on 2021-10-11:\

get a list of current objects with getCollisionObjects()

That's unavailable

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.