ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Why planning scene can't subscribe the new planning scene?

asked 2020-10-11 03:15:10 -0600

Heho gravatar image

Hi everyone! I am trying to add an object into RVIZ throught C++ interface. I had follow the official tutorial Planning Scene ROS API and failed in step 1....

My Code is follow

moveit_visual_tools::MoveItVisualTools visual_tool("world");
visual_tool.deleteAllMarkers();

ros::Publisher planning_scene_diff_publisher = node_hadle.advertise<moveit_msgs::PlanningScene>("planning_Scene",1);
ros::WallDuration sleep_t(0.5);

while (planning_scene_diff_publisher.getNumSubscribers() < 1)
{
  sleep_t.sleep();
}
visual_tool.prompt("Press 'next' in the RvizVisualToolsGui window to start the demo");

The fixed frame of my robot is "world".

The "Planning Scene Topic" shows in RVIZ is "/move_group/monitored_planning_scene".

After I run my code, I will see the can't break form while (planning_scene_diff_publisher.getNumSubscribers() < 1).

In addition, rqt_graph shows nothing has subscribed from "planning_Scene" which I just creat.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-10-11 08:46:44 -0600

JackB gravatar image

TLDR: Make sure the topic name that your are publishing is actually the name being subscribed to.

If this follows the tutorial exactly, then you probably just need to map your topics correctly. It sounds like RVIZ is subscribing to /move_group/monitored_planning_scene and your topic is publishing to planning_Scene

In your launch file of this c++ node you can remap the topic :

<remap from="planning_Scene" to="/move_group/monitored_planning_scene"/>

Or you can hardcode the RVIZ topic into the c++ node by replacing planning_Scene with /move_group/monitored_planning_scene where you define the publisher above.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-10-11 03:15:10 -0600

Seen: 312 times

Last updated: Oct 11 '20