Added initial GUI view
This commit is contained in:
parent
388759b8aa
commit
7ab03542d3
@ -3,6 +3,8 @@ import os
|
|||||||
import rospy
|
import rospy
|
||||||
import rospkg
|
import rospkg
|
||||||
|
|
||||||
|
from python_qt_binding.QtGui import QPalette
|
||||||
|
from python_qt_binding.QtWidgets import QPushButton
|
||||||
# from python_qt_binding.QtWidgets import QWidget, QDialog
|
# from python_qt_binding.QtWidgets import QWidget, QDialog
|
||||||
|
|
||||||
class QtWrapper:
|
class QtWrapper:
|
||||||
@ -10,12 +12,26 @@ class QtWrapper:
|
|||||||
def __init__(self,widget):
|
def __init__(self,widget):
|
||||||
|
|
||||||
self.widget = widget
|
self.widget = widget
|
||||||
|
# self.widget.setStyleSheet("background-color:black;")
|
||||||
self.widget.textBrowser.setText('Sukces')
|
# self.widget.setBackgroundRole(QPalette.Button)
|
||||||
|
# self.widget.setStyleSheet("QPushButton { background-color: yellow }")
|
||||||
|
self.widget.logsBrowser.setText('Sukces')
|
||||||
|
|
||||||
def connect_signals(self):
|
def connect_signals(self):
|
||||||
|
# self.widget.openButton.clicked.connect(self.handle_openButton_clicked)
|
||||||
|
self.widget.clutchButton.clicked.connect(self.handle_clutchButton_clicked)
|
||||||
|
|
||||||
|
def set_robot_selection_callback(self,callback):
|
||||||
|
# self.handle_openButton_clicked = callback
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def set_user_stop_state_updated_callback(self,callback):
|
||||||
|
# raise NotImplementedError
|
||||||
|
pass
|
||||||
|
|
||||||
|
def set_clutch_switched_callback(self,callback):
|
||||||
|
self.handle_clutchButton_clicked = callback
|
||||||
|
|
||||||
def select_robot(self,robot_id):
|
def select_robot(self,robot_id):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
@ -54,17 +70,7 @@ class QtWrapper:
|
|||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
def set_robot_selection_callback(self,callback):
|
|
||||||
# raise NotImplementedError
|
|
||||||
pass
|
|
||||||
|
|
||||||
def set_user_stop_state_updated_callback(self,callback):
|
|
||||||
# raise NotImplementedError
|
|
||||||
pass
|
|
||||||
|
|
||||||
def set_clutch_switched_callback(self,callback):
|
|
||||||
# raise NotImplementedError
|
|
||||||
pass
|
|
||||||
|
|
||||||
def connection_to_robot_lost(self,lost_robot_id):
|
def connection_to_robot_lost(self,lost_robot_id):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
@ -36,8 +36,6 @@ class ROSWrapper:
|
|||||||
self.robots_list_timer = None
|
self.robots_list_timer = None
|
||||||
self.connection_timer = None
|
self.connection_timer = None
|
||||||
|
|
||||||
self.setup_subscribers_and_publishers(6)
|
|
||||||
|
|
||||||
def setup_node(self):
|
def setup_node(self):
|
||||||
rospy.init_node('safety_user_plugin', anonymous=True)
|
rospy.init_node('safety_user_plugin', anonymous=True)
|
||||||
|
|
||||||
@ -87,7 +85,7 @@ class ROSWrapper:
|
|||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def handle_robot_connection_lost(self,event):
|
def handle_robot_connection_lost(self,event):
|
||||||
shutdown_timer(self.connection_timer)
|
self.shutdown_timer(self.connection_timer)
|
||||||
self.robot_connection_lost_callback()
|
self.robot_connection_lost_callback()
|
||||||
|
|
||||||
def cancel_subscribers_and_publishers(self):
|
def cancel_subscribers_and_publishers(self):
|
||||||
|
@ -12,11 +12,15 @@ from user_info import UserInfo
|
|||||||
from enums.clutch_state import ClutchState as CS
|
from enums.clutch_state import ClutchState as CS
|
||||||
from enums.stop_state import StopState as SS
|
from enums.stop_state import StopState as SS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class UserPlugin(Plugin):
|
class UserPlugin(Plugin):
|
||||||
|
|
||||||
def __init__(self,context):
|
def __init__(self,context):
|
||||||
super(UserPlugin, self).__init__(context)
|
super(UserPlugin, self).__init__(context)
|
||||||
self.setObjectName('User Plugin - L1.5 safety system')
|
self.setObjectName('User Plugin - L1.5 safety system')
|
||||||
|
# setStyleSheet("background-color:black;")
|
||||||
|
|
||||||
|
|
||||||
self._widget = UserWidget(context)
|
self._widget = UserWidget(context)
|
||||||
self._qt_wrapper = QtWrapper(self._widget)
|
self._qt_wrapper = QtWrapper(self._widget)
|
||||||
@ -35,7 +39,7 @@ class UserPlugin(Plugin):
|
|||||||
self.set_callback_functions()
|
self.set_callback_functions()
|
||||||
|
|
||||||
# At the end!
|
# At the end!
|
||||||
# self._qt_wrapper.connect_signals()
|
self._qt_wrapper.connect_signals()
|
||||||
self._ros_wrapper.set_robots_list_update_callback(self.handle_robots_list_update)
|
self._ros_wrapper.set_robots_list_update_callback(self.handle_robots_list_update)
|
||||||
|
|
||||||
def shutdown_plugin(self):
|
def shutdown_plugin(self):
|
||||||
@ -125,9 +129,12 @@ class UserPlugin(Plugin):
|
|||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def handle_robot_connection_lost(self):
|
def handle_robot_connection_lost(self):
|
||||||
|
if self._user_info.selected_robot != None:
|
||||||
lost_robot_id = self._user_info.selected_robot.robot_id
|
lost_robot_id = self._user_info.selected_robot.robot_id
|
||||||
self.release_robot()
|
self.release_robot()
|
||||||
self._qt_wrapper.connection_to_robot_lost(lost_robot_id)
|
self._qt_wrapper.connection_to_robot_lost(lost_robot_id)
|
||||||
|
else:
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
# Operations
|
# Operations
|
||||||
|
@ -6,33 +6,353 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>950</width>
|
<width>952</width>
|
||||||
<height>798</height>
|
<height>817</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QComboBox" name="comboBox">
|
<property name="autoFillBackground">
|
||||||
<property name="geometry">
|
<bool>true</bool>
|
||||||
<rect>
|
</property>
|
||||||
<x>90</x>
|
<property name="styleSheet">
|
||||||
<y>50</y>
|
<string notr="true"/>
|
||||||
<width>161</width>
|
</property>
|
||||||
<height>31</height>
|
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="3,0,1,0,3,0,0,2">
|
||||||
</rect>
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="2,1">
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="robotsList">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QTextBrowser" name="textBrowser">
|
</item>
|
||||||
<property name="geometry">
|
<item>
|
||||||
<rect>
|
<widget class="QPushButton" name="openButton">
|
||||||
<x>50</x>
|
<property name="sizePolicy">
|
||||||
<y>150</y>
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
<width>256</width>
|
<horstretch>0</horstretch>
|
||||||
<height>192</height>
|
<verstretch>0</verstretch>
|
||||||
</rect>
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>60</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Otwórz</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="4,2,3">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0,0">
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center"><span style=" font-weight:600;">ID robota</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center"><span style=" font-weight:600;">Stan baterii</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center"><span style=" font-weight:600;">Predkosc liniowa</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center"><span style=" font-weight:600;">Predkosc obrotowa</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_9">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center"><span style=" font-weight:600;">Stan sprzegla</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_10">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center"><span style=" font-weight:600;">Stan stopu</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="idLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center">-</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="batteryLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center">-</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="linearLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center">-</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="angularLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center">-</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="clutchLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center">-</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="stateLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center">-</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="distanceLabel">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center">-</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QGraphicsView" name="distanceGraphics">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>50</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLabel" name="linearRestrictionLabel">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center">-</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLabel" name="angularRestrictionLabel">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center">-</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="QLabel" name="label_12">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center"><span style=" font-weight:600;">Ograniczenia</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QGraphicsView" name="angularGrpahics">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>50</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QGraphicsView" name="linearGraphics">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>50</width>
|
||||||
|
<height>50</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="2,1">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="stopButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Zatrzymaj robota</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="clutchButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Sprzeglo ON</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center"><span style=" font-weight:600;">Histora komunikatów</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTextBrowser" name="logsBrowser">
|
||||||
|
<property name="html">
|
||||||
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
|
p, li { white-space: pre-wrap; }
|
||||||
|
</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||||
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
Loading…
Reference in New Issue
Block a user