# Set parameters in ROS2 using a yaml file without needing to build the package every time

I have been able to include a parameter.yaml file in my test.launch.py file. However if I modify the parameter.yaml file, I need to build the entire package again before seeing changes reflected when I rerun test.launch.py.

In ROS1 this was not an issue as we could just change our parameters config file and rerun roslaunch.

Is there a way to ensure we don't need to rebuild every time we modify the paramter.yaml file?

edit retag close merge delete

However if I modify the parameter.yaml file, I need to build the entire package again before seeing changes reflected when I rerun test.launch.py.

just to be clear: the "rebuild" is only needed to copy over the latest version of your .parameter.yaml. Not because the configuration is baked into the node.

Compare with pip when you have installed a locally developed package without -e.

( 2020-02-13 02:32:54 -0500 )edit

Sort by » oldest newest most voted

I need to build the entire package again before seeing changes reflected when I rerun test.launch.py.

Well, is your configuration file in your package? That would then be true with colcon build. You can also have your launch file reference a non-package non-install path if its a global configuration so you won't have that issue. Its looking for the version of the yaml file in the package's install path which will not be updated unless you build again. You can instead look for a global path /path/to/yaml.yaml and that way its not being updated or searching in the install space of the package itself. That may not be appropriate for your applications but that's an option.

Symlink install in colcon will help with this issue with python files, but it may be able to work here as well, but I'm not certain off hand.

more
colcon build --symlink-install


As Steve Macenski mentioned in the last line. The symlink option creates symlinks in the install directory instead of copying the files. As long as you dont add files to your project you dont have to keep colcon-building for py, urdf or yaml file changes.

more