class ParamPlugin(Plugin): def __init__(self, context): """ :type context: qt_gui.PluginContext """ super(ParamPlugin, self).__init__(context) self.setObjectName('Dynamic Reconfigure') self._plugin_widget = ParamWidget(context) self._widget = PluginContainerWidget(self._plugin_widget, True, False) if context.serial_number() > 1: self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number())) context.add_widget(self._widget) def shutdown_plugin(self): self._widget.shutdown() def save_settings(self, plugin_settings, instance_settings): self._widget.save_settings(plugin_settings, instance_settings) def restore_settings(self, plugin_settings, instance_settings): self._widget.restore_settings(plugin_settings, instance_settings) @staticmethod def add_arguments(parser): group = parser.add_argument_group('Options for rqt_reconfigure plugin') group.add_argument('node_name', nargs='*', default=[], help='Node(s) to open automatically')
class MoveitPlugin(Plugin): def __init__(self, plugin_context): super(MoveitPlugin, self).__init__(plugin_context) self._plugin_context = plugin_context self._moveit_widget = MoveitWidget(self, plugin_context) self.mainwidget = PluginContainerWidget(self._moveit_widget, True, False) if self._plugin_context.serial_number() > 1: self.mainwidget.setWindowTitle(self.mainwidget.windowTitle() + (' (%d)' % plugin_context.serial_number())) plugin_context.add_widget(self.mainwidget) def get_widget(self): return self.mainwidget def shutdown_plugin(self): self.mainwidget.shutdown() def save_settings(self, plugin_settings, instance_settings): self.mainwidget.save_settings(plugin_settings, instance_settings) def restore_settings(self, plugin_settings, instance_settings): self.mainwidget.restore_settings(plugin_settings, instance_settings) def _update_msg(self): """ Update necessary components (per topic) regularly """ self._moveit_widget.update_topic_table()
class ParamPlugin(Plugin): def __init__(self, context): """ :type context: qt_gui.PluginContext """ super(ParamPlugin, self).__init__(context) self.setObjectName('Dynamic Reconfigure') self._plugin_widget = ParamWidget(context) self._widget = PluginContainerWidget(self._plugin_widget, True, False) if context.serial_number() > 1: self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number())) context.add_widget(self._widget) def shutdown_plugin(self): self._widget.shutdown() def save_settings(self, plugin_settings, instance_settings): self._widget.save_settings(plugin_settings, instance_settings) def restore_settings(self, plugin_settings, instance_settings): self._widget.restore_settings(plugin_settings, instance_settings)
class LaunchMain(object): def __init__(self, plugin_context): super(LaunchMain, self).__init__() self._plugin_context = plugin_context self._run_id = None self._node_controllers = [] self._main_launch_widget = LaunchWidget(self) self._mainwidget = PluginContainerWidget(self._main_launch_widget, True, False) # RqtRoscommUtil.load_parameters(self._config, '/rqt_launch') def get_widget(self): return self._mainwidget def set_node_controllers(self, node_controllers): self._node_controllers = node_controllers def load_params(self): self._main_launch_widget.load_parameters() def start_all(self): """ Checks nodes that's set (via self.set_node_controllers) one by one and starts one if each node is not running. Then disable START ALL button and enable STOP ALL button. """ for n in self._node_controllers: if not n.is_node_running(): n.start(restart=False) def stop_all(self): """ Checks nodes that's set (via self.set_node_controllers) one by one and stops one if each node is running. Then enable START ALL button and disable STOP ALL button. """ for n in self._node_controllers: if n.is_node_running(): n.stop() def check_process_statuses(self): for n in self._node_controllers: n.check_process_status() def shutdown(self): rospy.logdebug('Launchmain.shutdown') self.stop_all() def save_settings(self, plugin_settings, instance_settings): self._mainwidget.save_settings(plugin_settings, instance_settings) def restore_settings(self, plugin_settings, instance_settings): self._mainwidget.restore_settings(plugin_settings, instance_settings)
class LaunchMain(object): def __init__(self, plugin_context): super(LaunchMain, self).__init__() self._plugin_context = plugin_context _main_launch_widget = LaunchWidget(self) self._mainwidget = PluginContainerWidget(_main_launch_widget, True, False) self._run_id = None self._node_controllers = [] #RqtRoscommUtil.load_parameters(self._config, '/rqt_launch') def get_widget(self): return self._mainwidget def set_node_controllers(self, node_controllers): self._node_controllers = node_controllers def start_all(self): rospy.loginfo("Starting all nodes") for n in self._node_controllers: n.start(restart=False) def stop_all(self): for n in self._node_controllers: n.stop() def check_process_statuses(self): for n in self._node_controllers: n.check_process_status() def shutdown(self): rospy.logdebug('Launchmain.shutdown') self.stop_all() def save_settings(self, plugin_settings, instance_settings): self._mainwidget.save_settings(plugin_settings, instance_settings) def restore_settings(self, plugin_settings, instance_settings): self._mainwidget.restore_settings(plugin_settings, instance_settings)
class LaunchMain(object): def __init__(self, plugin_context): super(LaunchMain, self).__init__() self._plugin_context = plugin_context self._main_launch_widget = LaunchWidget(self) self._mainwidget = PluginContainerWidget(self._main_launch_widget, True, False) self._run_id = None self._node_controllers = [] #RqtRoscommUtil.load_parameters(self._config, '/rqt_launch') def get_widget(self): return self._mainwidget def set_node_controllers(self, node_controllers): self._node_controllers = node_controllers def start_all(self): ''' Checks nodes that's set (via self.set_node_controllers) one by one and starts one if each node is not running. Then disable START ALL button and enable STOP ALL button. ''' for n in self._node_controllers: if not n.is_node_running(): n.start(restart=False) # Disable START ALL button. self._main_launch_widget._pushbutton_start_all.setEnabled(False) self._main_launch_widget._pushbutton_stop_all.setEnabled(True) def stop_all(self): ''' Checks nodes that's set (via self.set_node_controllers) one by one and stops one if each node is running. Then enable START ALL button and disable STOP ALL button. ''' for n in self._node_controllers: if n.is_node_running(): n.stop() # Disable STOP ALL button. self._main_launch_widget._pushbutton_start_all.setEnabled(True) self._main_launch_widget._pushbutton_stop_all.setEnabled(False) def check_process_statuses(self): for n in self._node_controllers: n.check_process_status() def shutdown(self): rospy.logdebug('Launchmain.shutdown') self.stop_all() def save_settings(self, plugin_settings, instance_settings): self._mainwidget.save_settings(plugin_settings, instance_settings) def restore_settings(self, plugin_settings, instance_settings): self._mainwidget.restore_settings(plugin_settings, instance_settings)
class LaunchMain(object): def __init__(self, plugin_context): super(LaunchMain, self).__init__() print 'sfdfdsfsdfds' self._plugin_context = plugin_context self._main_launch_widget = LaunchWidget(self) self._mainwidget = PluginContainerWidget(self._main_launch_widget, True, False) self._run_id = None self._node_controllers = [] self._config = None #RqtRoscommUtil.load_parameters(self._config, '/rqt_launch') def get_widget(self): return self._mainwidget def set_node_controllers(self, node_controllers): self._node_controllers = node_controllers def set_config(self, config): self._config = config def start_all(self): ''' Checks nodes that's set (via self.set_node_controllers) one by one and starts one if each node is not running. Then disable START ALL button and enable STOP ALL button. ''' pat = re.compile(r'.*=(.*)') if self._config: for k in self._config.params.keys(): s = str(self._config.params[k]) result = re.match(pat, s) if result: val = result.groups()[0] if is_int(val): rospy.set_param(k, int(val)) elif is_float(val): rospy.set_param(k, float(val)) else: rospy.set_param(k, val) for n in self._node_controllers: if not n.is_node_running(): n.start(restart=False) # Disable START ALL button. self._main_launch_widget._pushbutton_start_all.setEnabled(False) self._main_launch_widget._pushbutton_stop_all.setEnabled(True) def stop_all(self): ''' Checks nodes that's set (via self.set_node_controllers) one by one and stops one if each node is running. Then enable START ALL button and disable STOP ALL button. ''' for n in self._node_controllers: if n.is_node_running(): n.stop() # Disable STOP ALL button. self._main_launch_widget._pushbutton_start_all.setEnabled(True) self._main_launch_widget._pushbutton_stop_all.setEnabled(False) def check_process_statuses(self): for n in self._node_controllers: n.check_process_status() def shutdown(self): rospy.logdebug('Launchmain.shutdown') self.stop_all() def save_settings(self, plugin_settings, instance_settings): self._mainwidget.save_settings(plugin_settings, instance_settings) def restore_settings(self, plugin_settings, instance_settings): self._mainwidget.restore_settings(plugin_settings, instance_settings)