Esempio n. 1
0
    def _trigger_button(self, checked):
        """Called when user click on ermergency stop button.
        @param checked: Button status (True/False).
        @type checked: bool.
        """
        self._context.resquestEmergencyStop(checked)

        self._button_state = checked

        if checked == EmergencyStopState.LOCKED:
            lng = self._context.getLanguage()
            self._context.sendAlarm(Alarm.CRITICAL,
                                    R.values.strings.emergency_stop(lng))
            self.setIcon(R.getIconById("icon_play"))
        else:
            self.setIcon(R.getIconById("icon_pause"))
Esempio n. 2
0
    def __init__(self, context):
        """! The constructor."""
        QPushButton.__init__(self)

        self._context = context
        self._context.addLanguageEventListner(self.onTranslate)
        self._context.addCloseEventListner(self.onDestroy)

        self.setCheckable(True)
        self.setFocusPolicy(Qt.NoFocus)
        self.setStyleSheet(R.values.styles.transparent_background)

        self.setIcon(R.getIconById("icon_pause"))
        self.setIconSize(QSize(80, 80))

        self._button_state = EmergencyStopState.UNLOCKED
        self._keep_running = True

        self.connect(self, SIGNAL('clicked(bool)'), self._trigger_button)

        self._estop_pub = rospy.Publisher(self.EMERGENCY_STOP_TOPIC_NAME,
                                          Bool,
                                          latch=True,
                                          queue_size=1)

        self._preempt_move_base_pub = rospy.Publisher("/move_base/cancel",
                                                      GoalID,
                                                      queue_size=1)

        self._estop_pub_thread = threading.Thread(
            name='emergency_stop_publisher_loop',
            target=self._emergency_stop_publisher_loop)
        self._estop_pub_thread.start()
Esempio n. 3
0
 def __init__(self, parent, country):
     """! The constructor."""
     QPushButton.__init__(self, parent)
     
     self._parent = parent
     self._country = country
     
     self.setMinimumSize(QSize(40, 40))
     self.setMaximumSize(QSize(60, 60))
     self.setStyleSheet(R.values.styles.transparent_background)
     
     self.setIcon(R.getIconById(country))
     self.setIconSize(QSize(self.width(),self.height()))
Esempio n. 4
0
def run():

    name = 'rqt_gui_py_node_%d' % os.getpid()
    rospy.init_node(name, disable_signals=True)
    app = GuiApplication(sys.argv)

    splash = CobotGuiSplash()
    splash.start()

    window = QMainWindow()

    gui = CobotGuiMain(splash)
    config = rospy.get_param("~config", "${cobot_gui}/config/default.conf")
    config = get_pkg_dir_from_prefix(config)
    gui.setupUserConfig(config)

    window.setCentralWidget(gui)
    window.setGeometry(gui.geometry())
    window.setWindowIcon(R.getIconById('cobot_gui'))

    if gui.getDisplayMode() in FULL_SCREEN_ARGS:
        window.showFullScreen()
    else:
        window.show()

    splash.close()
    #Set the gui signal for cleanup
    app.gui = gui
    app.connect(app, SIGNAL("aboutToQuit()"), app.cleanGui)

    #Set the ctrl+c signal for cleanup
    def signal_handler(signal, frame):
        app.quit()

    signal.signal(signal.SIGINT, signal_handler)

    #set the rospy shutdown signal
    rospy.on_shutdown(app.quit)

    #return of app
    sys.exit(app.exec_())
Esempio n. 5
0
 def update_state(self, state, msg):
     self.setIcon(R.getIconById(state))
     self.setIconSize(QSize(40, 40))
     self.setToolTip(msg)