From 3360c6eed6144e97c6f1fa868ddb0f09fdd68cba Mon Sep 17 00:00:00 2001 From: ymd-stella Date: Sun, 23 Jul 2023 19:44:46 +0900 Subject: [PATCH] Use ParameterFile (allow_substs) Signed-off-by: ymd-stella --- nav2_bringup/launch/bringup_launch.py | 13 ++++++++----- nav2_bringup/launch/localization_launch.py | 14 ++++++++------ nav2_bringup/launch/navigation_launch.py | 14 ++++++++------ nav2_bringup/launch/slam_launch.py | 13 ++++++++----- .../launch/collision_monitor_node.launch.py | 14 ++++++++------ 5 files changed, 40 insertions(+), 28 deletions(-) diff --git a/nav2_bringup/launch/bringup_launch.py b/nav2_bringup/launch/bringup_launch.py index 8fddcc32531..24668627c81 100644 --- a/nav2_bringup/launch/bringup_launch.py +++ b/nav2_bringup/launch/bringup_launch.py @@ -24,6 +24,7 @@ from launch.substitutions import LaunchConfiguration, PythonExpression from launch_ros.actions import Node from launch_ros.actions import PushRosNamespace +from launch_ros.descriptions import ParameterFile from nav2_common.launch import RewrittenYaml @@ -53,11 +54,13 @@ def generate_launch_description(): remappings = [('/tf', 'tf'), ('/tf_static', 'tf_static')] - configured_params = RewrittenYaml( - source_file=params_file, - root_key=namespace, - param_rewrites={}, - convert_types=True) + configured_params = ParameterFile( + RewrittenYaml( + source_file=params_file, + root_key=namespace, + param_rewrites={}, + convert_types=True), + allow_substs=True) stdout_linebuf_envvar = SetEnvironmentVariable( 'RCUTILS_LOGGING_BUFFERED_STREAM', '1') diff --git a/nav2_bringup/launch/localization_launch.py b/nav2_bringup/launch/localization_launch.py index 91fd42b1eba..b3d1c81cebc 100644 --- a/nav2_bringup/launch/localization_launch.py +++ b/nav2_bringup/launch/localization_launch.py @@ -25,7 +25,7 @@ from launch.substitutions import LaunchConfiguration, PythonExpression from launch_ros.actions import LoadComposableNodes, SetParameter from launch_ros.actions import Node -from launch_ros.descriptions import ComposableNode +from launch_ros.descriptions import ComposableNode, ParameterFile from nav2_common.launch import RewrittenYaml @@ -55,11 +55,13 @@ def generate_launch_description(): remappings = [('/tf', 'tf'), ('/tf_static', 'tf_static')] - configured_params = RewrittenYaml( - source_file=params_file, - root_key=namespace, - param_rewrites={}, - convert_types=True) + configured_params = ParameterFile( + RewrittenYaml( + source_file=params_file, + root_key=namespace, + param_rewrites={}, + convert_types=True), + allow_substs=True) stdout_linebuf_envvar = SetEnvironmentVariable( 'RCUTILS_LOGGING_BUFFERED_STREAM', '1') diff --git a/nav2_bringup/launch/navigation_launch.py b/nav2_bringup/launch/navigation_launch.py index f4a67e4d6ed..f1f17c50e6f 100644 --- a/nav2_bringup/launch/navigation_launch.py +++ b/nav2_bringup/launch/navigation_launch.py @@ -22,7 +22,7 @@ from launch.substitutions import LaunchConfiguration, PythonExpression from launch_ros.actions import LoadComposableNodes, SetParameter from launch_ros.actions import Node -from launch_ros.descriptions import ComposableNode +from launch_ros.descriptions import ComposableNode, ParameterFile from nav2_common.launch import RewrittenYaml @@ -61,11 +61,13 @@ def generate_launch_description(): param_substitutions = { 'autostart': autostart} - configured_params = RewrittenYaml( - source_file=params_file, - root_key=namespace, - param_rewrites=param_substitutions, - convert_types=True) + configured_params = ParameterFile( + RewrittenYaml( + source_file=params_file, + root_key=namespace, + param_rewrites=param_substitutions, + convert_types=True), + allow_substs=True) stdout_linebuf_envvar = SetEnvironmentVariable( 'RCUTILS_LOGGING_BUFFERED_STREAM', '1') diff --git a/nav2_bringup/launch/slam_launch.py b/nav2_bringup/launch/slam_launch.py index 5bbbd43247e..abb3c13d623 100644 --- a/nav2_bringup/launch/slam_launch.py +++ b/nav2_bringup/launch/slam_launch.py @@ -22,6 +22,7 @@ from launch.launch_description_sources import PythonLaunchDescriptionSource from launch.substitutions import LaunchConfiguration from launch_ros.actions import Node, SetParameter +from launch_ros.descriptions import ParameterFile from nav2_common.launch import HasNodeParams, RewrittenYaml @@ -43,11 +44,13 @@ def generate_launch_description(): slam_launch_file = os.path.join(slam_toolbox_dir, 'launch', 'online_sync_launch.py') # Create our own temporary YAML files that include substitutions - configured_params = RewrittenYaml( - source_file=params_file, - root_key=namespace, - param_rewrites={}, - convert_types=True) + configured_params = ParameterFile( + RewrittenYaml( + source_file=params_file, + root_key=namespace, + param_rewrites={}, + convert_types=True), + allow_substs=True) # Declare the launch arguments declare_namespace_cmd = DeclareLaunchArgument( diff --git a/nav2_collision_monitor/launch/collision_monitor_node.launch.py b/nav2_collision_monitor/launch/collision_monitor_node.launch.py index 88116674584..3d0006ac855 100644 --- a/nav2_collision_monitor/launch/collision_monitor_node.launch.py +++ b/nav2_collision_monitor/launch/collision_monitor_node.launch.py @@ -26,7 +26,7 @@ from launch_ros.actions import LoadComposableNodes, SetParameter from launch_ros.actions import Node from launch_ros.actions import PushRosNamespace -from launch_ros.descriptions import ComposableNode +from launch_ros.descriptions import ComposableNode, ParameterFile from nav2_common.launch import RewrittenYaml @@ -73,11 +73,13 @@ def generate_launch_description(): 'container_name', default_value='nav2_container', description='the name of conatiner that nodes will load in if use composition') - configured_params = RewrittenYaml( - source_file=params_file, - root_key=namespace, - param_rewrites={}, - convert_types=True) + configured_params = ParameterFile( + RewrittenYaml( + source_file=params_file, + root_key=namespace, + param_rewrites={}, + convert_types=True), + allow_substs=True) # Declare node launching commands load_nodes = GroupAction(