Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ParameterFile (allow_substs) #3706

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions nav2_bringup/launch/bringup_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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')
Expand Down
14 changes: 8 additions & 6 deletions nav2_bringup/launch/localization_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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')
Expand Down
14 changes: 8 additions & 6 deletions nav2_bringup/launch/navigation_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally approve of this action, but don't you need to do this for all instances of RewrittenYaml, not just this one so it could be used for anywhere this kind of pattern may be useful?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

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')
Expand Down
13 changes: 8 additions & 5 deletions nav2_bringup/launch/slam_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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(
Expand Down
14 changes: 8 additions & 6 deletions nav2_collision_monitor/launch/collision_monitor_node.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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(
Expand Down