ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

dynamic_reconfigure with programatically filled enum?

asked 2015-11-04 11:59:02 -0500

peci1 gravatar image

updated 2019-11-19 03:50:58 -0500

Hey ROS gurus. I want to ask you for your opinions to a topic I recently thought about.

I'm writing a ROS&Python driver for a series of web cameras. There is a lot of variability in the specific models, including supported image resolutions.

Now I want to offer a dynamic_reconfigure interface for setting (not only) video resolution. My basic thought was to filter a list of possible resolutions somehow to only publish the supported resolutions on parameter_descriptions (thus displaying only them in rqt_reconfigure).

But then I found out that even the set of possible resolutions is not bound and new resolutions may emerge with new camera models.

I have 2 ideas on what to do with that:

  • alter dynamic_reconfigure and create another edit_method (that's lot of work, though)
  • create my own implementation of dynamic_reconfigure.Server, which would read the allowed resolutions from somewhere and would publish the corresponding parameter_descriptions. In the cfg file I would probably create a dummy one-element enum in order not to stop existing tools from working.

I'm only concerned about this solution working from dynamic_reconfigure CLI, rqt_reconfigure and Python (ideally using the standard Client). I don't (yet) care about C++ clients.

Before I start working, could you please give me some feedback on how you like these ideas and what possible shortcomings do you see?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-11-04 19:59:55 -0500

peci1 gravatar image

Ok, found an even easier way: directly changing the config_description attribute of the dynamic reconfigurable type before creating the server. The server then reads the changed enum description and correctly advertises the desired set of possible values.

I'm not sure about how it works with C++ clients, but both rqt_reconfigure and dynparam CLI work without problems for getting and setting parameter values. And since dynparam is a Python script, I assume the Python client has also no problems.

Here's a simple implementation (not considering parameter groups):

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2015-11-04 11:59:02 -0500

Seen: 827 times

Last updated: Nov 19 '19