Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 import rospy
00036
00037 from .param_editors import EditorWidget
00038 from .param_groups import GroupWidget
00039 from .param_updater import ParamUpdater
00040
00041
00042 class DynreconfClientWidget(GroupWidget):
00043 """
00044 A wrapper of dynamic_reconfigure.client instance.
00045 Represents a widget where users can view and modify ROS params.
00046 """
00047
00048 def __init__(self, reconf, node_name):
00049 """
00050 :type reconf: dynamic_reconfigure.client
00051 :type node_name: str
00052 """
00053
00054 group_desc = reconf.get_group_descriptions()
00055 rospy.logdebug('DynreconfClientWidget.group_desc=%s', group_desc)
00056 super(DynreconfClientWidget, self).__init__(ParamUpdater(reconf),
00057 group_desc, node_name)
00058
00059 self.setMinimumWidth(150)
00060
00061 self.reconf = reconf
00062 self.updater.start()
00063 self.reconf.config_callback = self.config_callback
00064 self._node_grn = node_name
00065
00066 def get_node_grn(self):
00067
00068 return self._node_grn
00069
00070 def config_callback(self, config):
00071
00072
00073
00074 if config:
00075
00076
00077 names = [name for name, v in config.items()]
00078
00079 rospy.logdebug('config_callback name={} v={}'.format(name, v))
00080
00081 for widget in self.editor_widgets:
00082 if isinstance(widget, EditorWidget):
00083 if widget.param_name in names:
00084 rospy.logdebug('EDITOR widget.param_name=%s',
00085 widget.param_name)
00086 widget.update_value(config[widget.param_name])
00087 elif isinstance(widget, GroupWidget):
00088 cfg = self.find_cfg(config, widget.param_name)
00089 rospy.logdebug('GROUP widget.param_name=%s',
00090 widget.param_name)
00091 widget.update_group(cfg)
00092
00093 def close(self):
00094 self.reconf.close()
00095 self.updater.stop()
00096
00097 for w in self.editor_widgets:
00098 w.close()
00099
00100 self.deleteLater()
00101
00102 def filter_param(self, filter_key):
00103
00104 pass