ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I understand the recommendations in Omid's answer, but it does not contain instructions to create the PlanningSceneMonitor
yet, so that's why added this answer.
To create a planning scene monitor that is up to date with the planning scene maintained by the move_group node, you can do the following:
auto psm = std::make_shared<planning_scene_monitor::PlanningSceneMonitor>("robot_description");
psm->startSceneMonitor("/move_group/monitored_planning_scene");
The planning scene monitor will subscribe to the ROS topic /move_group/monitored_planning_scene
published by the move_group node.
However, this does not take into account collision objects that were published before the node was launched. Getting the planning scene monitor psm
up to date with the existing scene is achieved through a ROS service request to a service /get_planning_scene
published by the move_group node.
bool success = psm->requestPlanningSceneState("/get_planning_scene");
This leaves us with a planning scene monitor that allows us access to an up to date PlanningScenePtr
. I understand that this pointer should not be used in "normal" MoveIt use.
(There are many more ways to interact with the planning scene monitor, but this is the one I wanted to understand.)
2 | No.2 Revision |
I understand the recommendations in Omid's answer, but it does not contain instructions to create the PlanningSceneMonitor
yet, so that's why added this answer.
To create a planning scene monitor that is up to date with the planning scene maintained by the move_group node, you can do the following:
auto psm = std::make_shared<planning_scene_monitor::PlanningSceneMonitor>("robot_description");
psm->startSceneMonitor("/move_group/monitored_planning_scene");
The planning scene monitor will subscribe to the ROS topic /move_group/monitored_planning_scene
published by the move_group node.
However, this does not take into account collision objects that were published before the node was launched. Getting the planning scene monitor psm
up to date with the existing scene is achieved through a ROS service request to a service /get_planning_scene
published by the move_group node.
bool success = psm->requestPlanningSceneState("/get_planning_scene");
This leaves us with a planning scene monitor that allows us access to an up to date PlanningScenePtr
. I understand that this pointer should not be used in "normal" MoveIt use.
(There are many more ways to interact with the planning scene monitor, but this is the one I wanted to understand.)
Edit: I created a minimal working example here.