ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Check whether parameter is set or not for a ros 2 node

asked 2018-04-30 03:36:47 -0500

Skyking gravatar image

updated 2018-04-30 06:02:52 -0500

In ROS 2 RCLCPP, is there any way to be sure whether a parameter is set or not for a paricular node ? In ROS 1 , the getParam() function used to do this check.

I found the method SyncParametersClient::has_parameter(const std::string & parameter_name) inside the parameter_client.hpp code inside rclcpp. Can this ported for AsyncParameters too ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-04-30 15:33:54 -0500

William gravatar image

As you already pointed out there is has_parameter on the Synchronous Client. It could be added to the Async Client as well, but we just haven't done that yet. Also it could be added to the local node parameter API (you don't need a parameter client to get and set parameters on the local node), but in all cases the implementation is basically "list parameters and ensure the one you're asking about is there", see:

edit flag offensive delete link more

Question Tools



Asked: 2018-04-30 03:36:47 -0500

Seen: 898 times

Last updated: Apr 30 '18