Node duplicated when 'name' specified in the .launch.py
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
Research direction
Start by running the provided t_launch.py with the shown C++ node and compare behavior with and without the Node name argument. Trace launch_ros.actions.Node and the process setup to determine why the named node appears twice; done means the launch produces one /pick_place_sample2 node without the rosout duplicate-name warning.
Written by the indexing model from the issue text.
Description
Issue report
Required Info:
- Operating System:
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal $ uname -a Linux 1_xterm 4.15.0-1009-aws #9-Ubuntu SMP Wed May 16 15:22:54 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux - Installation type, Version or commit hash:
$ apt-cache policy ros-foxy-launch Installed: 0.10.10-1focal.20230306.200955 Candidate: 0.10.10-1focal.20230306.200955 - DDS implementation:
- No idea how to find that. stackoverflow.com#49004420
- Client library (if applicable):
- rclcpp
Steps to reproduce issue
t_launch.py (this causes the issue)
import os
import yaml
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
def generate_launch_description():
launchdemo = Node(
name="pick_place_sample2",
package="get_pose_client",
# executable="test_trajectory",
#executable="test_trajectory2",
executable="pick_place",
output="screen",
parameters=[],
)
nodes_to_start = [launchdemo]
return LaunchDescription(nodes_to_start)
#include <string>
#include "rclcpp/rclcpp.hpp"
class PickPlace : public rclcpp::Node {
public:
PickPlace(std::shared_ptr<rclcpp::Node> move_group_node)
: Node("pick_place") {} // end of constructor
}; // End of Class
int main(int argc, char **argv) {
rclcpp::init(argc, argv);
rclcpp::NodeOptions node_options;
node_options.automatically_declare_parameters_from_overrides(true);
auto move_group_node =
rclcpp::Node::make_shared("move_group_demo", node_options);
rclcpp::executors::SingleThreadedExecutor planner_executor;
std::shared_ptr<PickPlace> planner_node =
std::make_shared<PickPlace>(move_group_node);
planner_executor.add_node(planner_node);
planner_executor.spin();
rclcpp::shutdown();
return 0;
}
Expected behavior
[INFO] [pick_place-1]: process started with pid [25768]
:
(No error/warning from this node)
Actual behavior
Stdout
[INFO] [pick_place-1]: process started with pid [25768]
[pick_place-1] [WARN] [1681532371.573175635] [rcl.logging_rosout]: 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.
$ ros2 node list
WARNING: Be aware that are nodes in the graph that share an exact name, this can have unintended side effects.
:
/pick_place_sample2
/pick_place_sample2
:
Additional information
Seems related answers.ros.org#344141.
Possible workaround
As mentioned answers.ros.org#344141, removing name in Node instance seems to stop the issue.
- Dominant language
- Python
- Stars
- 156
- Forks
- 200
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 11
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ros2/launch
-
Use a relative target for the `latest` log symlink so it survives different absolute mount paths (host/Docker)Possibly taken @Old-Ding claimed this 139 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ros2/launch#978 · 1 reaction ·
Maintainers usually reply within 1 day
-
Add OpaqueFunction to list at docs.ros.orgMay be free again A pull request for this issue was closed without being merged. Openbug help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ros2/launch#826 · 4 comments ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Maintainers usually reply within 1 day
-
[launch_testing] pytest>8.1 dropped the legacy "path" argument from its internal hooks on humblePossibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 55/100
ros2/launch#979 · 6 comments ·
Maintainers usually reply within 1 day
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
hive size:simple
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
backend enhancement priority:P3
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
geolens-io/geolens#4161 ·
Maintainers usually reply within 1 day