Example #1
0
    def __init__(self, guimgr):
        super(AwLgsvlSimulatorWidget, self).__init__()
        self.process = QtCore.QProcess(self)
        self.console = AwProcessViewer(self.process)
        self.button = QtWidgets.QPushButton("Launch Simulator")
        self.button.setCheckable(True)
        self.button.toggled.connect(self.launch_lgsvm)

        self.server_addr = QtWidgets.QLineEdit()
        self.server_port = QtWidgets.QLineEdit()
        self.client_addr = QtWidgets.QLineEdit()
        self.client_port = QtWidgets.QLineEdit()

        self.server_addr.setText("10.100.2.1")
        self.server_port.setText("5000")
        for host in QtNetwork.QNetworkInterface.allAddresses():
            if not host.isLoopback():
                if host.protocol() == QtNetwork.QAbstractSocket.IPv4Protocol:
                    self.client_addr.setText(host.toString())
        self.client_port.setText("9090")

        layout = QtWidgets.QGridLayout()
        layout.addWidget(QtWidgets.QLabel("Server Address"), 0, 0)
        layout.addWidget(QtWidgets.QLabel("Server Port"), 1, 0)
        layout.addWidget(QtWidgets.QLabel("Client Address"), 2, 0)
        layout.addWidget(QtWidgets.QLabel("Client Port"), 3, 0)
        layout.addWidget(self.server_addr, 0, 1)
        layout.addWidget(self.server_port, 1, 1)
        layout.addWidget(self.client_addr, 2, 1)
        layout.addWidget(self.client_port, 3, 1)
        layout.addWidget(self.button, 4, 0, 1, 2)
        layout.addWidget(self.console, 5, 0, 1, 2)
        self.setLayout(layout)
Example #2
0
    def __init__(self, frame_editor):
        self.editor = frame_editor
        self.editor.observers.append(self)

        self.old_frame = None

        self.layout = QtWidgets.QGridLayout()
        self.widget = QWidget()
        self.widget.setLayout(self.layout)

        self.mesh_label = QtWidgets.QLineEdit("File:")
        self.mesh_label.setSizePolicy(QtWidgets.QSizePolicy.Ignored,
                                      QtWidgets.QSizePolicy.Fixed)
        self.mesh_button = QtWidgets.QPushButton("Open")
        self.mesh_button.clicked.connect(lambda: self.btn_open_mesh_clicked())

        self.diameter_label = QtWidgets.QLabel("Diameter:")
        self.diameter_spinbox = QtWidgets.QDoubleSpinBox()
        self.diameter_spinbox.editingFinished.connect(
            lambda: self.diameter_changed())

        self.length_label = QtWidgets.QLabel("Length:")
        self.length_spinbox = QtWidgets.QDoubleSpinBox()
        self.length_spinbox.editingFinished.connect(
            lambda: self.length_changed())

        self.width_label = QtWidgets.QLabel("Width:")
        self.width_spinbox = QtWidgets.QDoubleSpinBox()
        self.width_spinbox.editingFinished.connect(
            lambda: self.width_changed())

        self.height_label = QtWidgets.QLabel("Height:")
        self.height_spinbox = QtWidgets.QDoubleSpinBox()
        self.height_spinbox.editingFinished.connect(
            lambda: self.height_changed())

        self.color_label = QtWidgets.QLabel()
        self.color_label.setAutoFillBackground(True)
        self.update_color_label(None)
        self.color_button = QtWidgets.QPushButton("Set Color")
        self.color_button.clicked.connect(lambda: self.btn_color_clicked())

        self.layout.addWidget(self.mesh_label, 0, 0)
        self.layout.addWidget(self.mesh_button, 0, 1)
        self.layout.addWidget(self.diameter_label, 1, 0)
        self.layout.addWidget(self.diameter_spinbox, 1, 1)
        self.layout.addWidget(self.length_label, 2, 0)
        self.layout.addWidget(self.length_spinbox, 2, 1)
        self.layout.addWidget(self.width_label, 3, 0)
        self.layout.addWidget(self.width_spinbox, 3, 1)
        self.layout.addWidget(self.height_label, 4, 0)
        self.layout.addWidget(self.height_spinbox, 4, 1)
        self.layout.addWidget(self.color_label, 5, 0)
        self.layout.addWidget(self.color_button, 5, 1)

        print("init")
        self.update_widget(None)
Example #3
0
 def __init__(self,
              topic_name,
              attributes,
              array_index,
              publisher,
              parent,
              label_text=None):
     super(ValueWidget, self).__init__(topic_name, publisher, parent=parent)
     self._parent = parent
     self._attributes = attributes
     self._array_index = array_index
     self._text = ez_model.make_text(topic_name, attributes, array_index)
     self._horizontal_layout = QtWidgets.QHBoxLayout()
     if label_text is None:
         self._topic_label = QtWidgets.QLabel(self._text)
     else:
         self._topic_label = QtWidgets.QLabel(label_text)
     self.close_button = QtWidgets.QPushButton()
     self.close_button.setMaximumWidth(30)
     self.close_button.setIcon(self.style().standardIcon(
         QtWidgets.QStyle.SP_TitleBarCloseButton))
     self.up_button = QtWidgets.QPushButton()
     self.up_button.setIcon(self.style().standardIcon(
         QtWidgets.QStyle.SP_ArrowUp))
     self.up_button.setMaximumWidth(30)
     self.down_button = QtWidgets.QPushButton()
     self.down_button.setMaximumWidth(30)
     self.down_button.setIcon(self.style().standardIcon(
         QtWidgets.QStyle.SP_ArrowDown))
     repeat_label = QtWidgets.QLabel('repeat')
     self._repeat_box = QtWidgets.QCheckBox()
     self._repeat_box.stateChanged.connect(self.repeat_changed)
     self._repeat_box.setChecked(publisher.is_repeating())
     self._publish_button = QtWidgets.QPushButton('Publish')
     self._publish_button.clicked.connect(publisher.publish)
     self._horizontal_layout.addWidget(self._topic_label)
     self._horizontal_layout.addWidget(self.close_button)
     self._horizontal_layout.addWidget(self.up_button)
     self._horizontal_layout.addWidget(self.down_button)
     if self._array_index is not None:
         self.add_button = QtWidgets.QPushButton('+')
         self.add_button.setMaximumWidth(30)
         self._horizontal_layout.addWidget(self.add_button)
     else:
         self.add_button = None
     self.close_button.clicked.connect(
         lambda x: self._parent.close_slider(self))
     self.up_button.clicked.connect(
         lambda x: self._parent.move_up_widget(self))
     self.down_button.clicked.connect(
         lambda x: self._parent.move_down_widget(self))
     self.setup_ui(self._text)
     self._horizontal_layout.addWidget(self._publish_button)
     self._horizontal_layout.addWidget(repeat_label)
     self._horizontal_layout.addWidget(self._repeat_box)
Example #4
0
    def __init__(self, guimgr):
        super(AwRosbagSimulatorWidget, self).__init__()
        self.rosbag_mode_proc = QtCore.QProcess(self)
        self.rosbag_info_proc = QtCore.QProcess(self)
        self.rosbag_play_proc = QtCore.QProcess(self)

        self.rosbag_file = widgets.AwFileSelect(self)
        self.rosbag_info = QtWidgets.QPushButton("Info")
        self.rosbag_text = QtWidgets.QLabel("No information")
        self.rosbag_enable = QtWidgets.QCheckBox()
        self.rosbag_label = QtWidgets.QLabel("Simulation Mode")
        self.rosbag_play = QtWidgets.QPushButton("Play")
        self.rosbag_stop = QtWidgets.QPushButton("Stop")
        self.rosbag_pause = QtWidgets.QPushButton("Pause")
        self.rosbag_state = QtWidgets.QLabel()
        #self.rosbag_stime  = QtWidgets.QLineEdit()
        #start time
        #repeat
        #rate

        self.rosbag_enable.stateChanged.connect(self.simulation_mode_changed)
        self.rosbag_info.clicked.connect(self.rosbag_info_requested)
        self.rosbag_info_proc.finished.connect(self.rosbag_info_completed)

        self.rosbag_play.clicked.connect(self.rosbag_started)
        self.rosbag_stop.clicked.connect(self.rosbag_stopped)
        self.rosbag_play_proc.finished.connect(self.rosbag_finished)
        self.rosbag_play_proc.readyReadStandardOutput.connect(
            self.rosbag_output)

        self.rosbag_pause.setCheckable(True)
        self.rosbag_pause.toggled.connect(self.rosbag_paused)

        self.setStyleSheet(
            "QCheckBox::indicator { width: 28px; height: 28px; }")
        self.rosbag_label.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                        QtWidgets.QSizePolicy.Preferred)
        self.rosbag_text.setSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                       QtWidgets.QSizePolicy.Expanding)

        layout = QtWidgets.QGridLayout()
        layout.addWidget(self.rosbag_enable, 0, 0)
        layout.addWidget(self.rosbag_label, 0, 1)
        layout.addWidget(self.rosbag_play, 0, 2)
        layout.addWidget(self.rosbag_stop, 0, 3)
        layout.addWidget(self.rosbag_pause, 0, 4)
        layout.addWidget(self.rosbag_state, 1, 0, 1, 5)
        layout.addWidget(self.rosbag_file.path, 2, 0, 1, 3)
        layout.addWidget(self.rosbag_file.button, 2, 3)
        layout.addWidget(self.rosbag_info, 2, 4)
        layout.addWidget(self.rosbag_text, 3, 0, 1, 5)
        self.setLayout(layout)
        self.simulation_mode_disabled()
Example #5
0
    def update_hosts_status(self):
        '''
        Updates the text and color of the displayed hosts table elements.
        '''
        rows = self.hosts["current"].hosts
        columns = ["ip", "status"]

        for row in range(len(rows)):
            column_color = []

            # Assigns colors to each item in the row
            if (getattr(rows[row], "ip") == "Unknown"):
                column_color.append(self.colors["red"])
                column_color.append(self.colors["red"])
            else:
                column_color.append(self.colors["green"])
                if (getattr(rows[row], "status") == "Online"):
                    column_color.append(self.colors["green"])
                else:
                    column_color.append(self.colors["red"])

            # Updates the host's IP address and status in the devices table
            for column in range(len(columns)):
                entry = QtWidgets.QLabel(getattr(rows[row], columns[column]))
                entry.setAlignment(QtCore.Qt.AlignCenter)
                entry.setStyleSheet(column_color[column])
                self.device_table.setCellWidget(row, column, entry)

        # Set the cached host data to the host data that was just displayed
        self.hosts["displayed"] = copy(self.hosts["current"])
Example #6
0
    def setupUi(self, MainWindow):
        self.lock = Lock()
        self.talker = Talker('taskview')
        rospy.Subscriber('BbSync', bbsynch, self.taskview)

        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.listView = QtWidgets.QListWidget(self.centralwidget)
        self.listView.setGeometry(QtCore.QRect(10, 40, 771, 521))
        self.listView.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
        self.listView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
        self.listView.setObjectName("listView")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(10, 10, 67, 17))
        self.label.setObjectName("label")
        MainWindow.setCentralWidget(self.centralwidget)
        self.statusbar = QtWidgets.QStatusBar(MainWindow)
        self.statusbar.setObjectName("statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        self.tasklist = []
        self.markers = rviz_tools.RvizMarkers('/map', 'markers')
Example #7
0
    def __init__(self):

        super(PluginEditWidget, self).__init__()
        self.fields = collections.OrderedDict()
        self.setLayout(QtWidgets.QGridLayout())
        for col,text in enumerate(PluginEditWidget.header):
            self.layout().addWidget(QtWidgets.QLabel(text), 0, col)
        self.export = QtWidgets.QPushButton("Export")
        self.export.clicked.connect(self.export_yaml)
Example #8
0
    def __init__(self, guimgr):
        super(AwQuickStartPanel, self).__init__()
        self.guimgr = guimgr
        self.frames = {"root/" + name: None for name in ["map", "vehicle", "sensing", "visualization"]}
        self.awlogo = QtWidgets.QLabel()

        pixmap = QtGui.QPixmap(myutils.package("resources/autoware_logo.png"))
        self.awlogo.setPixmap(pixmap)
        self.awlogo.setAlignment(QtCore.Qt.AlignCenter)
        self.awlogo.setSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
Example #9
0
    def __init__(self, client):
        super(AwProcessPanel, self).__init__()
        self.__client = client
        self.__items = {}
        self.__server = None

        self.__dummy = QtWidgets.QLabel("This is node")
        self.addWidget(self.__dummy)

        self.__tmpdir = "/tmp/autoware_launcher"
        myutils.makedirs(self.__tmpdir, mode=0o700, exist_ok=True)
Example #10
0
    def __frame_setup(self, widget):

        widget.title = QtWidgets.QLabel("No Title")
        widget.title.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
        layout = self.create_frame_header_hlayout()
        layout.addWidget(widget.title)
        widget.header = QtWidgets.QWidget()
        widget.header.setObjectName("FrameHeader")
        widget.header.setLayout(layout)

        layout = self.create_frame_entire_vlayout()
        layout.addWidget(widget.header)
        widget.setLayout(layout)
Example #11
0
    def show_select_window(self):

        # window
        window = QtWidgets.QMainWindow(self)
        window.setCentralWidget(QtWidgets.QWidget())
        window.setAttribute(QtCore.Qt.WA_DeleteOnClose, True)
        window.setWindowModality(QtCore.Qt.ApplicationModal)
        window.setGeometry(self.window().geometry())

        # widget
        window.setWindowTitle("Create Node")
        widget = window.centralWidget()
        widget.setLayout(QtWidgets.QVBoxLayout())

        # plugin select
        pname_select = QtWidgets.QListWidget()
        for pname in self.rule.plugins:
            pname_select.addItem(pname)
        widget.layout().addWidget(QtWidgets.QLabel("Node Type"))
        widget.layout().addWidget(pname_select)

        # footer
        error_label = QtWidgets.QLabel()
        error_label.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
        cancel_button = QtWidgets.QPushButton("Cancel")
        select_button = QtWidgets.QPushButton("Select")
        cancel_button.clicked.connect(window.close)
        select_button.clicked.connect(self.onselected)
        footer = QtWidgets.QHBoxLayout()
        footer.addWidget(error_label)
        footer.addWidget(cancel_button)
        footer.addWidget(select_button)
        widget.layout().addLayout(footer)

        self.ui_window = window
        self.ui_error  = error_label
        self.ui_pname  = pname_select
        window.show()
Example #12
0
    def __init__(self, plugin):
        super(ConfigDialog, self).__init__()
        self._plugin = plugin
        self._interval_spin_box = QtWidgets.QSpinBox()
        self._interval_spin_box.setMaximum(10000)
        self._interval_spin_box.setMinimum(1)
        self._interval_spin_box.setValue(
            publisher.TopicPublisherWithTimer.publish_interval)
        self._interval_spin_box.valueChanged.connect(self.update_interval)
        self._vertical_layout = QtWidgets.QVBoxLayout()
        self.configurable_checkbox = QtWidgets.QCheckBox()
        self.configurable_checkbox.setChecked(plugin.configurable)
        configurable_label = QtWidgets.QLabel('Configurable')
        self._configurable_horizontal_layout = QtWidgets.QHBoxLayout()
        self._configurable_horizontal_layout.addWidget(configurable_label)
        self._configurable_horizontal_layout.addWidget(self.configurable_checkbox)
        self._vertical_layout.addLayout(self._configurable_horizontal_layout)
        self._horizontal_layout = QtWidgets.QHBoxLayout()
        spin_label = QtWidgets.QLabel('Publish Interval for repeat [ms]')
        self._horizontal_layout.addWidget(spin_label)
        self._horizontal_layout.addWidget(self._interval_spin_box)
        self._vertical_layout.addLayout(self._horizontal_layout)
        save_button = QtWidgets.QPushButton(parent=self)
        save_button.setIcon(
            self.style().standardIcon(QtWidgets.QStyle.SP_DialogSaveButton))
        save_button.setText('Save to file')
        save_button.clicked.connect(self.save_to_file)

        load_button = QtWidgets.QPushButton(parent=self)
        load_button.setIcon(
            self.style().standardIcon(QtWidgets.QStyle.SP_DialogOpenButton))
        load_button.setText('Load from file')
        load_button.clicked.connect(self.load_from_file)

        self._vertical_layout.addWidget(save_button)
        self._vertical_layout.addWidget(load_button)
        self.setLayout(self._vertical_layout)
        self.adjustSize()
Example #13
0
    def __init__(self, client):
        super(AwControlPanel, self).__init__()
        self.__client = client

        self.__exec_button = QtWidgets.QPushButton("Exec")
        self.__term_button = QtWidgets.QPushButton("Term")
        self.__exec_button.clicked.connect(self.exec_config)
        self.__term_button.clicked.connect(self.term_config)

        self.__lpath = QtWidgets.QLabel()
        self.setLayout(QtWidgets.QVBoxLayout())

        layout = QtWidgets.QHBoxLayout()
        layout.addWidget(QtWidgets.QLabel("Path: "))
        layout.addWidget(self.__lpath)
        self.__lpath.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                   QtWidgets.QSizePolicy.Preferred)
        self.layout().addLayout(layout)

        layout = QtWidgets.QHBoxLayout()
        layout.addWidget(self.__exec_button)
        layout.addWidget(self.__term_button)
        self.layout().addLayout(layout)
Example #14
0
    def __init__(self, guimgr, node, view):
        super(AwTransformFrame, self).__init__(guimgr, node, view)
        super(AwTransformFrame, self).setup_widget()
        self.set_title(frame_title(self.view, "Transform"))

        widget = QtWidgets.QWidget()
        widget.setLayout(QtWidgets.QHBoxLayout())
        for idx, txt in enumerate(["Tx", "Ty", "Tz", "Rx", "Ry", "Rz"]):
            field = AwRealField(self.node.get_config(self.view.target[idx]))
            field.target = self.view.target[idx]
            field.value_updated.connect(self.apply)
            widget.layout().addWidget(QtWidgets.QLabel(txt + ":"))
            widget.layout().addWidget(field)
        self.add_widget(widget)
Example #15
0
    def setup_widget(self):
        super(AwDefaultNodePanel, self).setup_widget()

        # For Debug
        self.debug1 = QtWidgets.QLabel(self.node.tostring())
        self.debug1.setVisible(False)
        self.add_frame(self.debug1)
        self.setFocusPolicy(QtCore.Qt.ClickFocus)

        # For Debug
        self.debug2 = QtWidgets.QLabel(self.node.generate_launch())
        self.debug2.setVisible(False)
        self.add_frame(self.debug2)
        self.setFocusPolicy(QtCore.Qt.ClickFocus)


        # data view
        for view in self.node.plugin().panel().frames:
            self.add_frame(self.guimgr.create_widget(self.node, view))

        # node view
        for rule in self.node.plugin().rules():
            if rule.unique:
                if self.node.haschild(rule.name):
                    child_node = self.node.getchild(rule.name)
                    child_view = child_node.plugin().frame()
                    self.add_frame(self.guimgr.create_widget(child_node, child_view))
                else:
                    self.add_frame(AwNodeCreateButton(self.node, rule, "Create " + rule.name.capitalize()))
            else:
                rule_names = [name for name in self.node.childnames() if name.startswith(rule.name)]
                for rule_name in rule_names:
                    child_node = self.node.getchild(rule_name)
                    child_view = child_node.plugin().frame()
                    self.add_frame(self.guimgr.create_widget(child_node, child_view))
                self.add_frame(AwNodeCreateButton(self.node, rule, "Create " + rule.name.capitalize()))
Example #16
0
    def __setup_widget(self):

        # Frame Header
        self.title = QtWidgets.QLabel("No Title")
        self.title.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                 QtWidgets.QSizePolicy.Preferred)
        layout = self.guimgr.create_frame_header_hlayout()
        layout.addWidget(self.title)
        self.header = QtWidgets.QWidget()
        self.header.setObjectName("FrameHeader")
        self.header.setLayout(layout)

        # Frame Layout
        layout = self.guimgr.create_frame_entire_vlayout()
        layout.addWidget(self.header)
        self.setLayout(layout)
Example #17
0
    def __init__(self, attr):

        self.name = QtWidgets.QLabel()
        self.type = QtWidgets.QComboBox()
        self.list = QtWidgets.QComboBox()
        self.default = QtWidgets.QLineEdit()

        self.name.setText(attr["name"])
        self.type.addItems(["str", "int", "real", "bool"])
        self.list.addItems(["none", "space", "yaml"])
        self.default.setText(attr.get("default"))

        self.type.setCurrentIndex(-1)
        if attr.get("default"):
            itype = self.type_inference(attr["default"])
            self.type.setCurrentIndex(self.type.findText(itype))
Example #18
0
    def chained_tasks_drop_cb(self, event):
        '''
        Called when a task is dropped from the available_tasks_list to the chained_tasks_table,
        or when a task is moved (reordered) within the chained_tasks_table.
        '''
        idx = self.chained_tasks_table.indexAt(event.pos()).row()
        if idx == -1:  # Handle insertion at end of table
            idx = self.chained_tasks_table.rowCount()

        # If drop is from itself, do a reorder
        if event.source() == self.chained_tasks_table:
            # Now swap the two rows
            selected_index = self.chained_tasks_table.selectedIndexes()[0].row(
            )
            if idx == selected_index:
                return
            self.chained_tasks_table.insertRow(idx)
            if selected_index > idx:
                selected_index += 1
            for i in range(self.chained_tasks_table.columnCount()):
                self.chained_tasks_table.setCellWidget(
                    idx, i,
                    self.chained_tasks_table.cellWidget(selected_index, i))
            self.chained_tasks_table.removeRow(selected_index)

        # If drop is from available list, insert it at the dropped row
        elif event.source() == self.available_tasks_list:
            selected_item = self.available_tasks_list.selectedItems()[0]
            task = QtWidgets.QLabel(selected_item.text())
            required = CenteredCheckBox()
            required.setChecked(True)  # Start with default required
            timeout = QtWidgets.QDoubleSpinBox()
            timeout.setValue(0)
            timeout.setMaximum(10000)
            timeout.setSuffix('s')
            parameters = QtWidgets.QLineEdit('')
            self.chained_tasks_table.insertRow(idx)
            self.chained_tasks_table.setCellWidget(idx, 0, task)
            self.chained_tasks_table.setCellWidget(idx, 1, required)
            self.chained_tasks_table.setCellWidget(idx, 2, timeout)
            self.chained_tasks_table.setCellWidget(idx, 3, parameters)
Example #19
0
 def load_chained_missions(self, list_of_missions):
     for i in reversed(range(self.chained_missions_table.rowCount())):
         self.chained_missions_table.removeRow(i)
     for idx, m in enumerate(list_of_missions):
         mission = m['mission']
         timeout = m['timeout']
         required = m['required']
         parameters = m['parameters']
         mission = QtWidgets.QLabel(m['mission'])
         required = CenteredCheckBox()
         required.setChecked(m['required'])  # Start with default required
         timeout = QtWidgets.QDoubleSpinBox()
         timeout.setValue(m['timeout'])
         timeout.setMaximum(10000)
         timeout.setSuffix('s')
         parameters = QtWidgets.QLineEdit(m['parameters'])
         self.chained_missions_table.insertRow(idx)
         self.chained_missions_table.setCellWidget(idx, 0, mission)
         self.chained_missions_table.setCellWidget(idx, 1, required)
         self.chained_missions_table.setCellWidget(idx, 2, timeout)
         self.chained_missions_table.setCellWidget(idx, 3, parameters)
    def setupUi(self, MainWindow):
###############################################################################################
        self.lock = Lock()
        self.talker = Talker('gui')
        rospy.Subscriber('bbBackup',bbBackup,self.backupFunction)   
        rospy.Subscriber('clicked_point',PointStamped,self.clickedPintRviz)
###############################################################################################


        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(560, 440)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.gBnewTask = QtWidgets.QGroupBox(self.centralwidget)
        self.gBnewTask.setGeometry(QtCore.QRect(10, 60, 541, 291))
        self.gBnewTask.setObjectName("gBnewTask")
        self.gBc = QtWidgets.QGroupBox(self.gBnewTask)
        self.gBc.setEnabled(False)
        self.gBc.setGeometry(QtCore.QRect(420, 80, 111, 151))
        self.gBc.setObjectName("gBc")
        self.label_29 = QtWidgets.QLabel(self.gBc)
        self.label_29.setGeometry(QtCore.QRect(10, 30, 16, 21))
        self.label_29.setObjectName("label_29")
        self.label_30 = QtWidgets.QLabel(self.gBc)
        self.label_30.setGeometry(QtCore.QRect(10, 90, 21, 21))
        self.label_30.setObjectName("label_30")
        self.label_31 = QtWidgets.QLabel(self.gBc)
        self.label_31.setGeometry(QtCore.QRect(10, 60, 16, 21))
        self.label_31.setObjectName("label_31")
        self.cx = QtWidgets.QDoubleSpinBox(self.gBc)
        self.cx.setGeometry(QtCore.QRect(30, 30, 69, 26))
        self.cx.setObjectName("cx")
        self.cx.setRange(-100.0,100.0)
        self.cy = QtWidgets.QDoubleSpinBox(self.gBc)
        self.cy.setGeometry(QtCore.QRect(30, 60, 69, 26))
        self.cy.setObjectName("cy")
        self.cy.setRange(-100.0,100.0)
        self.cz = QtWidgets.QDoubleSpinBox(self.gBc)
        self.cz.setGeometry(QtCore.QRect(30, 90, 69, 26))
        self.cz.setObjectName("cz")
        self.cz.setRange(-100.0,100.0)
        self.cw = QtWidgets.QDoubleSpinBox(self.gBc)
        self.cw.setGeometry(QtCore.QRect(30, 120, 69, 26))
        self.cw.setObjectName("cw")
        self.cw.setRange(-100.0,100.0)
        self.label_39 = QtWidgets.QLabel(self.gBc)
        self.label_39.setGeometry(QtCore.QRect(10, 120, 21, 21))
        self.label_39.setObjectName("label_39")
        self.gBb = QtWidgets.QGroupBox(self.gBnewTask)
        self.gBb.setEnabled(False)
        self.gBb.setGeometry(QtCore.QRect(300, 80, 111, 151))
        self.gBb.setObjectName("gBb")
        self.label_40 = QtWidgets.QLabel(self.gBb)
        self.label_40.setGeometry(QtCore.QRect(10, 30, 16, 21))
        self.label_40.setObjectName("label_40")
        self.label_41 = QtWidgets.QLabel(self.gBb)
        self.label_41.setGeometry(QtCore.QRect(10, 90, 21, 21))
        self.label_41.setObjectName("label_41")
        self.label_42 = QtWidgets.QLabel(self.gBb)
        self.label_42.setGeometry(QtCore.QRect(10, 60, 16, 21))
        self.label_42.setObjectName("label_42")
        self.bx = QtWidgets.QDoubleSpinBox(self.gBb)
        self.bx.setGeometry(QtCore.QRect(30, 30, 69, 26))
        self.bx.setObjectName("bx")
        self.bx.setRange(-100.0,100.0)
        self.by = QtWidgets.QDoubleSpinBox(self.gBb)
        self.by.setGeometry(QtCore.QRect(30, 60, 69, 26))
        self.by.setObjectName("by")
        self.by.setRange(-100.0,100.0)
        self.bz = QtWidgets.QDoubleSpinBox(self.gBb)
        self.bz.setGeometry(QtCore.QRect(30, 90, 69, 26))
        self.bz.setObjectName("bz")
        self.bz.setRange(-100.0,100.0)
        self.bw = QtWidgets.QDoubleSpinBox(self.gBb)
        self.bw.setGeometry(QtCore.QRect(30, 120, 69, 26))
        self.bw.setObjectName("bw")
        self.bw.setRange(-100.0,100.0)
        self.label_43 = QtWidgets.QLabel(self.gBb)
        self.label_43.setGeometry(QtCore.QRect(10, 120, 21, 21))
        self.label_43.setObjectName("label_43")
        self.gBtaskType = QtWidgets.QGroupBox(self.gBnewTask)
        self.gBtaskType.setGeometry(QtCore.QRect(10, 80, 161, 151))
        self.gBtaskType.setObjectName("gBtaskType")
        self.radioButton = QtWidgets.QRadioButton(self.gBtaskType)
        self.radioButton.setEnabled(True)
        self.radioButton.setGeometry(QtCore.QRect(10, 30, 131, 23))
        self.radioButton.setChecked(True)
        self.radioButton.setObjectName("radioButton")
        self.radioButton_2 = QtWidgets.QRadioButton(self.gBtaskType)
        self.radioButton_2.setGeometry(QtCore.QRect(10, 60, 101, 23))
        self.radioButton_2.setObjectName("radioButton_2")
        self.radioButton_3 = QtWidgets.QRadioButton(self.gBtaskType)
        self.radioButton_3.setGeometry(QtCore.QRect(10, 90, 131, 23))
        self.radioButton_3.setObjectName("radioButton_3")
        self.radioButton_4 = QtWidgets.QRadioButton(self.gBtaskType)
        self.radioButton_4.setGeometry(QtCore.QRect(10, 120, 141, 23))
        self.radioButton_4.setObjectName("radioButton_4")
        self.gBa = QtWidgets.QGroupBox(self.gBnewTask)
        self.gBa.setEnabled(True)
        self.gBa.setGeometry(QtCore.QRect(180, 80, 111, 151))
        self.gBa.setObjectName("gBa")
        self.label_25 = QtWidgets.QLabel(self.gBa)
        self.label_25.setGeometry(QtCore.QRect(10, 30, 16, 21))
        self.label_25.setObjectName("label_25")
        self.label_26 = QtWidgets.QLabel(self.gBa)
        self.label_26.setGeometry(QtCore.QRect(10, 90, 21, 21))
        self.label_26.setObjectName("label_26")
        self.label_27 = QtWidgets.QLabel(self.gBa)
        self.label_27.setGeometry(QtCore.QRect(10, 60, 16, 21))
        self.label_27.setObjectName("label_27")
        self.ax = QtWidgets.QDoubleSpinBox(self.gBa)
        self.ax.setGeometry(QtCore.QRect(30, 30, 69, 26))
        self.ax.setObjectName("ax")
        self.ax.setRange(-100.0,100.0)
        self.ay = QtWidgets.QDoubleSpinBox(self.gBa)
        self.ay.setGeometry(QtCore.QRect(30, 60, 69, 26))
        self.ay.setObjectName("ay")
        self.ay.setRange(-100.0,100.0)
        self.az = QtWidgets.QDoubleSpinBox(self.gBa)
        self.az.setGeometry(QtCore.QRect(30, 90, 69, 26))
        self.az.setObjectName("az")
        self.az.setRange(-100.0,100.0)
        self.aw = QtWidgets.QDoubleSpinBox(self.gBa)
        self.aw.setGeometry(QtCore.QRect(30, 120, 69, 26))
        self.aw.setObjectName("aw")
        self.aw.setRange(-100.0,100.0)
        self.label_28 = QtWidgets.QLabel(self.gBa)
        self.label_28.setGeometry(QtCore.QRect(10, 120, 21, 21))
        self.label_28.setObjectName("label_28")
        self.btnAddTask = QtWidgets.QPushButton(self.gBnewTask)
        self.btnAddTask.setEnabled(True)
        self.btnAddTask.setGeometry(QtCore.QRect(10, 240, 521, 31))
        self.btnAddTask.setObjectName("btnAddTask")
        self.widget = QtWidgets.QWidget(self.gBnewTask)
        self.widget.setGeometry(QtCore.QRect(10, 30, 521, 28))
        self.widget.setObjectName("widget")
        self.horizontalLayout = QtWidgets.QHBoxLayout(self.widget)
        self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.label_3 = QtWidgets.QLabel(self.widget)
        self.label_3.setObjectName("label_3")
        self.horizontalLayout.addWidget(self.label_3)
        self.sBtaskid = QtWidgets.QSpinBox(self.widget)
        self.sBtaskid.setObjectName("sBtaskid")
        self.horizontalLayout.addWidget(self.sBtaskid)
        self.label_4 = QtWidgets.QLabel(self.widget)
        self.label_4.setObjectName("label_4")
        self.horizontalLayout.addWidget(self.label_4)
        self.sbtaskPriority = QtWidgets.QSpinBox(self.widget)
        self.sbtaskPriority.setObjectName("sbtaskPriority")
        self.horizontalLayout.addWidget(self.sbtaskPriority)
        self.label_5 = QtWidgets.QLabel(self.widget)
        self.label_5.setObjectName("label_5")
        self.horizontalLayout.addWidget(self.label_5)
        self.sbtaskPayload = QtWidgets.QSpinBox(self.widget)
        self.sbtaskPayload.setObjectName("sbtaskPayload")
        self.horizontalLayout.addWidget(self.sbtaskPayload)
        self.gBrobotState = QtWidgets.QGroupBox(self.centralwidget)
        self.gBrobotState.setGeometry(QtCore.QRect(10, 360, 541, 71))
        self.gBrobotState.setObjectName("gBrobotState")
        self.sBrobotId = QtWidgets.QSpinBox(self.gBrobotState)
        self.sBrobotId.setGeometry(QtCore.QRect(80, 30, 48, 31))
        self.sBrobotId.setObjectName("sBrobotId")
        self.radioButton_5 = QtWidgets.QRadioButton(self.gBrobotState)
        self.radioButton_5.setGeometry(QtCore.QRect(140, 32, 61, 31))
        self.radioButton_5.setChecked(True)
        self.radioButton_5.setObjectName("radioButton_5")
        self.radioButton_6 = QtWidgets.QRadioButton(self.gBrobotState)
        self.radioButton_6.setGeometry(QtCore.QRect(280, 32, 71, 31))
        self.radioButton_6.setObjectName("radioButton_6")
        self.radioButton_7 = QtWidgets.QRadioButton(self.gBrobotState)
        self.radioButton_7.setGeometry(QtCore.QRect(210, 32, 51, 31))
        self.radioButton_7.setObjectName("radioButton_7")
        self.btnsetRobotState = QtWidgets.QPushButton(self.gBrobotState)
        self.btnsetRobotState.setEnabled(True)
        self.btnsetRobotState.setGeometry(QtCore.QRect(380, 30, 151, 31))
        self.btnsetRobotState.setObjectName("btnsetRobotState")
        self.label_32 = QtWidgets.QLabel(self.gBrobotState)
        self.label_32.setGeometry(QtCore.QRect(10, 30, 81, 31))
        self.label_32.setObjectName("label_32")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(10, 20, 81, 17))
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setGeometry(QtCore.QRect(300, 20, 141, 17))
        self.label_2.setObjectName("label_2")
        self.lblblackBoard = QtWidgets.QLabel(self.centralwidget)
        self.lblblackBoard.setGeometry(QtCore.QRect(100, 20, 141, 17))
        font = QtGui.QFont()
        font.setItalic(True)
        self.lblblackBoard.setFont(font)
        self.lblblackBoard.setObjectName("lblblackBoard")
        self.lblbackupBlackboard = QtWidgets.QLabel(self.centralwidget)
        self.lblbackupBlackboard.setGeometry(QtCore.QRect(450, 20, 91, 17))
        font = QtGui.QFont()
        font.setItalic(True)
        self.lblbackupBlackboard.setFont(font)
        self.lblbackupBlackboard.setObjectName("lblbackupBlackboard")
        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
        self.currentpint = 1
Example #21
0
 def frame_add_text_widget(self, frame, text):
     layout = self.create_frame_header_hlayout()
     layout.addWidget(QtWidgets.QLabel(text))
     widget = QtWidgets.QWidget()
     widget.setLayout(layout)
     self.frame_add_widget(frame, widget)
Example #22
0
 def add_text_widget(self, text):
     layout = self.guimgr.create_frame_header_hlayout()
     layout.addWidget(QtWidgets.QLabel(text))
     widget = QtWidgets.QWidget()
     widget.setLayout(layout)
     self.add_widget(widget)
Example #23
0
    def init_buttons(self):
        added_node_labels = []
        
        if self.tree != None:
            for node in self.tree.nodes:
                if node.label in added_node_labels:
                    continue
                added_node_labels.append(node.label)
                
                def get_publish_function(widget, button, other_buttons, node, message_type, message_data):
                    pub = rospy.Publisher(node.get_subscriber_name(), message_type, queue_size=1)
                    class IDContainer:
                        def __init__(self):
                            self.id = 0
                    id_container = IDContainer()
                    def active_callback(msg):
                        id_container.id = msg.id
                    if isinstance(message_type(), Status):
                        print(node.get_publisher_name())
                        sub = rospy.Subscriber(node.get_publisher_name(), Active, active_callback)
                    def add_publish_function():
                        def publish_function():
                            if message_data != 'NO MESSAGE':
                                msg = message_type()
                                if isinstance(msg, Bool):
                                    msg.data = message_data
                                elif isinstance(msg, Status):
                                    msg.status = message_data
                                    msg.id = id_container.id
                                pub.publish(msg)
                                #print(node.label + ' publishing to ' + node.get_subscriber_name() + ' ' + str(message_data))
                        self.functions_mutex.acquire()
                        self.functions[node.label] = publish_function
                        self.functions_mutex.release()
                        if message_data == Status.SUCCESS or message_data == True:
                            widget.setStyleSheet("background-color: rgb(0, 255, 0);")
                        elif message_data == Status.RUNNING:
                            widget.setStyleSheet("background-color: rgb(0, 0, 255);")
                        elif message_data == Status.FAILURE or message_data == False:
                            widget.setStyleSheet("background-color: rgb(255, 0, 0);")
                        elif message_data == 'NO MESSAGE':
                            widget.setStyleSheet("background-color: rgb(255, 255, 255);")
                        button.setStyleSheet("background-color: rgb(0, 255, 0);")
                        for b in other_buttons:
                            b.setStyleSheet("background-color: rgb(255, 0, 0);")
                    return add_publish_function
                
                if isinstance(node, bt.Action):
                    action_widget = qt.QWidget()
                    action_layout = qt.QHBoxLayout()
                    action_widget.setLayout(action_layout)
                    self.action_layout.addWidget(action_widget)

                    
                    
                    label = qt.QLabel()
                    label.setText(node.label)
                    action_layout.addWidget(label)
                    success_button = qt.QPushButton('SUCCESS')
                    success_button.setStyleSheet("background-color: rgb(255, 0, 0);")
                    action_layout.addWidget(success_button)
                    running_button = qt.QPushButton('RUNNING')
                    running_button.setStyleSheet("background-color: rgb(255, 0, 0);")
                    action_layout.addWidget(running_button)
                    failure_button = qt.QPushButton('FAILURE')
                    failure_button.setStyleSheet("background-color: rgb(255, 0, 0);")
                    action_layout.addWidget(failure_button)
                    no_message_button = qt.QPushButton('NO MESSAGE')
                    no_message_button.setStyleSheet("background-color: rgb(0, 255, 0);")
                    action_layout.addWidget(no_message_button)
                    
                    success_button.clicked.connect(get_publish_function(action_widget, success_button, [running_button, failure_button, no_message_button], node, Status, Status.SUCCESS))
                    running_button.clicked.connect(get_publish_function(action_widget, running_button, [success_button, failure_button, no_message_button], node, Status, Status.RUNNING))
                    failure_button.clicked.connect(get_publish_function(action_widget, failure_button, [success_button, running_button, no_message_button], node, Status, Status.FAILURE))
                    no_message_button.clicked.connect(get_publish_function(action_widget, no_message_button, [success_button, running_button, failure_button], node, Status, 'NO MESSAGE'))
                elif isinstance(node, bt.Condition):
                    condition_widget = qt.QWidget()
                    condition_layout = qt.QHBoxLayout()
                    condition_widget.setLayout(condition_layout)
                    self.condition_layout.addWidget(condition_widget)
                    
                    label = qt.QLabel()
                    label.setText(node.label)
                    condition_layout.addWidget(label)
                    success_button = qt.QPushButton('SUCCESS')
                    success_button.setStyleSheet("background-color: rgb(255, 0, 0);")
                    condition_layout.addWidget(success_button)
                    failure_button = qt.QPushButton('FAILURE')
                    failure_button.setStyleSheet("background-color: rgb(255, 0, 0);")
                    condition_layout.addWidget(failure_button)
                    no_message_button = qt.QPushButton('NO MESSAGE')
                    no_message_button.setStyleSheet("background-color: rgb(0, 255, 0);")
                    condition_layout.addWidget(no_message_button)
                    
                    success_button.clicked.connect(get_publish_function(condition_widget, success_button, [failure_button, no_message_button], node, Bool, True))
                    failure_button.clicked.connect(get_publish_function(condition_widget, failure_button, [success_button, no_message_button], node, Bool, False))
                    no_message_button.clicked.connect(get_publish_function(condition_widget, no_message_button, [success_button, failure_button], node, Bool, 'NO MESSAGE'))
Example #24
0
    def __init__(self, input_id):
        super(InputWidget, self).__init__()

        self._id = input_id

        self.setLayout(QtWidgets.QHBoxLayout())

        self._id_label = QtWidgets.QLabel("Input " + str(self._id))
        self.layout().addWidget(self._id_label)

        # ---- Input port input ----

        self._input_port_input = QtWidgets.QLineEdit()
        self.port_validator = QtGui.QRegExpValidator(QtCore.QRegExp("[a-z]+[0-9]+"))
        self._input_port_input.setValidator(self.port_validator)
        self.layout().addWidget(self._input_port_input)

        self._input_port_input.setText(str(rospy.get_param(self.get_param_base() + "input", "js" + str(self._id))))
        self._input_port_input.textChanged.connect(self.change_input_port)

        # ---- /Input selector ----

        # ---- Type selector ----

        self._type_selector = QtWidgets.QComboBox()
        self.layout().addWidget(self._type_selector)

        self._type_selector.insertItem(0, "xbox ewoud")
        self._type_selector.insertItem(0, "xbox vision")
        self._type_selector.insertItem(0, "playstation")
        self._type_selector.insertItem(0, "gioteck")

        currentJoyType = rospy.get_param(self.get_param_base() + "joyType", "gioteck");
        self._type_selector.setCurrentIndex(self._type_selector.findText(currentJoyType))

        self._type_selector.currentIndexChanged.connect(self.change_input_type)

        # ---- /Type selector ----

        self._robot_id_label = QtWidgets.QLabel("Robot id")
        self.layout().addWidget(self._robot_id_label)

        # --- Robot id input ----

        self._robot_id_input = QtWidgets.QLineEdit()
        self.int_validator = QtGui.QRegExpValidator(QtCore.QRegExp("[0-9]+"))
        self._robot_id_input.setValidator(self.int_validator)
        self.layout().addWidget(self._robot_id_input)

        self._robot_id_input.setText(str(rospy.get_param(self.get_param_base() + "robot", int(self._id))))
        self._robot_id_input.textChanged.connect(self.change_bot_id)

        # --- /Robot id input ----

        # --- Mode selector ----

        self._mode_selector = QtWidgets.QComboBox()
        self.layout().addWidget(self._mode_selector)

        self._mode_selector.insertItem(0, "our keeper")
        self._mode_selector.insertItem(0, "normal")

        currentMode = rospy.get_param(self.get_param_base() + "mode", "normal");
        self._mode_selector.setCurrentIndex(self._mode_selector.findText(currentMode))

        self._mode_selector.currentIndexChanged.connect(self.change_input_mode)
Example #25
0
    def __init__(self, context):
        super(BehaviorTreePlugin, self).__init__(context)
        self.setObjectName('BehaviorTreePlugin')

        self.tree = None

        self.initialized_buttons = False
        self.prev_graphviz = ''
        
        self.behavior_tree_graphviz_sub = rospy.Subscriber('behavior_tree_graphviz', String, self.behavior_tree_graphviz_callback)
        self.timer = rospy.Timer(rospy.Duration(0.1), self.timer_callback)
        self.functions_mutex = Lock()
        self.functions = {}
        self.last_graphviz_string = ''
        
        self.widget = QWidget()
        self.vbox = qt.QVBoxLayout()
        self.widget.setLayout(self.vbox)
        context.add_widget(self.widget)
        #self.widget.setStyleSheet('QWidget{margin-left:-1px;}')

        self.top_widget = qt.QWidget()
        self.top_layout = qt.QVBoxLayout()
        self.top_widget.setLayout(self.top_layout)
        
        self.graph_widget = qt.QWidget()
        self.graph_layout = qt.QVBoxLayout()
        self.graph_widget.setLayout(self.graph_layout)
        self.image_label = qt.QLabel('asdfadsf')
        #self.graph_layout.addWidget(self.image_label)
        self.xdot_widget = DotWidget()
        self.graph_layout.addWidget(self.xdot_widget)
        self.top_layout.addWidget(self.graph_widget)
        self.graph_widget.setStyleSheet("background-color: rgb(255, 255, 255);")
        
        self.config_widget = qt.QWidget()
        self.config_widget.setStyleSheet('QWidget{margin-left:-1px;}')
        self.config_layout = qt.QHBoxLayout()
        self.config_widget.setLayout(self.config_layout)
        self.config_widget.setFixedHeight(50)
        
        self.config_button = qt.QPushButton('Open Config...')
        self.config_button.clicked.connect(self.select_config_file)
        self.config_layout.addWidget(self.config_button)

        self.tree_label = qt.QLabel('tree filename: ')
        self.config_layout.addWidget(self.tree_label)

        self.debug_checkbox = qt.QCheckBox('Debug Mode')
        self.config_layout.addWidget(self.debug_checkbox)
        self.debug_checkbox.stateChanged.connect(self.debug_mode_changed)

        #self.config_widget.setStyleSheet("background-color: rgb(255, 0, 0);")
        self.top_layout.addWidget(self.config_widget)

        #self.vbox.addWidget(self.top_widget)

        self.button_container_widget = qt.QWidget()
        self.button_container_layout = qt.QVBoxLayout()
        self.button_container_widget.setLayout(self.button_container_layout)
        #self.vbox.addWidget(self.button_container_widget)
        
        self.button_widget = qt.QWidget()
        self.button_layout = qt.QHBoxLayout()
        self.button_widget.setLayout(self.button_layout)
        #self.button_widget.setStyleSheet("background-color: rgb(0, 0, 255);")

        
        self.condition_widget = qt.QWidget()
        self.condition_layout = qt.QVBoxLayout()
        self.condition_widget.setLayout(self.condition_layout)
        self.button_layout.addWidget(self.condition_widget)
        
        self.condition_label = qt.QLabel()
        self.condition_label.setText('Conditions')
        self.condition_label.setAlignment(Qt.AlignCenter)
        self.condition_label.setFont(gui.QFont("SansSerif", 18, gui.QFont.Bold))
        self.condition_layout.addWidget(self.condition_label)
        
        self.action_widget = qt.QWidget()
        self.action_layout = qt.QVBoxLayout()
        self.action_widget.setLayout(self.action_layout)
        self.button_layout.addWidget(self.action_widget)
        
        self.action_label = qt.QLabel()
        self.action_label.setText('Actions')
        self.action_label.setAlignment(Qt.AlignCenter)
        self.action_label.setFont(gui.QFont("SansSerif", 18, gui.QFont.Bold))
        self.action_layout.addWidget(self.action_label)
        
        self.button_scroll_area = qt.QScrollArea()
        self.button_scroll_area.setWidget(self.button_widget)
        #self.button_scroll_area.setFixedHeight(200)
        #self.button_container_widget.setFixedHeight(200)
        self.button_container_layout.addWidget(self.button_scroll_area)
        self.button_widget.setMinimumWidth(self.button_scroll_area.sizeHint().width())
        self.button_scroll_area.setWidgetResizable(True)
        
        self.horizontal_splitter = qt.QSplitter(core.Qt.Vertical)
        self.horizontal_splitter.addWidget(self.top_widget)
        self.horizontal_splitter.addWidget(self.button_container_widget)
        self.vbox.addWidget(self.horizontal_splitter)

        self.button_container_widget.hide()
Example #26
0
    def __init__(self):
        super(ManualWindow, self).__init__()
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.ui = '../forms/manual.ui'
        loadUi(self.ui, self)
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)

        self.layout = self.findChild(QtWidgets.QGridLayout, 'layout')

        self.mode = JOYSTICK_ONLY_MODE

        self.visual_frame = rviz.VisualizationFrame()
        self.visual_frame.setSplashPath("")
        self.visual_frame.initialize()
        self.add_rviz_config()

        self.visual_frame.setMenuBar(None)
        self.visual_frame.setStatusBar(None)
        self.visual_frame.setHideButtonVisibility(False)

        self.layout.addWidget(self.visual_frame)
        self.visual_frame.hide()

        self.manager = self.visual_frame.getManager()
        self.grid_display = self.manager.getRootDisplayGroup().getDisplayAt(0)

        self.video_frame = QtWidgets.QLabel()
        video_frame_font = QtGui.QFont("Verdana", 62, QtGui.QFont.Bold)
        self.video_frame.setFont(video_frame_font)
        self.video_frame.setText("No video frame")
        self.video_frame.setAlignment(QtCore.Qt.AlignCenter)
        self.video_frame.hide()
        self.layout.addWidget(self.video_frame)

        self.joystick_frame = QtWidgets.QLabel()
        pixmap = QtGui.QPixmap('../static/img/xbox_controller_grey.png')
        pixmap = pixmap.scaledToWidth(800)
        self.joystick_frame.setPixmap(pixmap)
        self.joystick_frame.setAlignment(QtCore.Qt.AlignCenter)
        self.layout.addWidget(self.joystick_frame)

        # Buttons
        self.change_mode_btn = self.findChild(QtWidgets.QPushButton,
                                              'changeModeBtn')
        self.turn_left = self.findChild(QtWidgets.QToolButton, 'turnRobotLeft')
        self.turn_right = self.findChild(QtWidgets.QToolButton,
                                         'turnRobotRight')
        self.stand_btn = self.findChild(QtWidgets.QPushButton, 'standBtn')
        self.walk_btn = self.findChild(QtWidgets.QPushButton, 'walkBtn')
        self.stairs_btn = self.findChild(QtWidgets.QPushButton, 'stairsBtn')
        self.exit_btn = self.findChild(QtWidgets.QPushButton, 'exitBtn')
        self.powerBtn = self.findChild(QtWidgets.QPushButton, 'powerBtn')
        self.emergency_btn = self.findChild(QtWidgets.QPushButton,
                                            'emergencyBtn')

        # Status indicators
        self.signal_btn = self.findChild(QtWidgets.QPushButton, 'signalBtn')
        self.controller_battery_btn = self.findChild(QtWidgets.QPushButton,
                                                     'controllerBatteryBtn')
        self.battery_btn = self.findChild(QtWidgets.QPushButton, 'batteryBtn')
        self.health_btn = self.findChild(QtWidgets.QPushButton, 'healthBtn')

        # Button connections
        self.emergency_btn.clicked.connect(self.turn_robot_off)
        self.powerBtn.clicked.connect(self.power_on)
        self.exit_btn.clicked.connect(self.close_window)
        self.change_mode_btn.clicked.connect(self.change_mode)

        # Button shortcuts
        self.exit_btn.setShortcut("Ctrl+Q")

        # Mode Layouts
        #self.video_frame = self.findChild(QtWidgets.QLabel, 'videoFrame')
        # self.xbox_controller_frame = self.findChild(
        #    QtWidgets.QLabel, 'xboxcontrollerFrame')
        # self.video_frame.hide()

        # Stylesheets
        self.powerBtn.setStyleSheet(
            "QPushButton#powerBtn:checked {color:black; background-color: red;}"
        )
        self.signal_btn.setStyleSheet(
            "QPushButton#signalBtn:checked {color:black; background-color: green;}"
        )

        self.video_stream_subscriber = VideoStreamSubscriber(
            'camera/image_raw', Image)

        self.show()