From c87f0ba4b77029ef660483c6ff43c8ff71a24766 Mon Sep 17 00:00:00 2001 From: Thomas Ung Date: Sat, 21 Sep 2024 07:43:04 +0200 Subject: [PATCH] Add more explanation about PushRosNamespace action (#4679) * Add more explanation about PushRosNamespace action * make PushROSNamespace comform to PEP8 Co-authored-by: thomasung (cherry picked from commit a2f34a7cbdbc1b336e137334c6a88550d6bec53f) --- .../Launch-file-different-formats.rst | 14 +++++++------- .../Using-ROS2-Launch-For-Large-Projects.rst | 2 ++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/source/How-To-Guides/Launch-file-different-formats.rst b/source/How-To-Guides/Launch-file-different-formats.rst index 4cbb7776a1..59ec9a7df5 100644 --- a/source/How-To-Guides/Launch-file-different-formats.rst +++ b/source/How-To-Guides/Launch-file-different-formats.rst @@ -45,7 +45,7 @@ Each launch file performs the following actions: from launch.substitutions import LaunchConfiguration from launch.substitutions import TextSubstitution from launch_ros.actions import Node - from launch_ros.actions import PushRosNamespace + from launch_ros.actions import PushROSNamespace from launch_xml.launch_description_sources import XMLLaunchDescriptionSource from launch_yaml.launch_description_sources import YAMLLaunchDescriptionSource @@ -82,8 +82,8 @@ Each launch file performs the following actions: # include a Python launch file in the chatter_py_ns namespace launch_py_include_with_namespace = GroupAction( actions=[ - # push_ros_namespace to set namespace of included nodes - PushRosNamespace('chatter_py_ns'), + # push_ros_namespace first to set namespace of included nodes for following actions + PushROSNamespace('chatter_py_ns'), IncludeLaunchDescription( PythonLaunchDescriptionSource( os.path.join( @@ -96,8 +96,8 @@ Each launch file performs the following actions: # include a xml launch file in the chatter_xml_ns namespace launch_xml_include_with_namespace = GroupAction( actions=[ - # push_ros_namespace to set namespace of included nodes - PushRosNamespace('chatter_xml_ns'), + # push_ros_namespace first to set namespace of included nodes for following actions + PushROSNamespace('chatter_xml_ns'), IncludeLaunchDescription( XMLLaunchDescriptionSource( os.path.join( @@ -110,8 +110,8 @@ Each launch file performs the following actions: # include a yaml launch file in the chatter_yaml_ns namespace launch_yaml_include_with_namespace = GroupAction( actions=[ - # push_ros_namespace to set namespace of included nodes - PushRosNamespace('chatter_yaml_ns'), + # push_ros_namespace first to set namespace of included nodes for following actions + PushROSNamespace('chatter_yaml_ns'), IncludeLaunchDescription( YAMLLaunchDescriptionSource( os.path.join( diff --git a/source/Tutorials/Intermediate/Launch/Using-ROS2-Launch-For-Large-Projects.rst b/source/Tutorials/Intermediate/Launch/Using-ROS2-Launch-For-Large-Projects.rst index 5fa92551c6..8217cb76d7 100644 --- a/source/Tutorials/Intermediate/Launch/Using-ROS2-Launch-For-Large-Projects.rst +++ b/source/Tutorials/Intermediate/Launch/Using-ROS2-Launch-For-Large-Projects.rst @@ -281,6 +281,8 @@ However, if the launch file contains a large number of nodes, defining namespace To solve that issue, the ``PushROSNamespace`` action can be used to define the global namespace for each launch file description. Every nested node will inherit that namespace automatically. +.. attention:: PushROSNamespace has to be the first Action in the list for the following actions to apply the namespace + To do that, firstly, we need to remove the ``namespace='turtlesim2'`` line from the ``turtlesim_world_2_launch.py`` file. Afterwards, we need to update the ``launch_turtlesim_launch.py`` to include the following lines: