예제 #1
0
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)
예제 #2
0
    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 = []
예제 #3
0
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 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)

        # 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)