Unexpected Node Duplication and Unable to Kill node in ROS2

asked 2023-03-31 09:21:38 -0500

zkytony gravatar image

I got a warning that says

Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from being published on the rosout topic.

I am not sure what caused this. When I run ros2 node list, I see

$ ros2 node list
WARNING: Be aware that are nodes in the graph that share an exact name, this can have unintended side effects.

I thought when I Ctrl-C terminate a launch file, it automatically terminates the nodes ran by it. I did call rclcpp::shutdown(); at the end of my node's main function.

I want to now remove a duplicated node. I saw here about using ros2 lifecycle set <nodename> shutdown

...which should make the node with name nodename transition to its shutdown state and consequently shutdown the process.

However, when I run ros2 lifecycle set foo_node shutdown, I get "Node not found."

I am confused. Questions:

  • Why doesn't ROS2 kill the node started by ros2 launch after the launch file is Ctrl-C-terminated?
  • Why does the lifecycle command say "Node not found" when ros2 node list lists those nodes?

I am using ROS2 Humble.

edit retag flag offensive close merge delete


Bumping this, since I'm also having the exact same issue at the moment.

ROS_Engineer gravatar image ROS_Engineer  ( 2023-04-19 12:30:57 -0500 )edit