Rosanswers logo

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/tcpros_service.py",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/server.py", 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/encoding.py", line 312, in decode_config\n
add_params(d['groups'], description)\n', ' File "/opt/ros/kinetic/lib/python2.7/dist-packages/dynamic_reconfigure/encoding.py", 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"))

Originally posted by knxa on ROS Answers with karma: 811 on 2018-05-23

Post score: 2

Original comments

Comment by lucasw on 2019-04-21:
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 (https://github.com/lucasw/dynamic_reconfigure_tools/tree/master/dynamic_reconfigure_example). My Reconfigure client (C++ ) must be doing something wrong/unexpected with the request, but it isn't clear what. https://github.com/lucasw/imgui_ros/issues/9

Comment by lucasw on 2019-04-22:
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.


1 Answer 1


Rosanswers logo

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.

Originally posted by knxa with karma: 811 on 2018-05-25

This answer was ACCEPTED on the original site

Post score: 1


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.