Ask Your Question

Revision history [back]

I should see the parameters defined in that file listed when I run ros2 param list, correct?

Not necessarily. ROS 2 parameters machinery is slightly different from ROS 1 and in your case I guess that the main difference that you have to be aware of is that parameters have to de 'declared'. See for instance the list_parameters.cpp demo, or e.g.


Without this bit, the foo parameter from your yaml file will not be loaded and that's probably your issue at the moment. It is still parsed, as you verified yourself, but still not loaded as you'd expect.

If it happened that you can't know all of the parameters beforehand, then you can pass a particular config when instantiating your node so that it allow_undeclared_parameters. See an example at the parameter_blackboard.cpp demo.

Notice that the same functionality exists in Python (rclpy) too.

I'm also a little confused on the expected node name within the parameters file
Does it need to match exactly the node name I provide

Yes, the node name in the yaml file should match the name of your node, e.g. "parameter_blackboard" in the parameter_blackboard.cpp demo.