-
Notifications
You must be signed in to change notification settings - Fork 165
Description
Currently you can pass remapping arguments to Node as a dict, but to set parameters in a node from a launch file you need to pass a normal argument which points to an existing .yaml file.
To pass parameters via the launch file (without predefining them in an external .yaml file) will ultimately require the ability to pass parameters via the command line one at a time, which as of right now is not implemented yet.
In the meantime, individually specified parameters in a launch file for a node could be written into a temporary .yaml file by launch and then passed to the node, deleting the file after the node exits. However, I think this would step on a user specified parameter .yaml file unless the node can take more than one right now (it was discussed, but I don't know off-hand if it was implemented). In either case, if launch also lets you specify one or more .yaml files to be used as parameters (in addition to, and at the same time as, individually specified parameters for a node), then launch could just combine all of the yaml files and parameter kay-value pairs into a single .yaml file, cascading them in order (overwriting keys that appear more than once, with last wins).
It might look something like this:
launch_ros.actions.Node(...,
parameters=[
'/path/to/first_parameter_file.yaml',
launch_ros.actions.node.NodeParameters({
'foo': '1',
// can have substitutions
[LaunchConfiguration('ros_namespace'), '.my_node.executable_location']:
[ExecutableInPackage('my_node', 'my_package')],
...,
},
[PackageShareDir('my_package'), Dir('config') / 'my_config_file.yaml'],
],
)