Robotics StackExchange | Archived questions

Dynamic reconfigure vs Rosparam get.

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

Asked by Aviad on 2021-03-01 12:32:46 UTC

Comments

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.

Asked by gvdhoorn on 2021-03-01 12:45:33 UTC

Answers

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.

Asked by tryan on 2021-03-01 18:04:29 UTC

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?

Asked by OzzieTheHead on 2021-12-16 13:15:43 UTC

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."

Asked by tryan on 2021-12-16 17:46:24 UTC

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

Asked by OzzieTheHead on 2021-12-16 21:50:46 UTC