The decode_config fails for group data.
Can be reproduced by either:
create a cfg that contains groups, then open rqt_reconfigure and save and reload the configuration.
or: create a group with the attribute: type="collapse". Then open rqt_reconfigure and toggle the checkbox for that group.
in both cases the dynamic_reconfigure server fails this way:
[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"]
I am not sure if it is the client side or server side who is wrong but the issue seems to be that the descr[\'groups\'] sometimes is a dict of dicts and sometimes a list of dicts, when iterated here
This change seems to solve the problem, but I don't think this is the right solution.
for _n, g in group['groups'].items():
- for _nr, dr in descr['groups'].items():
+ # descr['groups'] is sometimes
+ # - a list of dicts
+ # - a dict of dicts
+ groups = descr['groups']
+ if isinstance(descr['groups'], dict):
+ groups = descr['groups'].values()
+
+ for dr in groups:
if dr['name'] == g['name']:
add_params(g, dr)
I will be happy to provide a pull request if someone can guide me on the expected encoding
Ahh we just ran into the same issue while implementing a reconfigure-client that tries to reconfigure a config including groups.
But this still seems to be an issue present day?
The decode_config fails for group data. Can be reproduced by either:
in both cases the dynamic_reconfigure server fails this way:
I am not sure if it is the client side or server side who is wrong but the issue seems to be that the descr[\'groups\'] sometimes is a dict of dicts and sometimes a list of dicts, when iterated here
This change seems to solve the problem, but I don't think this is the right solution.
I will be happy to provide a pull request if someone can guide me on the expected encoding