Skip to content

Commit

Permalink
Add more explanation about PushRosNamespace action (#4679)
Browse files Browse the repository at this point in the history
* Add more explanation about PushRosNamespace action

* make PushROSNamespace comform to PEP8

Co-authored-by: thomasung <[email protected]>
(cherry picked from commit a2f34a7)
  • Loading branch information
tomkimsour authored and mergify[bot] committed Sep 21, 2024
1 parent 6f2b12c commit c87f0ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 7 additions & 7 deletions source/How-To-Guides/Launch-file-different-formats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down

0 comments on commit c87f0ba

Please sign in to comment.