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

[ROS2] Using create_sub_node leads to two nodes with same name

asked 2019-08-23 05:03:54 -0500

madmax gravatar image

If I create a node, and then create a subnode, I see on the cmd line 2 nodes with same name!
I think this is a bug, or is this not the correct usage?

If you then check params for the base node, it's coincidence which params will be shown, either that of base_node or from sub_node.

  //base_node and base_node/test are expected
  auto subnode = this->create_sub_node("test");  
  rclcpp::spin(subnode)
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2020-10-03 18:35:54 -0500

It looks like it is a bug (at least still present in October 2020): https://github.com/ros2/rclcpp/issues...

Below, It is shown a possible workaround. You can just create a "full" new node extending the original node namespace (second parameter).

  auto subnode = rclcpp::Node::make_shared("test", parent_node->get_fully_qualified_name()));
  rclcpp::spin(subnode)
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2019-08-23 05:03:54 -0500

Seen: 1,114 times

Last updated: Oct 03 '20