Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting name parameter leads to duplicate nodes with same name #342

Open
g-argyropoulos opened this issue Dec 20, 2022 · 1 comment
Open

Comments

@g-argyropoulos
Copy link

Bug report

Required Info:

  • Operating System:
    • Ubuntu 22.04
  • Installation type:
    • Binaries
  • DDS implementation:
    • rmw_cyclonedds_cpp

Steps to reproduce issue

ros2 launch moveit2_tutorials moveit_cpp_tutorial.launch.py

Expected behavior

A single /moveit_cpp_tutorial node and a single /rviz2 node will be created.

Actual behavior

Two /moveit_cpp_tutorial and /rviz2 nodes were created.

~$ ros2 node list
WARNING: Be aware that are nodes in the graph that share an exact name, this can have unintended side effects.
/controller_manager
/joint_state_broadcaster
/moveit_cpp_tutorial
/moveit_cpp_tutorial
/moveit_cpp_tutorial_private_94809022977232
/panda_arm_controller
/panda_hand_controller
/robot_state_publisher
/rviz2
/rviz2
/rviz2_private_140513882059600
/static_transform_publisher
/transform_listener_impl_5605b0dc2500
/transform_listener_impl_563a722cba70
/transform_listener_impl_7fcbf0098ea0

Additional information

Everything is from their respective official repositories.
If I remove (or comment out), like below, the name parameter of the Nodes in the launch file, the problem goes away.
Why is that? Is this an expected behavior? Should I ignore the warning or stop naming Nodes through the launch file?

Thank you in advance.

def generate_launch_description():
    moveit_config = (
        MoveItConfigsBuilder("moveit_resources_panda")
        .robot_description(file_path="config/panda.urdf.xacro")
        .trajectory_execution(file_path="config/gripper_moveit_controllers.yaml")
        .moveit_cpp(
            file_path=get_package_share_directory("moveit2_tutorials")
            + "/config/moveit_cpp.yaml"
        )
        .to_moveit_configs()
    )
    # MoveItCpp demo executable
    moveit_cpp_node = Node(
        #name="moveit_cpp_tutorial",
        package="moveit2_tutorials",
        executable="moveit_cpp_tutorial",
        output="screen",
        parameters=[moveit_config.to_dict()],
    )

    # RViz
    rviz_config_file = (
        get_package_share_directory("moveit2_tutorials")
        + "/launch/moveit_cpp_tutorial.rviz"
    )
    rviz_node = Node(
        package="rviz2",
        executable="rviz2",
        #name="rviz2",
        output="log",
        arguments=["-d", rviz_config_file],
        parameters=[
            moveit_config.robot_description,
            moveit_config.robot_description_semantic,
        ],
    )
@dhood
Copy link
Member

dhood commented Jul 13, 2023

Hi @g-argyropoulos , not a maintainer here, but passed by your question and figure others might too:

This can happen when two nodes exist in a single executable, they will all get the same name remapping, which might explain the behaviour you're seeing. The launch_ros Node concept is a wrapper around an executable and doesn't know how many times rclcpp nodes are created inside, and it'll pass the name remapping to any and all that are inside. HTH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants