ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

How to add multiple objects to MoveIt Planning Scene?

asked 2016-10-03 07:51:51 -0500

rohin gravatar image

I am unable to add multiple objects to MoveIt planning scene. Using the Move Group C++ API, I do:

moveit::planning_interface::PlanningSceneInterface planning_scene_interface;
moveit_msgs::CollisionObject co, co2;

Fill in the fields of moveit_msgs co & co2

.. ..

co.operation = co.ADD;

std::vector<moveit_msgs::CollisionObject> collision_objects;
collision_objects.push_back(co2) ;

ROS_INFO("Add an object into the world");


When I run it, only one collision object appears i.e. co2 .

I can not figure out what am I missing. Please help me out.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-10-03 09:42:26 -0500

rbbg gravatar image

Hi Rohin,

Are you assigning unique id's to the CollisionObjects? Looking at the message type we can see that for the ADD operation, the CollisionObject information will be replaced if the object (with the id string as an identifier) is already present in the planningScene.

edit flag offensive delete link more



I was doing

co.header.frame_id = group.getPlanningFrame(); co2.header.frame_id = group.getPlanningFrame();

How should I assign different ID's?

rohin gravatar image rohin  ( 2016-10-03 10:01:06 -0500 )edit

Thanks! That solved it!

rohin gravatar image rohin  ( 2016-10-03 10:10:01 -0500 )edit

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: 2016-10-03 07:51:51 -0500

Seen: 1,284 times

Last updated: Oct 03 '16