Ask Your Question

Using groups with dynamic_reconfigure, rqt_reconfigure

asked 2018-05-23 08:35:57 -0500

knxa gravatar image

Reading about and playing around the almost secret concept of using "groups" with dynamic_reconfigure.

I have the following questions:

  1. What is the group "state" attribute used for? rqt_reconfigure plugin does not seem to do anything with it.
  2. rqt_reconfigure has classes called CollapseGroup, TabGroup, etc.... Can I use "groups" in a way so that they can appear tabbed, collapsed, hidden etc...?
  3. Save/reload yaml from rqt_configure works fine, except when the configuration contains groups. Then the loading generates an error on the server side:

[ERROR] [1527081248.063225] [/dynamic_tutorials]: Error processing request: 'list' object has no attribute 'items' ['Traceback (most recent call last):\n', ' File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/",line 625, in _handle_request\n response = convert_return_to_response(self.handler(request), self.response_class)\n', ' File "/opt/ros/kinetic/lib/python2.7/dist-packages/dynamic_reconfigure/", line 135, in _set_callback\n return encode_config(self.update_configuration(decode_config(req.config, self.type.config_description)))\n', ' File "/opt/ros/kinetic/lib/python2.7/dist-packages/dynamic_reconfigure/", line 312, in decode_config\n
add_params(d[\'groups\'], description)\n', ' File "/opt/ros/kinetic/lib/python2.7/dist-packages/dynamic_reconfigure/", line 308, in add_params\n for nr, dr in descr[\'groups\'].items():\n', "AttributeError: 'list' object has no attribute 'items'\n"]

My cfg looks like:

#!/usr/bin/env python
PACKAGE = "dynamic_tutorials"

from dynamic_reconfigure.parameter_generator_catkin import *
gen = ParameterGenerator()

gen.add("my_int_param",    int_t,    0, "An Integer parameter", 50,  0, 100)
gen.add("my_bool_param",   bool_t,   0, "A Boolean parameter",  True)

mygroup = gen.add_group("MyGroup")
mygroup.add("my_double_param", double_t, 0, "Some double param", 100,  0, 200)

exit(gen.generate(PACKAGE, "dynamic_tutorials", "Tutorials"))
edit retag flag offensive close merge delete


I'm getting the same error though only when the dynamic reconfigure server is a rospy one, an identical cfg with C++ server works fine ( ). My Reconfigure client (C++ ) must be doing something wrong/unexpected with the request, but it isn't clear what.

lucasw gravatar image lucasw  ( 2019-04-21 21:32:31 -0500 )edit

I changed the dynamic reconfigure request to only have one value in it (before it was resetting all the values when only one had changed), and the error went away. It seems like a rospy dynamic reconfigure server bug.

lucasw gravatar image lucasw  ( 2019-04-22 21:45:09 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-05-25 02:21:03 -0500

knxa gravatar image

Answering my own question:

The server configuration can indicate how a group should be presented in a GUI by setting the "type" attribute. For example:

mygroup = gen.add_group("MyGroup", type="tab")

Other type values are 'hide', 'collapse', 'apply'. The rqt_reconfigure actually obeys the 'type' indication.

The state attribute has effect only for the 'hide' and 'collapse' types. The server may in the callback change the 'state' attribute to hide/collapse a group in the rqt_reconfigure, example:

def callback(config, level):
    # example: change visibility state of group
    config.groups.groups.MyGroup.state = False

I have no solution on the exception generated by load/reload and the same problem is actually seen when toggling the checkbox for a group with type 'collapse'. I have filed a bug report.

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: 2018-05-23 08:35:57 -0500

Seen: 863 times

Last updated: May 25 '18