Skip to content

Commit f6f87d2

Browse files
fix: add missing keepout and speed zone substitutions for non-composed nodes (#5357)
* fix: add missing keepout and speed zone substitutions for non-composed nodes Non-composed nodes were missing the yaml substitutions for keepout and speed zones that are present in the component container launch. This was causing parameter type errors when the substitution values weren't being replaced. Added: - use_keepout_zones and use_speed_zones launch arguments - yaml_substitutions dictionary with KEEPOUT_ZONE_ENABLED and SPEED_ZONE_ENABLED - value_rewrites parameter to RewrittenYaml to apply the substitutions Fixes #5356 Co-authored-by: Steve Macenski <SteveMacenski@users.noreply.github.com> * Update bringup_launch.py Signed-off-by: Steve Macenski <stevenmacenski@gmail.com> --------- Signed-off-by: Steve Macenski <stevenmacenski@gmail.com> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
1 parent 2a8619f commit f6f87d2

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

nav2_bringup/launch/bringup_launch.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ def generate_launch_description() -> LaunchDescription:
235235
'params_file': params_file,
236236
'use_composition': use_composition,
237237
'use_respawn': use_respawn,
238+
'use_keepout_zones': use_keepout_zones,
239+
'use_speed_zones': use_speed_zones,
238240
'container_name': 'nav2_container',
239241
}.items(),
240242
),

nav2_bringup/launch/navigation_launch.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ def generate_launch_description() -> LaunchDescription:
3838
container_name_full = (namespace, '/', container_name)
3939
use_respawn = LaunchConfigAsBool('use_respawn')
4040
log_level = LaunchConfiguration('log_level')
41+
use_keepout_zones = LaunchConfigAsBool('use_keepout_zones')
42+
use_speed_zones = LaunchConfigAsBool('use_speed_zones')
4143

4244
lifecycle_nodes = [
4345
'controller_server',
@@ -58,11 +60,17 @@ def generate_launch_description() -> LaunchDescription:
5860
# Create our own temporary YAML files that include substitutions
5961
param_substitutions = {'autostart': autostart}
6062

63+
yaml_substitutions = {
64+
'KEEPOUT_ZONE_ENABLED': use_keepout_zones,
65+
'SPEED_ZONE_ENABLED': use_speed_zones,
66+
}
67+
6168
configured_params = ParameterFile(
6269
RewrittenYaml(
6370
source_file=params_file,
6471
root_key=namespace,
6572
param_rewrites=param_substitutions,
73+
value_rewrites=yaml_substitutions,
6674
convert_types=True,
6775
),
6876
allow_substs=True,
@@ -121,6 +129,16 @@ def generate_launch_description() -> LaunchDescription:
121129
'log_level', default_value='info', description='log level'
122130
)
123131

132+
declare_use_keepout_zones_cmd = DeclareLaunchArgument(
133+
'use_keepout_zones', default_value='True',
134+
description='Whether to enable keepout zones or not'
135+
)
136+
137+
declare_use_speed_zones_cmd = DeclareLaunchArgument(
138+
'use_speed_zones', default_value='True',
139+
description='Whether to enable speed zones or not'
140+
)
141+
124142
load_nodes = GroupAction(
125143
condition=IfCondition(PythonExpression(['not ', use_composition])),
126144
actions=[
@@ -351,6 +369,8 @@ def generate_launch_description() -> LaunchDescription:
351369
ld.add_action(declare_container_name_cmd)
352370
ld.add_action(declare_use_respawn_cmd)
353371
ld.add_action(declare_log_level_cmd)
372+
ld.add_action(declare_use_keepout_zones_cmd)
373+
ld.add_action(declare_use_speed_zones_cmd)
354374
# Add the actions to launch all of the navigation nodes
355375
ld.add_action(load_nodes)
356376
ld.add_action(load_composable_nodes)

0 commit comments

Comments
 (0)