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

Do I always have to declare parameters?

asked 2019-06-17 02:45:13 -0500

xhuan28 gravatar image

declare_parameter() is a new API in dashing release. Per my understanding from parameter demos,

// Declare parameters that may be set on this node

we have to declare a parameter if we want to set this parameter in a node. But when I develop a node in which only get_parameter() function is invoked, but it seems that I still need to declare_parameter(). Do I always have to declare parameters whatever get or set parameters?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-06-17 11:33:32 -0500

sloretz gravatar image

By default yes you must declare parameters, but there is an option to opt out. To opt out, set allow_undeclared_parameters to true. Here is an example.

In many cases you know all the parameters that your node can use. In these cases you should use the default behavior and declare your parameters.

edit flag offensive delete link more

Comments also covers this. Also, the example you link to also sets the automatically_declare_parameters_from_overrides which is needed if you want the pre-Dashing behavior.

William gravatar image William  ( 2019-06-17 13:15:49 -0500 )edit

Thanks for your answers.@sloretz@William

xhuan28 gravatar image xhuan28  ( 2019-06-23 23:44:17 -0500 )edit

Question Tools



Asked: 2019-06-17 02:45:13 -0500

Seen: 2,318 times

Last updated: Jun 17 '19