Esempio n. 1
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        loadUi(os.path.join(path, 'resources', 'part.ui'), self)

        self.pub_marker_array = rospy.Publisher('visualization_marker_array',
                                                MarkerArray,
                                                queue_size=1)

        self.btnLoad.clicked.connect(self.btnLoadClicked)
        self.btnProcessMesh.clicked.connect(self.btnProcessMeshClicked)
        self.btnProcessLayer.clicked.connect(self.btnProcessLayerClicked)
        self.btnAcceptPath.clicked.connect(self.btnAcceptPathClicked)

        self.sbPositionX.valueChanged.connect(self.changePosition)
        self.sbPositionY.valueChanged.connect(self.changePosition)
        self.sbPositionZ.valueChanged.connect(self.changePosition)

        self.sbSizeX.valueChanged.connect(self.changeSize)
        self.sbSizeY.valueChanged.connect(self.changeSize)
        self.sbSizeZ.valueChanged.connect(self.changeSize)

        self.processing = False
        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.updateProcess)

        self.robpath = RobPath()
Esempio n. 2
0
    def setup_gui(self, two_columns=True):
        if qt_version_below_5:
            widget_layout = QtGui.QHBoxLayout()
        else:
            widget_layout = QtWidgets.QHBoxLayout()
        widget_layout.addLayout(self._column_1)
        if two_columns:
            widget_layout.addLayout(self._column_2)

        if qt_version_below_5:
            main_layout = QtGui.QHBoxLayout()
        else:
            main_layout = QtWidgets.QHBoxLayout()
        main_layout = QtWidgets.QVBoxLayout()
        main_layout.addLayout(widget_layout)

        self._column_1.setAlignment(QtCore.Qt.AlignTop)
        if two_columns:
            self._column_2.setAlignment(QtCore.Qt.AlignTop)
        widget_layout.setAlignment(QtCore.Qt.AlignTop)
        main_layout.setAlignment(QtCore.Qt.AlignTop)

        self.setLayout(main_layout)

        self._update_info_timer = QtCore.QTimer(self)
        self._update_info_timer.timeout.connect(self.update_gui)
        self._update_info_timer.start(100)
Esempio n. 3
0
 def set_timer(self, parent=None):
     interval = self.publish_interval
     if not self._timer:
         self._timer = QtCore.QTimer(parent=parent)
         self._timer.timeout.connect(self.publish)
     self._timer.setInterval(interval)
     self._timer.start()
Esempio n. 4
0
    def startIntervalTimer(self, msec):

        try:
            self._timer.stop()
        except:
            self._timer = QtCore.QTimer(self)
            self._timer.timeout.connect(self.processTimerShot)

        if msec > 0:
            self._timer.setInterval(msec)
            self._timer.start()
Esempio n. 5
0
    def __init__(self, context):
        super(dvrkDashboard, self).__init__(context)

        # give QObjects reasonable names
        self.setObjectName('dvrkDashboard')

        # process standalone plugin command-line arguments
        from argparse import ArgumentParser
        parser = ArgumentParser()
        # add argument(s) to the parser.
        parser.add_argument("-q",
                            "--quiet",
                            action="store_true",
                            dest="quiet",
                            help="Put plugin in silent mode")
        args, unknowns = parser.parse_known_args(context.argv())
        if not args.quiet:
            print 'arguments: ', args
            print 'unknowns: ', unknowns

        # create qwidget
        self._widget = QtGui.QWidget()
        self._widget.setObjectName('dvrkDashboardUI')

        # serial number
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() +
                                        (' (%d)' % context.serial_number()))

        # add widget to the user interface
        context.add_widget(self._widget)
        self.context = context

        # ---- Get Widget -----
        self.init_ui()

        # ---- States -----
        self.namespace = 'dvrk_mtmr'
        self.jnt_pos = []
        self.jnt_eff = []
        self.init_ros()

        # ---- Timer -----
        self.update_timer = QtCore.QTimer(self)
        self.update_timer.setInterval(50)
        self.update_timer.timeout.connect(self.update_widget_values)
        self.update_timer.start()
        pass
Esempio n. 6
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        loadUi(os.path.join(path, 'resources', 'control.ui'), self)

        self.btnMode.clicked.connect(self.btnModeClicked)
        self.btnControl.clicked.connect(self.btnControlClicked)
        self.btnCalibrate.clicked.connect(self.btnCalibrateClicked)

        self.pub_mode = rospy.Publisher('/control/mode',
                                        MsgMode,
                                        queue_size=10)
        self.pub_control = rospy.Publisher('/control/parameters',
                                           MsgControl,
                                           queue_size=10)

        self.pub_calibrate = rospy.Publisher('/tachyon/calibrate',
                                             MsgCalibrate,
                                             queue_size=10)

        self.mode = MANUAL
        self.msg_mode = MsgMode()
        self.msg_power = MsgPower()
        self.msg_control = MsgControl()

        self.msg_calibrate = MsgCalibrate()

        self.btnControlClicked()

        self.minor_axis = 0
        self.major_axis = 0
        self.power = 0

        rospy.Subscriber('/tachyon/geometry',
                         MsgGeometry,
                         self.cb_geometry,
                         queue_size=1)
        rospy.Subscriber('/control/power',
                         MsgPower,
                         self.cb_power,
                         queue_size=1)

        self.btnModeClicked()
        self.btnControlClicked()

        self.tmrInfo = QtCore.QTimer(self)
        self.tmrInfo.timeout.connect(self.tmrInfoEvent)
        self.tmrInfo.start(100)
Esempio n. 7
0
    def __init__(self):
        super(RobPathUI, self).__init__()
        path = rospkg.RosPack().get_path('etna_planning')
        loadUi(os.path.join(path, 'resources', 'robviz.ui'), self)

        self.boxPlot.addWidget(MyViz())

        self.btnLoad.clicked.connect(self.btnLoadClicked)
        self.btnProcessMesh.clicked.connect(self.btnProcessMeshClicked)
        self.btnSaveRapid.clicked.connect(self.btnSaveRapidClicked)
        self.btnRecord.clicked.connect(self.btnRecordClicked)

        self.sbSpeed.valueChanged.connect(self.changeSpeed)
        self.sbPower.valueChanged.connect(self.changePower)

        self.sbPositionX.valueChanged.connect(self.changePosition)
        self.sbPositionY.valueChanged.connect(self.changePosition)
        self.sbPositionZ.valueChanged.connect(self.changePosition)

        self.sbSizeX.valueChanged.connect(self.changeSize)
        self.sbSizeY.valueChanged.connect(self.changeSize)
        self.sbSizeZ.valueChanged.connect(self.changeSize)

        self.btnQuit.clicked.connect(self.btnQuitClicked)

        self.publisher = rospy.Publisher('visualization_marker',
                                         Marker,
                                         queue_size=1)

        self.recording = False
        cloud_topic = rospy.get_param('~cloud',
                                      '/camera/cloud')  # cameara/points
        rospy.Subscriber(cloud_topic,
                         PointCloud2,
                         self.callback_point_cloud,
                         queue_size=1)

        self.listener = tf.TransformListener()
        #rospy.spin()

        self.processing = False
        self.timer = QtCore.QTimer(self.boxPlot)
        self.timer.timeout.connect(self.updateProcess)

        self.robpath = RobPath()
Esempio n. 8
0
    def __init__(self, context):
        super(Compass, self).__init__(context)
        self.setObjectName('Compass')
        self._publisher = None

        self._widget = QWidget()
        rp = rospkg.RosPack()
        ui_file = os.path.join(rospkg.RosPack().get_path('rqt_compass'), 'resource', 'compass.ui')
        loadUi(ui_file, self._widget)
        self._widget.setObjectName('Compass')
        if context.serial_number() > 1:
            self._widget.setWindowTitle(
            self._widget.windowTitle() + (' (%d)' % context.serial_number()))
        context.add_widget(self._widget)
        self.setup()
        self._widget.goButton.clicked.connect(self.go_button_click)
        self._widget.refresh = QtCore.QTimer()
        self._widget.refresh.timeout.connect(self.update_compass)
        self._widget.refresh.start(100)
        self.listen()
Esempio n. 9
0
    def __init__(self):
        super(CladViz, self).__init__()
        path = rospkg.RosPack().get_path('cladplus_data')
        loadUi(os.path.join(path, 'resources', 'cladviz.ui'), self)

        self.qt_plot = QtPlot()
        self.qt_display = QtDisplay()
        self.boxPlot.addWidget(self.qt_plot)
        self.vl_display.addWidget(self.qt_display)

        self.qtControl = QtControl()
        self.tabWidget.addTab(self.qtControl, 'Control')

        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.timeoutRunning)
        self.timer.start(100)

        self.btnQuit.clicked.connect(self.btnQuitClicked)

        rospy.Subscriber(
            '/supervisor/status', MsgStatus, self.cb_status, queue_size=1)
Esempio n. 10
0
    def __init__(self):
        super(Robviz, self).__init__()
        loadUi(os.path.join(path, 'resources', 'robviz.ui'), self)

        rospy.Subscriber('/supervisor/status',
                         MsgStatus,
                         self.cbStatus,
                         queue_size=1)

        self.boxPlot.addWidget(MyViz())

        self.qtData = QtData(self)
        self.qtParam = QtParam(self)
        self.qtScan = QtScan(self)
        self.qtPart = QtPart(self)
        self.qtPath = QtPath(self)

        self.tabWidget.addTab(self.qtData, 'Data')
        self.tabWidget.addTab(self.qtParam, 'Params')
        self.tabWidget.addTab(self.qtScan, 'Scan')
        self.tabWidget.addTab(self.qtPart, 'Part')
        self.tabWidget.addTab(self.qtPath, 'Path')

        self.qtData.accepted.connect(self.qtDataAccepted)
        self.qtParam.accepted.connect(self.qtParamAccepted)
        self.qtScan.accepted.connect(self.qtScanAccepted)
        self.qtPart.accepted.connect(self.qtPartAccepted)

        self.btnQuit.setIcon(QtGui.QIcon.fromTheme('application-exit'))
        self.btnQuit.clicked.connect(self.btnQuitClicked)

        self.speed = 0
        self.power = 0
        self.running = False
        self.laser_on = False

        tmrInfo = QtCore.QTimer(self)
        tmrInfo.timeout.connect(self.updateStatus)
        tmrInfo.start(100)
    def __init__(self, *args, **kwargs):
        '''
        Initialization of the position plotter widget

        Parameter:
            context
        Returns:
            N/A
        '''

        Matplotlib_Canvas.__init__(self, *args, **kwargs)

        self.new_x, self.new_y, self.prev_x, self.prev_y = 0.0, 0.0, 0.0, 0.0

        #Make figure have grid lines
        self.axes.grid(True, which='both')
        self.axes.set_title('Position')
        self.axes.set_xlabel('x (m)')
        self.axes.set_ylabel('y (m)')

        #Update timer for plot (default 0.5 seconds)
        timer = QtCore.QTimer(self)
        timer.timeout.connect(self._update_figure)
        timer.start(500)
Esempio n. 12
0
    def __init__(self,
                 topic,
                 msg_type,
                 show_only_rate=False,
                 masteruri=None,
                 use_ssh=False,
                 parent=None):
        '''
    Creates an input dialog.
    @param topic: the name of the topic
    @type topic: C{str}
    @param msg_type: the type of the topic
    @type msg_type: C{str}
    @raise Exception: if no topic class was found for the given type
    '''
        QtGui.QDialog.__init__(self, parent=parent)
        self._masteruri = masteruri
        masteruri_str = '' if masteruri is None else '[%s]' % masteruri
        self.setObjectName(' - '.join(['EchoDialog', topic, masteruri_str]))
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
        self.setWindowFlags(QtCore.Qt.Window)
        self.setWindowTitle('%s %s %s' %
                            ('Echo --- ' if not show_only_rate else 'Hz --- ',
                             topic, masteruri_str))
        self.resize(728, 512)
        self.verticalLayout = QtGui.QVBoxLayout(self)
        self.verticalLayout.setObjectName("verticalLayout")
        self.verticalLayout.setContentsMargins(1, 1, 1, 1)
        self.mIcon = QtGui.QIcon(":/icons/crystal_clear_prop_run_echo.png")
        self.setWindowIcon(self.mIcon)

        self.topic = topic
        self.show_only_rate = show_only_rate
        self.lock = threading.RLock()
        self.last_printed_count = 0
        self.msg_t0 = -1.
        self.msg_tn = 0
        self.times = []

        self.message_count = 0
        self._rate_message = ''
        self._scrapped_msgs = 0
        self._scrapped_msgs_sl = 0

        self._last_received_ts = 0
        self.receiving_hz = self.MESSAGE_HZ_LIMIT
        self.line_limit = self.MESSAGE_LINE_LIMIT

        self.field_filter_fn = None

        options = QtGui.QWidget(self)
        if not show_only_rate:
            hLayout = QtGui.QHBoxLayout(options)
            hLayout.setContentsMargins(1, 1, 1, 1)
            self.no_str_checkbox = no_str_checkbox = QtGui.QCheckBox(
                'Hide strings')
            no_str_checkbox.toggled.connect(self.on_no_str_checkbox_toggled)
            hLayout.addWidget(no_str_checkbox)
            self.no_arr_checkbox = no_arr_checkbox = QtGui.QCheckBox(
                'Hide arrays')
            no_arr_checkbox.toggled.connect(self.on_no_arr_checkbox_toggled)
            hLayout.addWidget(no_arr_checkbox)
            self.combobox_reduce_ch = QtGui.QComboBox(self)
            self.combobox_reduce_ch.addItems(
                [str(self.MESSAGE_LINE_LIMIT), '0', '80', '256', '1024'])
            self.combobox_reduce_ch.activated[str].connect(
                self.combobox_reduce_ch_activated)
            self.combobox_reduce_ch.setEditable(True)
            self.combobox_reduce_ch.setToolTip(
                "Set maximum line width. 0 disables the limit.")
            hLayout.addWidget(self.combobox_reduce_ch)
            #      reduce_ch_label = QtGui.QLabel('ch', self)
            #      hLayout.addWidget(reduce_ch_label)
            # add spacer
            spacerItem = QtGui.QSpacerItem(515, 20,
                                           QtGui.QSizePolicy.Expanding,
                                           QtGui.QSizePolicy.Minimum)
            hLayout.addItem(spacerItem)
            # add combobox for displaying frequency of messages
            self.combobox_displ_hz = QtGui.QComboBox(self)
            self.combobox_displ_hz.addItems([
                str(self.MESSAGE_HZ_LIMIT), '0', '0.1', '1', '50', '100',
                '1000'
            ])
            self.combobox_displ_hz.activated[str].connect(
                self.on_combobox_hz_activated)
            self.combobox_displ_hz.setEditable(True)
            hLayout.addWidget(self.combobox_displ_hz)
            displ_hz_label = QtGui.QLabel('Hz', self)
            hLayout.addWidget(displ_hz_label)
            # add combobox for count of displayed messages
            self.combobox_msgs_count = QtGui.QComboBox(self)
            self.combobox_msgs_count.addItems(
                [str(self.MAX_DISPLAY_MSGS), '0', '50', '100'])
            self.combobox_msgs_count.activated[str].connect(
                self.on_combobox_count_activated)
            self.combobox_msgs_count.setEditable(True)
            self.combobox_msgs_count.setToolTip(
                "Set maximum displayed message count. 0 disables the limit.")
            hLayout.addWidget(self.combobox_msgs_count)
            displ_count_label = QtGui.QLabel('#', self)
            hLayout.addWidget(displ_count_label)
            # add topic control button for unsubscribe and subscribe
            self.topic_control_button = QtGui.QToolButton(self)
            self.topic_control_button.setText('stop')
            self.topic_control_button.setIcon(
                QtGui.QIcon(':/icons/deleket_deviantart_stop.png'))
            self.topic_control_button.clicked.connect(
                self.on_topic_control_btn_clicked)
            hLayout.addWidget(self.topic_control_button)
            # add clear button
            clearButton = QtGui.QToolButton(self)
            clearButton.setText('clear')
            clearButton.clicked.connect(self.on_clear_btn_clicked)
            hLayout.addWidget(clearButton)
            self.verticalLayout.addWidget(options)

        self.display = QtGui.QTextBrowser(self)
        self.display.setReadOnly(True)
        self.verticalLayout.addWidget(self.display)
        self.display.document().setMaximumBlockCount(500)
        self.max_displayed_msgs = self.MAX_DISPLAY_MSGS
        self._blocks_in_msg = None
        self.display.setOpenLinks(False)
        self.display.anchorClicked.connect(self._on_display_anchorClicked)

        self.status_label = QtGui.QLabel('0 messages', self)
        self.verticalLayout.addWidget(self.status_label)

        # subscribe to the topic
        errmsg = ''
        try:
            self.__msg_class = message.get_message_class(msg_type)
            if not self.__msg_class:
                errmsg = "Cannot load message class for [%s]. Did you build messages?" % msg_type
#        raise Exception("Cannot load message class for [%s]. Did you build messages?"%msg_type)
        except Exception as e:
            self.__msg_class = None
            errmsg = "Cannot load message class for [%s]. Did you build messagest?\nError: %s" % (
                msg_type, e)
#      raise Exception("Cannot load message class for [%s]. Did you build messagest?\nError: %s"%(msg_type, e))
# variables for Subscriber
        self.msg_signal.connect(self._append_message)
        self.sub = None

        # vairables for SSH connection
        self.ssh_output_file = None
        self.ssh_error_file = None
        self.ssh_input_file = None
        self.text_signal.connect(self._append_text)
        self.text_hz_signal.connect(self._append_text_hz)
        self._current_msg = ''
        self._current_errmsg = ''
        self.text_error_signal.connect(self._append_error_text)

        # decide, which connection to open
        if use_ssh:
            self.__msg_class = None
            self._on_display_anchorClicked(QtCore.QUrl(self._masteruri))
        elif self.__msg_class is None:
            errtxt = '<pre style="color:red; font-family:Fixedsys,Courier,monospace; padding:10px;">\n%s</pre>' % (
                errmsg)
            self.display.setText('<a href="%s">open using SSH</a>' %
                                 (masteruri))
            self.display.append(errtxt)
        else:
            self.sub = rospy.Subscriber(self.topic, self.__msg_class,
                                        self._msg_handle)

        self.print_hz_timer = QtCore.QTimer()
        self.print_hz_timer.timeout.connect(self._on_calc_hz)
        self.print_hz_timer.start(1000)
Esempio n. 13
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        loadUi(os.path.join(path, 'resources', 'path.ui'), self)

        try:
            rospy.wait_for_service('robot_send_command', timeout=5)
            self.send_command = rospy.ServiceProxy('robot_send_command',
                                                   SrvRobotCommand)
        except:
            rospy.loginfo('ERROR connecting to service robot_send_command.')
        #self.pub = rospy.Publisher(
        #    'robot_command_json', MsgRobotCommand, queue_size=10)

        self.btnLoadPath.clicked.connect(self.btnLoadPathClicked)
        icon = QtGui.QIcon.fromTheme('document-open')
        self.btnLoadPath.setIcon(icon)
        self.btnSavePath.clicked.connect(self.btnSavePathClicked)
        icon = QtGui.QIcon.fromTheme('document-save')
        self.btnSavePath.setIcon(icon)
        self.btnRunPath.clicked.connect(self.btnRunPathClicked)
        icon = QtGui.QIcon.fromTheme('media-playback-start')
        self.btnRunPath.setIcon(icon)

        self.btnDelete.clicked.connect(self.btnDeleteClicked)
        self.btnLoadPose.clicked.connect(self.btnLoadPoseClicked)
        self.btnStep.clicked.connect(self.btnStepClicked)
        self.btnCancel.clicked.connect(self.btnCancelClicked)

        self.listWidgetPoses.itemSelectionChanged.connect(self.lstPosesClicked)
        self.listWidgetPoses.itemDoubleClicked.connect(self.qlistDoubleClicked)

        self.jason = Jason()
        self.ok_command = "OK"

        self.offset_position = 100
        self.quat = [0, np.sin(np.deg2rad(45)), 0, np.cos(np.deg2rad(45))]
        self.quat_inv = [0, -np.sin(np.deg2rad(45)), 0, np.cos(np.deg2rad(45))]

        self.pub_marker_array = rospy.Publisher('visualization_marker_array',
                                                MarkerArray,
                                                queue_size=10)

        self.marker_array = MarkerArray()

        self.lines = LinesMarker()
        self.lines.set_size(0.005)
        self.lines.set_color((1, 0, 0, 1))
        self.lines.set_frame('/workobject')
        self.marker_array.markers.append(self.lines.marker)

        self.arrow = ArrowMarker(0.1)
        self.arrow.set_color((0, 0, 1, 1))
        self.arrow.set_frame('/workobject')
        # self.arrow.set_position((0.2, 0.2, 0.2))
        # self.arrow.set_orientation((0, 0, 0, 1))
        self.marker_array.markers.append(self.arrow.marker)

        for id, m in enumerate(self.marker_array.markers):
            m.id = id

        self.tmrRunPath = QtCore.QTimer(self)
        self.tmrRunPath.timeout.connect(self.timeRunPathEvent)
Esempio n. 14
0
    def __init__(self, context):
        """
        Constructor of the class.
        """

        super(MyPlugin, self).__init__(context)

        # give QObjects reasonable names
        self.setObjectName('TelepresencePlugin')

        # create QWidget
        self._widget = QWidget()

        # get path to UI file which should be in the "resource" folder of this
        # package
        ui_file = os.path.join(
            rospkg.RosPack().get_path('rqt_servo'), 'resource', 'view.ui')

        # extend the widget with all attributes and children from UI file
        loadUi(ui_file, self._widget)

        # give QObjects reasonable names
        self._widget.setObjectName('TelepresencePlugin')
        
        # set fixed height
        self._widget.setFixedHeight(164)

        # add widget to the user interface
        context.add_widget(self._widget)
        
        # create a timer
        self.timer = QtCore.QTimer()
        self.timer.start(40)
        
        # class variables
        self.i = 0
        
        # publishers and subscribers
        self.pub_pitch_oculus = rospy.Publisher('pitch_controller/command',
                                                Float32, queue_size=100)
        self.pub_yaw_oculus = rospy.Publisher('yaw_controller/command',
                                              Float32, queue_size=100)

        # events
        QtCore.QObject.connect(self._widget.CheckManual,
                               QtCore.SIGNAL('toggled(bool)'),
                               self.on_CheckManual_toggled)

        QtCore.QObject.connect(self._widget.PitchSlider,
                               QtCore.SIGNAL('valueChanged(int)'),
                               self.on_PitchSlider_valueChanged)
        QtCore.QObject.connect(self._widget.PitchSpin,
                               QtCore.SIGNAL('valueChanged(int)'),
                               self.on_PitchSpin_valueChanged)

        QtCore.QObject.connect(self._widget.YawSlider,
                               QtCore.SIGNAL('valueChanged(int)'),
                               self.on_YawSlider_valueChanged)
        QtCore.QObject.connect(self._widget.YawSpin,
                               QtCore.SIGNAL('valueChanged(int)'),
                               self.on_YawSpin_valueChanged)
        
        QtCore.QObject.connect(self.timer,
                               QtCore.SIGNAL('timeout()'),
                               self.auto_update)

        # set manual box unnactive
        self._widget.CheckManual.setChecked(False)
Esempio n. 15
0
    def clear_text(self):
        """ Clears the text from the textbox """
        self.textbox.setText("")

    def closeEvent(self, event):
        rospy.loginfo('Close event received')
        rospy.signal_shutdown('close event')


if __name__ == '__main__':

    rospy.init_node('continue_gui', anonymous=True)

    app = QtGui.QApplication(sys.argv)
    timer = QtCore.QTimer()
    timer.start(500)
    timer.timeout.connect(lambda: None) # wake up python every now and again

    # also close Qt when a Ctrl+C is pressed
    def handleIntSignal(signum, frame):
        rospy.loginfo('close all windows')
        app.closeAllWindows()
    signal.signal(signal.SIGINT, handleIntSignal)

    if len(sys.argv) > 1 and sys.argv[1][0] != '_':
        grammar_filename = sys.argv[1]
    else:
        grammar_filename = None

    w = ContinueGui(grammar_filename=grammar_filename)
Esempio n. 16
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        loadUi(os.path.join(path, 'resources', 'path.ui'), self)

        try:
            rospy.wait_for_service('robot_send_command', timeout=5)
            self.send_command = rospy.ServiceProxy(
                'robot_send_command', SrvRobotCommand)
        except:
            rospy.loginfo('ERROR connecting to service robot_send_command.')
        #self.pub = rospy.Publisher(
        #    import tf'robot_command_json', MsgRobotCommand, queue_size=10)

        self.pub_marker_array = rospy.Publisher(
            'visualization_marker_array', MarkerArray, queue_size=10)

        self.btnLoadPath.clicked.connect(self.btnLoadPathClicked)
        icon = QtGui.QIcon.fromTheme('document-open')
        self.btnLoadPath.setIcon(icon)
        self.btnSavePath.clicked.connect(self.btnSavePathClicked)
        icon = QtGui.QIcon.fromTheme('document-save')
        self.btnSavePath.setIcon(icon)
        self.btnRunPath.clicked.connect(self.btnRunPathClicked)
        icon = QtGui.QIcon.fromTheme('media-playback-start')
        self.btnRunPath.setIcon(icon)
        self.btnRunTest.clicked.connect(self.btnRunTestClicked)
        self.btnRunTest.setIcon(icon)

        self.btnDelete.clicked.connect(self.btnDeleteClicked)
        self.btnLoadPose.clicked.connect(self.btnLoadPoseClicked)
        self.btnStep.clicked.connect(self.btnStepClicked)
        self.btnCancel.clicked.connect(self.btnCancelClicked)

        self.listWidgetPoses.itemSelectionChanged.connect(self.lstPosesClicked)
        self.listWidgetPoses.itemDoubleClicked.connect(self.qlistDoubleClicked)

        self.testing = False
        self.ok_command = "OK"
        self.path_markers = PathMarkers()

        # Parse robot description file
        robot = URDF.from_parameter_server()
        tcp = robot.joint_map['tcp0']
        workobject = robot.joint_map['workobject']

        tool = [tcp.origin.position,
                list(tf.quaternion_from_euler(*tcp.origin.rotation))]
        print 'Tool:', tool
        workobject = [workobject.origin.position,
                      list(tf.quaternion_from_euler(*workobject.origin.rotation))]
        print 'Workobject:', workobject
        if rospy.has_param('/powder'):
            powder = rospy.get_param('/powder')
        else:
            print '/powder param missing, loaded default'
            powder = {'carrier': 5.0, 'shield': 10.0, 'stirrer': 20.0, 'turntable': 4.0}
        print 'Powder:', powder
        if rospy.has_param('/process'):
            process = rospy.get_param('/process')
        else:
            print '/process param missing, loaded default'
            process = {'focus': 0, 'power': 1000, 'speed': 8}
        print 'Process:', process

        self.jason = Jason()
        self.jason.set_tool(tool)
        self.jason.set_workobject(workobject)
        self.jason.set_powder(
            powder['carrier'], powder['stirrer'], powder['turntable'])
        self.jason.set_process(process['speed'], process['power'])

        self.tmrRunPath = QtCore.QTimer(self)
        self.tmrRunPath.timeout.connect(self.timeRunPathEvent)