As we have the config file in place already, anyway, we can also use the parameters.
There are a couple of things I don't like about this implementation:
Parsing the yaml file manually seems awkward to me. However, as far as I understood, passing parameter files to nodes only supports yaml files following a certain syntax, which the initial_positions.yaml is not. (See possible workaround 1)
I could not manage to make the actual filename configurable as using a LaunchConfiguration object. But that might just be me being stupid.
Possible workaround 1: Include separate file
With defining a separate file with content
As we have the config file in place already, anyway, we can also use the parameters.
There are a couple of things I don't like about this implementation:
initial_positions.yaml
is not. (See possible workaround 1)LaunchConfiguration
object. But that might just be me being stupid.Possible workaround 1: Include separate file With defining a separate file with content
we could pass that file to the node directly. However, this would be config duplication.
As I couldn't come up with a better solution, I postet a question on ROS answers: https://answers.ros.org/question/396653/ros2-python-launchfile-load-parametersyaml-into-nodes-parameter/