In ROS1 there was the hasParam method.
In ROS2, there doesn't seem to be a way to check if a parameter exists directly without attempting to get the value of the parameter.
A) Is there a way to check if a parameter exists that I'm missing B) If not, why not?
Originally posted by David Lu on ROS Answers with karma: 10932 on 2018-10-29
Post score: 0
Original comments
Comment by William on 2018-10-29:
There's no reason I'm aware of that we don't have that function, probably just haven't needed it yet. I am also working on some improvements right now so that you can have read-only parameters. Part of that is an explicit declare step for parameters, which will make "exists" make more sense.
Comment by William on 2018-10-29:
Here's the pull request: https://github.com/ros2/rclcpp/pull/495, it was originally started by Shane, but I'm trying to resurrect it right now. Maybe I can add an "exists" or "has" or "is_declared" like function at the same time.
Comment by David Lu on 2018-10-30:
@william That's what I wanted to know. If you don't end up rolling it into that PR, please ping me and I'll try to make one.