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

How to reconfigure dynamically the parameters that aren't latched to particular nodes?

asked 2012-11-26 13:47:31 -0500

130s gravatar image

updated 2012-11-29 12:05:30 -0500

Parameters can be declared w/o being associated with any node (ref).

Looks like dynamic_reconfigure targets only those params that are associated with nodes (indeed I'm seeing on its GUI reconfigure_gui that the params w/o nodes are NOT shown. (eg. /base_controller/* on PR2)).

If I want to update those "independent" params as dynamic_reconfigure does to the dependent params, is there a way provided by ROS or what would be the best way to do so?

ps. I prefer to using rospy for implementing my stuff.


Edit) pps. I don't have to stick to dynamic_reconfigure for this purpose, although using it for handling node-related-params is my first option.


Edit-2) The features of dynamic_reconfigure @joq listed are not only nice but also sound critical, in addition to the fact that Parameter Server API isn't thread-safe. After hearing about getParamCached(), I now think about making a C++ node that gets & updates parameters and publish them as topic or else. But I'm still curious to hear another opinion.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
6

answered 2012-11-26 15:04:05 -0500

joq gravatar image

updated 2012-12-01 03:32:57 -0500

Dynamic reconfigure does not handle arbitrary parameters. It requires a ROS node to provide the required reconfigure server interface.

The easy solution is to define a node whose only job is to provide a dynamic reconfigure server for the common parameters. That can easily be done in Python.

In your example, that parameter node could be called base_controller.

EDIT:

Understanding your goals better now, I see that my initial answer does not meet your needs.

Dynamic reconfigure is a good tool for configuring a single node, it provides:

  • A callback to the node when any parameters change. All of them are supplied initially. There is no need to poll the parameter server periodically, which could easily load down the server.

  • Optional limits on parameter values, and a way to run sanity checks on parameter updates, rejecting changes considered invalid.

  • A simple automatically-generated GUI client for changing the parameters.

  • Keeping changed values up-to-date in the parameter server.

I don't see any reasonable way do all that for your use case. But perhaps you don't need all of it.

  • Assuming you want to notify more than one node when a parameter changes, you can use getParamCached() in C++ to periodically update each interested node's copy of a shared parameter without pounding the parameter server senseless.

  • Unfortunately, there is no similar function in rospy. If Python clients need access you'd have to provide a cached update service similar to that provided by roscpp. Not trivial, but generally useful.

  • If you want a GUI for updating the values, you'd probably need to write a custom implementation, which could be done quite well in Python. Take a look at rqt, which provides a nice Qt plugin interface. That interface might also validate parameter values, where appropriate.

Maybe others will provide some better ideas.

EDIT 2:

Your idea of publishing all the relevant parameters in a topic is easily done. Its main drawback is the effect on the modularity of your system.

Keeping knowledge of private parameters inside a single node makes it easy to reuse in a different context. So, I recommend keeping most parameters private.

That leaves a small number of truly "shared" parameters used by multiple nodes. I recommend grouping them into somewhat larger components, maybe per-stack, each with its own topic message. That way, other parts of the system would remain independent of changes to parameters they don't care about.

edit flag offensive delete link more

Comments

+1 for simplicity. I forgot to mention, though, that I'm thinking to build something more generic, which making parameter nodes as many as the sets of params might not fit.

130s gravatar image 130s  ( 2012-11-27 12:54:49 -0500 )edit

Your EDIT2 makes complete sense. I propose that it should be added to BPractice (btw, the feature in mind is to browse & edit all existing parameters. I'm actually realizing this feature as an rqt plugin. Related to http://goo.gl/sVI9n fyi)

130s gravatar image 130s  ( 2012-12-05 05:23:08 -0500 )edit

Question Tools

Stats

Asked: 2012-11-26 13:47:31 -0500

Seen: 2,943 times

Last updated: Dec 01 '12