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

Difference between using dynamic_reconfigure and using getParam at runtime

asked 2012-08-30 15:47:56 -0500

weiin gravatar image

updated 2012-09-07 07:16:07 -0500

130s gravatar image

I am trying to understand the benefits of the dynamic reconfigure package. From the tutorials, it seems like it creates a new server to handle a fixed number of changing parameters.

What is the benefit of this (having a separate server) as opposed to using a getParam call in my code before using the parameter?

For example if I have a parameter "publish_laser". In my node that publishes laser scans, I have a line that calls getParam("publish_laser") that retrieves the value from the parameter server, before deciding whether to publish the scan. Does using dynamic_reconfigure in this case make things run faster or show any performance benefits?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
6

answered 2012-08-30 15:55:04 -0500

dynamic reconfigure and the parameter server (which getParam uses) are designed to solve different problems. The parameter server is useful for situations where you know the value of parameters before a node starts, and know that those parameters will never change. Dynamic reconfigure is for situations where you might not know the values of parameters before a node starts, or those parameters might change while a node is running. Dynamic reconfigure require a little extra development effort in creating the cfg file where all the parameters and their types are declared, and requires a callback in the reconfigurable node which is called when the configuration changes.

The choice between using the parameter server and dynamic reconfigure does not have to do with performance, it has to do with whether or not parameters will change while a node is running. Dynamic reconfigure may impose a slight performance penalty since it will need an extra thread for its callback, but it's probably not significant.

edit flag offensive delete link more

Comments

So why not use a dummy value for the parameter before runtime, and then during runtime use setParam? Calling setParam (and getParam) multiple times during runtime can achieve the same effect of dynamic_reconfigure, right?

weiin gravatar image weiin  ( 2012-08-30 17:00:22 -0500 )edit

In other words, is there any reason why the parameter server cannot handle "dynamic parameters"?

weiin gravatar image weiin  ( 2012-08-30 17:00:44 -0500 )edit
3

You can of course set the parameter later on the parameter server, too. But there is no built-in mechanism to notify a node that its parameters changed. Reading parameters whenever they are needed is not a good solution either because this is a very expensive operation on slow networks or high load.

Lorenz gravatar image Lorenz  ( 2012-08-31 00:58:24 -0500 )edit
1

Question Tools

3 followers

Stats

Asked: 2012-08-30 15:47:56 -0500

Seen: 2,021 times

Last updated: Aug 30 '12