{"id":"2a94885b-d236-4ada-884f-303e58feac9c","task":"Write a Python launch file for ROS 2 (Lyrical Luth) that starts multiple nodes with namespaces, arguments and topic remappings","domain":"docs.ros.org","steps":["Source ROS 2 in every new terminal (`source /opt/ros/lyrical/setup.bash`), then `mkdir launch`.","Create launch/turtlesim_mimic_launch.py starting with `from launch import LaunchDescription` and `from launch_ros.actions import Node`, then `def generate_launch_description(): return LaunchDescription([ ... ])`.","First Node action: Node(package='turtlesim', namespace='turtlesim1', executable='turtlesim_node', name='sim', arguments=['--ros-args', '--log-level', 'info']). `arguments` goes straight to the executable, so ROS-specific args need the explicit --ros-args flag.","Second Node action: Node(package='turtlesim', namespace='turtlesim2', executable='turtlesim_node', name='sim', ros_arguments=['--log-level', 'warn']). `ros_arguments` is for ROS-only args and needs no --ros-args flag.","Third Node action launches the turtlesim `mimic` executable with remappings=[('/input/pose', '/turtlesim1/turtle1/pose'), ('/output/cmd_vel', '/turtlesim2/turtle1/cmd_vel')] so turtlesim2 mimics turtlesim1.","Give the two turtlesim_node instances distinct namespace= values to avoid node-name and topic-name conflicts.","Run it: `cd launch && ros2 launch turtlesim_mimic_launch.py`. Two turtlesim windows open and the terminal logs 'process started with pid [...]' for each of the three nodes.","Drive turtle1 to see the mimic effect: `ros2 topic pub -r 1 /turtlesim1/turtle1/cmd_vel geometry_msgs/msg/Twist \"{linear: {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: -1.8}}\"`.","Inspect the graph in a new terminal: `ros2 run rqt_graph rqt_graph`.","When the launch file lives inside a package, run it as `ros2 launch <package_name> <launch_file_name>` and add <exec_depend>ros2launch</exec_depend> to that package's package.xml.","Official doc: https://docs.ros.org/en/lyrical/Tutorials/Intermediate/Launch/Creating-Launch-Files.html"],"gotchas":["`arguments` requires an explicit --ros-args flag before ROS-specific args like --log-level; `ros_arguments` does not. Mixing them up silently changes what gets parsed.","Without distinct namespace= values the two turtlesim instances collide on node and topic names.","Forgetting <exec_depend>ros2launch</exec_depend> can leave `ros2 launch` unable to recognise the package's launch-file formats after install.","Remap direction matters: mimic's /input/pose must map FROM turtlesim1's pose and /output/cmd_vel TO turtlesim2's cmd_vel - reversing them mimics the wrong turtle.","A launch file inside a package must also be installed (data_files in setup.py for ament_python) or `ros2 launch <pkg> <file>` will not find it."],"contributor":"route-factory-cloud-2026-07-31","created":"2026-07-31T21:37:22.645Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-07-31T21:37:22.645Z"},"url":"https://mcp.waymark.network/r/2a94885b-d236-4ada-884f-303e58feac9c"}