Declare_parameter in Dashing

I will point out that there is a difference between get_parameter and declare_parameter in the case (I think) you are describing. In a world where you only have get_parameter, then you either get the value or you don’t, but the parameter is not “visible” on the node in the latter scenario. That is, something like ros2 param list doesn’t show anything, and there is no external indication that a parameter is available to be set. Using declare_parameter, on the other hand, ensures that the parameter is always “visible”, even if it’s value is NOT_SET. I find that to be a highly desirable property of parameters.

2 Likes