-
Notifications
You must be signed in to change notification settings - Fork 159
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
I very love use ParameterFile to perform substitutions $(find-pkg-share ...) in config files. Like this
# Get launch arg
raw_config_file = LaunchConfiguration('config')
# Substitude `$find-pkg-share` in file
config_file = ParameterFile(
raw_config_file,
allow_substs=True,
)Why can I pass an ParameterFile to a Node, but can't to a LaunchConfiguration?
#-------------velodyne_driver_node------------
velodyne_driver_node = launch_ros.actions.Node(package='velodyne_driver',
executable='velodyne_driver_node',
output='both',
parameters=[config_file])Don't work:
slam_toolbox_lch = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
PathJoinSubstitution([
slam_toolbox_dir,
'launch/localization_launch.py',
])
),
launch_arguments={'use_sim_time': 'false',
'slam_params_file': config_file # here config_file is ParameterFile()
}.items(),
)I get this error:
[DEBUG] [launch]: Traceback (most recent call last):
File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 336, in run_async
raise completed_tasks_exceptions[0]
File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 230, in _process_one_event
await self.__process_event(next_event)
File "/opt/ros/humble/lib/python3.10/site-packages/launch/launch_service.py", line 250, in __process_event
visit_all_entities_and_collect_futures(entity, self.__context))
File "/opt/ros/humble/lib/python3.10/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
File "/opt/ros/humble/lib/python3.10/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
File "/opt/ros/humble/lib/python3.10/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 45, in visit_all_entities_and_collect_futures
futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
[Previous line repeated 2 more times]
File "/opt/ros/humble/lib/python3.10/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py", line 38, in visit_all_entities_and_collect_futures
sub_entities = entity.visit(context)
File "/opt/ros/humble/lib/python3.10/site-packages/launch/action.py", line 108, in visit
return self.execute(context)
File "/opt/ros/humble/lib/python3.10/site-packages/launch/actions/include_launch_description.py", line 182, in execute
set_launch_configuration_actions.append(SetLaunchConfiguration(name, value))
File "/opt/ros/humble/lib/python3.10/site-packages/launch/actions/set_launch_configuration.py", line 49, in __init__
self.__value = normalize_to_list_of_substitutions(value)
File "/opt/ros/humble/lib/python3.10/site-packages/launch/utilities/normalize_to_list_of_substitutions_impl.py", line 44, in normalize_to_list_of_substitutions
return [normalize(y) for y in cast(Iterable, subs)]
TypeError: 'ParameterFile' object is not iterableI understand that this is not a bug, but just IncludeLaunchDescription(launch_arguments=) and Node(parameters=) accept different types of data. And my question is whether it is possible in the future to make ParameterFile to be accepted both there and there?
Motivation
This would be very convenient and would look much simpler than using OpaqueFunction and context.
Design / Implementation Considerations
No response
Additional Information
This is my first issue, don't judge me harshly. I would appreciate recommendations and advice.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request