35 from __future__
import division
40 import dynamic_reconfigure.client
42 from python_qt_binding.QtCore
import Qt
43 from python_qt_binding.QtGui
import QBrush, QStandardItem
45 from rospy.exceptions
import ROSException
49 from rqt_reconfigure
import logging
56 super(ParamserverConnectThread, self).
__init__()
63 param_client = dynamic_reconfigure.client.Client(
66 'ParamserverConnectThread param_client={}'.format(
69 self.
_parent.set_param_client(param_client)
70 except ROSException
as e:
72 e.message +
"TreenodeQstdItem. Couldn't connect to {}".format(
79 Extending ReadonlyItem - the display content of this item shouldn't be
87 :param args[0]: str (will become 1st arg of QStandardItem)
88 :param args[1]: integer value that indicates whether this class
89 is node that has GRN (Graph Resource Names, see
90 http://www.ros.org/wiki/Names). This can be None
92 grn_current_treenode = args[0]
95 super(TreenodeQstdItem, self).
__init__(grn_current_treenode)
111 logging.error(
'TreenodeQstdItem IndexError')
115 @param param_client: dynamic_reconfigure.client.Client
118 logging.debug(
'Qitem set param_client={} param={}'.format(
130 @rtype: ParamClientWidget (QWidget)
131 @return: None if param_client is not yet generated.
135 logging.debug(
'get param_client={}'.format(
138 logging.debug(
'In get_param_client_widget 1')
141 logging.debug(
'In get_param_client_widget 2')
151 self.setEnabled(
False)
152 raise ROSException(
'param client failed')
156 logging.debug(
'In get_param_client_widget loop#{}'.format(loop))
158 logging.debug(
'In get_param_client_widget 4')
170 logging.debug(
'In get_param_client_widget 5')
181 Connect to parameter server using dynamic_reconfigure client.
182 Behavior is delegated to a private method _connect_param_server, and
183 its return value, client, is set to member variable.
191 logging.error(
'connect_param_server failed due to missing '
192 'ROS Node. Return with nothing.')
215 Create QStdItem per parameter and addColumn them to myself.
216 :rtype: None if _param_client is not initiated.
221 param_names_items = []
222 brush = QBrush(Qt.lightGray)
223 for param_name
in param_names:
225 item.setBackground(brush)
226 param_names_items.append(item)
227 logging.debug(
'enable_param_items len of param_names={}'.format(
228 len(param_names_items)
230 self.appendColumn(param_names_items)
234 :param param_name: A string formatted as GRN (Graph Resource Names, see
235 http://www.ros.org/wiki/Names).
236 Example: /paramname/subpara/subsubpara/...
238 logging.debug(
'_set_param_name param_name={} '.format(param_name))
248 logging.debug(
'param_name={} node_name={} _list_params[-1]={}'.format(
255 :rtype: String of the top level param name.
257 return self._name_top
264 :rtype: List of string. Null if param
271 :return: A value of single tree node (ie. NOT the fullpath node name).
272 Ex. suppose fullpath name is /top/sub/subsub/subsubsub and you
273 are at 2nd from top, the return value is subsub.
278 return QStandardItem.UserType