Skip to content

Commit afdb8c1

Browse files
ymd-stellaenricosutera
authored andcommitted
Use ParameterFile (allow_substs) (ros-navigation#3706)
Signed-off-by: ymd-stella <[email protected]> Signed-off-by: enricosutera <[email protected]>
1 parent a774e13 commit afdb8c1

File tree

5 files changed

+40
-28
lines changed

5 files changed

+40
-28
lines changed

nav2_bringup/launch/bringup_launch.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from launch.substitutions import LaunchConfiguration, PythonExpression
2525
from launch_ros.actions import Node
2626
from launch_ros.actions import PushRosNamespace
27+
from launch_ros.descriptions import ParameterFile
2728
from nav2_common.launch import RewrittenYaml
2829

2930

@@ -53,11 +54,13 @@ def generate_launch_description():
5354
remappings = [('/tf', 'tf'),
5455
('/tf_static', 'tf_static')]
5556

56-
configured_params = RewrittenYaml(
57-
source_file=params_file,
58-
root_key=namespace,
59-
param_rewrites={},
60-
convert_types=True)
57+
configured_params = ParameterFile(
58+
RewrittenYaml(
59+
source_file=params_file,
60+
root_key=namespace,
61+
param_rewrites={},
62+
convert_types=True),
63+
allow_substs=True)
6164

6265
stdout_linebuf_envvar = SetEnvironmentVariable(
6366
'RCUTILS_LOGGING_BUFFERED_STREAM', '1')

nav2_bringup/launch/localization_launch.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from launch.substitutions import LaunchConfiguration, PythonExpression
2626
from launch_ros.actions import LoadComposableNodes, SetParameter
2727
from launch_ros.actions import Node
28-
from launch_ros.descriptions import ComposableNode
28+
from launch_ros.descriptions import ComposableNode, ParameterFile
2929
from nav2_common.launch import RewrittenYaml
3030

3131

@@ -55,11 +55,13 @@ def generate_launch_description():
5555
remappings = [('/tf', 'tf'),
5656
('/tf_static', 'tf_static')]
5757

58-
configured_params = RewrittenYaml(
59-
source_file=params_file,
60-
root_key=namespace,
61-
param_rewrites={},
62-
convert_types=True)
58+
configured_params = ParameterFile(
59+
RewrittenYaml(
60+
source_file=params_file,
61+
root_key=namespace,
62+
param_rewrites={},
63+
convert_types=True),
64+
allow_substs=True)
6365

6466
stdout_linebuf_envvar = SetEnvironmentVariable(
6567
'RCUTILS_LOGGING_BUFFERED_STREAM', '1')

nav2_bringup/launch/navigation_launch.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from launch.substitutions import LaunchConfiguration, PythonExpression
2323
from launch_ros.actions import LoadComposableNodes, SetParameter
2424
from launch_ros.actions import Node
25-
from launch_ros.descriptions import ComposableNode
25+
from launch_ros.descriptions import ComposableNode, ParameterFile
2626
from nav2_common.launch import RewrittenYaml
2727

2828

@@ -61,11 +61,13 @@ def generate_launch_description():
6161
param_substitutions = {
6262
'autostart': autostart}
6363

64-
configured_params = RewrittenYaml(
65-
source_file=params_file,
66-
root_key=namespace,
67-
param_rewrites=param_substitutions,
68-
convert_types=True)
64+
configured_params = ParameterFile(
65+
RewrittenYaml(
66+
source_file=params_file,
67+
root_key=namespace,
68+
param_rewrites=param_substitutions,
69+
convert_types=True),
70+
allow_substs=True)
6971

7072
stdout_linebuf_envvar = SetEnvironmentVariable(
7173
'RCUTILS_LOGGING_BUFFERED_STREAM', '1')

nav2_bringup/launch/slam_launch.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from launch.launch_description_sources import PythonLaunchDescriptionSource
2323
from launch.substitutions import LaunchConfiguration
2424
from launch_ros.actions import Node, SetParameter
25+
from launch_ros.descriptions import ParameterFile
2526
from nav2_common.launch import HasNodeParams, RewrittenYaml
2627

2728

@@ -43,11 +44,13 @@ def generate_launch_description():
4344
slam_launch_file = os.path.join(slam_toolbox_dir, 'launch', 'online_sync_launch.py')
4445

4546
# Create our own temporary YAML files that include substitutions
46-
configured_params = RewrittenYaml(
47-
source_file=params_file,
48-
root_key=namespace,
49-
param_rewrites={},
50-
convert_types=True)
47+
configured_params = ParameterFile(
48+
RewrittenYaml(
49+
source_file=params_file,
50+
root_key=namespace,
51+
param_rewrites={},
52+
convert_types=True),
53+
allow_substs=True)
5154

5255
# Declare the launch arguments
5356
declare_namespace_cmd = DeclareLaunchArgument(

nav2_collision_monitor/launch/collision_monitor_node.launch.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from launch_ros.actions import LoadComposableNodes, SetParameter
2727
from launch_ros.actions import Node
2828
from launch_ros.actions import PushRosNamespace
29-
from launch_ros.descriptions import ComposableNode
29+
from launch_ros.descriptions import ComposableNode, ParameterFile
3030
from nav2_common.launch import RewrittenYaml
3131

3232

@@ -73,11 +73,13 @@ def generate_launch_description():
7373
'container_name', default_value='nav2_container',
7474
description='the name of conatiner that nodes will load in if use composition')
7575

76-
configured_params = RewrittenYaml(
77-
source_file=params_file,
78-
root_key=namespace,
79-
param_rewrites={},
80-
convert_types=True)
76+
configured_params = ParameterFile(
77+
RewrittenYaml(
78+
source_file=params_file,
79+
root_key=namespace,
80+
param_rewrites={},
81+
convert_types=True),
82+
allow_substs=True)
8183

8284
# Declare node launching commands
8385
load_nodes = GroupAction(

0 commit comments

Comments
 (0)