Ask Your Question

Adding collision objects with moveitCpp API

asked 2020-11-06 07:54:01 -0600

joang gravatar image

updated 2020-11-10 10:50:14 -0600


I am testing the MoveitCpp API in ROS melodic, and as I understand from the tutorials in the Moveit website (MoveitCpp tutorial), this API allows to get rid of the internal topic subscriptions and rosservices of move_group, but it is not clear to me how it can be used along the other moveit components explained in the other tutorials. My question is: If you use this API, from where does it get the planning scene information? How can the collision objects and attached objects be added to the plannings? Is there an example available?


Edit: I managed to publish the planning scene information to moveit_cpp by creating a moveit_msgs::PlanningScene and sending it with:


but I had to manually initiallize the message with an initial joint state and the allowed_collision_matrix in order to get a plan (after sending the message, the adjacent links caused a collision if the allowed_collision_matrix was empty). My new question, related to this is: How can I get the allowed_collision_matrix using moveit_cpp? Can it be read from the robot.srdf ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-06-23 06:19:39 -0600

pvl gravatar image

The PlanningSceneMonitor inside MoveItCpp already contains a planning scene. It can be accessed directly, but needs to be locked to avoid race conditions. There are convenience classes to do this LockedPlanningSceneRO (readonly) LockedPlanningSceneRW (read/write). With these classes, the PlanningScene can be accessed directly.

To answer your other questions, here are a few examples.


Adding a collision object:

planning_scene_monitor::LockedPlanningSceneRW scene{moveitCpp->getPlanningSceneMonitor()};

Adding an attached object:

planning_scene_monitor::LockedPlanningSceneRW scene{moveitCpp->getPlanningSceneMonitor()};
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: 2020-11-06 07:54:01 -0600

Seen: 66 times

Last updated: Nov 10 '20