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

Dynamic reconfigure vs Rosparam get.

asked 2021-03-01 11:32:46 -0600

Aviad gravatar image

Hello people,

I wanna know what are the advantages and the disadvantages regardless to CPU usage / Memory between using the Dynamic reconfigure tool to simply use the rosparam::get function inside my loop.

Thanks, Aviad

edit retag flag offensive close merge delete

Comments

1

I don't believe dynamic_reconfigure was created to deal with resource utilisation issues.

dynamic_reconfigure is an asynchronous callback based system, in which your nodes are notified parameters have changed.

ros::param::get(..) needs to be called by your code, periodically. There is no way for it to be notified of anything, so your node will be unaware anything has changed, unless it explicitly calls ros::param::get(..).

This is a fundamentally different control flow, and that's the big difference between the two.


Edit: repeatedly calling ros::param::get(..) is actually an anti-pattern (as there is a rather significant overhead incurred when retrieving parameters) and should be avoided.

From that perspective there is a difference in resource utilisation, but it would depend on how the developer has structured his node.

gvdhoorn gravatar image gvdhoorn  ( 2021-03-01 11:45:33 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-03-01 17:04:29 -0600

tryan gravatar image

To add to what @gvdhoorn said, ros::param::get() is generally intended for retrieving a parameter that doesn't often (if ever) change, but dynamic_reconfigure is intended to keep dependent nodes updated when a parameter may change more often. The first method is often used when initializing a node that depends on some runtime constants. The second is better suited to (re)configuring a driver node or tuning navigation parameters for example. Going further, if your parameter changes very frequently, a topic or other mechanism may be better than either of the previous two methods.

edit flag offensive delete link more

Comments

You said dependant nodes but I have hardly seen any examples that configure params between the nodes (or used by several nodes and notify them). Isn't dynamic_reconfigure intended to configure a single node?

OzzieTheHead gravatar image OzzieTheHead  ( 2021-12-16 12:15:43 -0600 )edit

Yes, one node (with the server) is configured, but any node with a client will receive notice of the changes. Perhaps "keep dependent nodes updated" is better phrased as "keep client nodes notified."

tryan gravatar image tryan  ( 2021-12-16 16:46:24 -0600 )edit

Thanks! The client's role and rqt_reconfigure being a client should be better emphasized in the documentation, I think

OzzieTheHead gravatar image OzzieTheHead  ( 2021-12-16 20:50:46 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2021-03-01 11:32:46 -0600

Seen: 683 times

Last updated: Mar 01 '21