|
|
@ -8,16 +8,15 @@
|
|
|
|
# run again. Do not edit this file unless you know what you are doing.
|
|
|
|
# run again. Do not edit this file unless you know what you are doing.
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cv2
|
|
|
|
from PyQt5.QtCore import Qt
|
|
|
|
from PyQt5.QtCore import Qt
|
|
|
|
|
|
|
|
from PyQt5.QtGui import QPixmap
|
|
|
|
from PyQt5.QtWidgets import QApplication
|
|
|
|
from PyQt5.QtWidgets import QApplication
|
|
|
|
from PyQt5.QtWidgets import *
|
|
|
|
from PyQt5.QtWidgets import *
|
|
|
|
from findpath_UI import *
|
|
|
|
from findpath_UI import *
|
|
|
|
from app import ScreenBar
|
|
|
|
from app import ScreenBar
|
|
|
|
import qdarkstyle
|
|
|
|
import qdarkstyle
|
|
|
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../../PaddleClas-release-2.3")
|
|
|
|
|
|
|
|
import Tello.KeyboardControl as KeyControl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../../PaddleClas-release-2.3")
|
|
|
|
|
|
|
|
import Tello.KeyboardControl as KeyControl
|
|
|
|
import Tello.KeyboardControl as KeyControl
|
|
|
|
|
|
|
|
|
|
|
|
class Ui_MainWindow(object):
|
|
|
|
class Ui_MainWindow(object):
|
|
|
@ -35,55 +34,58 @@ class Ui_MainWindow(object):
|
|
|
|
self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
|
|
|
self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
|
|
|
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
|
|
|
|
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
|
|
|
|
self.frame.setObjectName("frame")
|
|
|
|
self.frame.setObjectName("frame")
|
|
|
|
self.label = QtWidgets.QLabel(self.frame)
|
|
|
|
#设置无人机状态
|
|
|
|
self.label.setGeometry(QtCore.QRect(0, 0, 111, 25))
|
|
|
|
self.tellostate = QtWidgets.QLabel(self.frame)
|
|
|
|
|
|
|
|
self.tellostate.setGeometry(QtCore.QRect(0, 0, 111, 25))
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setFamily("微软雅黑")
|
|
|
|
font.setFamily("微软雅黑")
|
|
|
|
font.setPointSize(14)
|
|
|
|
font.setPointSize(14)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setWeight(75)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.label.setFont(font)
|
|
|
|
self.tellostate.setFont(font)
|
|
|
|
self.label.setStyleSheet("QLabel\n"
|
|
|
|
self.tellostate.setStyleSheet("QLabel\n"
|
|
|
|
"{\n"
|
|
|
|
"{\n"
|
|
|
|
" color:white\n"
|
|
|
|
" color:white\n"
|
|
|
|
"}")
|
|
|
|
"}")
|
|
|
|
self.label.setObjectName("label")
|
|
|
|
self.tellostate.setObjectName("tellostate")
|
|
|
|
self.label_2 = QtWidgets.QLabel(self.frame)
|
|
|
|
#设置充电状态
|
|
|
|
self.label_2.setGeometry(QtCore.QRect(20, 30, 341, 41))
|
|
|
|
self.charge = QtWidgets.QLabel(self.frame)
|
|
|
|
|
|
|
|
self.charge.setGeometry(QtCore.QRect(20, 30, 341, 41))
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setFamily("微软雅黑")
|
|
|
|
font.setFamily("微软雅黑")
|
|
|
|
font.setPointSize(10)
|
|
|
|
font.setPointSize(10)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setWeight(75)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.label_2.setFont(font)
|
|
|
|
self.charge.setFont(font)
|
|
|
|
self.label_2.setObjectName("label_2")
|
|
|
|
self.charge.setObjectName("charge")
|
|
|
|
self.label_7 = QtWidgets.QLabel(self.frame)
|
|
|
|
self.chargetxt = QtWidgets.QLabel(self.frame)
|
|
|
|
self.label_7.setGeometry(QtCore.QRect(100, 30, 341, 41))
|
|
|
|
self.chargetxt.setGeometry(QtCore.QRect(100, 30, 341, 41))
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setFamily("微软雅黑")
|
|
|
|
font.setFamily("微软雅黑")
|
|
|
|
font.setPointSize(10)
|
|
|
|
font.setPointSize(10)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setWeight(75)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.label_7.setFont(font)
|
|
|
|
self.chargetxt.setFont(font)
|
|
|
|
self.label_7.setObjectName("label_7")
|
|
|
|
self.chargetxt.setObjectName("chargetxt")
|
|
|
|
self.label_3 = QtWidgets.QLabel(self.frame)
|
|
|
|
#设置WIFI状态
|
|
|
|
self.label_3.setGeometry(QtCore.QRect(20, 100, 341, 41))
|
|
|
|
self.Wifi = QtWidgets.QLabel(self.frame)
|
|
|
|
|
|
|
|
self.Wifi.setGeometry(QtCore.QRect(20, 100, 341, 41))
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setFamily("微软雅黑")
|
|
|
|
font.setFamily("微软雅黑")
|
|
|
|
font.setPointSize(10)
|
|
|
|
font.setPointSize(10)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setWeight(75)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.label_3.setFont(font)
|
|
|
|
self.Wifi.setFont(font)
|
|
|
|
self.label_3.setObjectName("label_3")
|
|
|
|
self.Wifi.setObjectName("Wifi")
|
|
|
|
self.label_8 = QtWidgets.QLabel(self.frame)
|
|
|
|
self.Wifitxt = QtWidgets.QLabel(self.frame)
|
|
|
|
self.label_8.setGeometry(QtCore.QRect(100, 100, 341, 41))
|
|
|
|
self.Wifitxt.setGeometry(QtCore.QRect(100, 100, 341, 41))
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setFamily("微软雅黑")
|
|
|
|
font.setFamily("微软雅黑")
|
|
|
|
font.setPointSize(10)
|
|
|
|
font.setPointSize(10)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setWeight(75)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.label_8.setFont(font)
|
|
|
|
self.Wifitxt.setFont(font)
|
|
|
|
self.label_8.setObjectName("label_8")
|
|
|
|
self.Wifitxt.setObjectName("Wifitxt")
|
|
|
|
self.frame_2 = QtWidgets.QFrame(self.centralwidget)
|
|
|
|
self.frame_2 = QtWidgets.QFrame(self.centralwidget)
|
|
|
|
self.frame_2.setGeometry(QtCore.QRect(840, 250, 391, 421))
|
|
|
|
self.frame_2.setGeometry(QtCore.QRect(840, 250, 391, 421))
|
|
|
|
self.frame_2.setStyleSheet("QPushButton\n"
|
|
|
|
self.frame_2.setStyleSheet("QPushButton\n"
|
|
|
@ -93,33 +95,34 @@ class Ui_MainWindow(object):
|
|
|
|
self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
|
|
|
self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
|
|
|
self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised)
|
|
|
|
self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised)
|
|
|
|
self.frame_2.setObjectName("frame_2")
|
|
|
|
self.frame_2.setObjectName("frame_2")
|
|
|
|
self.label_4 = QtWidgets.QLabel(self.frame_2)
|
|
|
|
#设置无人机控制部分
|
|
|
|
self.label_4.setGeometry(QtCore.QRect(0, 0, 101, 31))
|
|
|
|
self.tellocontrol = QtWidgets.QLabel(self.frame_2)
|
|
|
|
|
|
|
|
self.tellocontrol.setGeometry(QtCore.QRect(0, 0, 101, 31))
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setFamily("微软雅黑")
|
|
|
|
font.setFamily("微软雅黑")
|
|
|
|
font.setPointSize(14)
|
|
|
|
font.setPointSize(14)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setWeight(75)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.label_4.setFont(font)
|
|
|
|
self.tellocontrol.setFont(font)
|
|
|
|
self.label_4.setStyleSheet("QLabel\n"
|
|
|
|
self.tellocontrol.setStyleSheet("QLabel\n"
|
|
|
|
"{\n"
|
|
|
|
"{\n"
|
|
|
|
" color:white\n"
|
|
|
|
" color:white\n"
|
|
|
|
"}\n"
|
|
|
|
"}\n"
|
|
|
|
"")
|
|
|
|
"")
|
|
|
|
self.label_4.setObjectName("label_4")
|
|
|
|
self.tellocontrol.setObjectName("tellocontrol")
|
|
|
|
self.pushButton_3 = QtWidgets.QPushButton(self.frame_2)
|
|
|
|
self.btn_tello_up = QtWidgets.QPushButton(self.frame_2)
|
|
|
|
self.pushButton_3.setGeometry(QtCore.QRect(60, 30, 231, 91))
|
|
|
|
self.btn_tello_up.setGeometry(QtCore.QRect(60, 30, 231, 91))
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setFamily("Arial")
|
|
|
|
font.setFamily("Arial")
|
|
|
|
font.setPointSize(10)
|
|
|
|
font.setPointSize(10)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setWeight(75)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.pushButton_3.setFont(font)
|
|
|
|
self.btn_tello_up.setFont(font)
|
|
|
|
icon1 = QtGui.QIcon()
|
|
|
|
icon1 = QtGui.QIcon()
|
|
|
|
icon1.addPixmap(QtGui.QPixmap("tello_png/qifei.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
icon1.addPixmap(QtGui.QPixmap("tello_png/qifei.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
self.pushButton_3.setIcon(icon1)
|
|
|
|
self.btn_tello_up.setIcon(icon1)
|
|
|
|
self.pushButton_3.setIconSize(QtCore.QSize(150, 150))
|
|
|
|
self.btn_tello_up.setIconSize(QtCore.QSize(150, 150))
|
|
|
|
self.pushButton_3.setObjectName("pushButton_3")
|
|
|
|
self.btn_tello_up.setObjectName("btn_tello_up")
|
|
|
|
self.upload = QtWidgets.QPushButton(self.frame_2)
|
|
|
|
self.upload = QtWidgets.QPushButton(self.frame_2)
|
|
|
|
self.upload.setGeometry(QtCore.QRect(300, 30, 50, 180))
|
|
|
|
self.upload.setGeometry(QtCore.QRect(300, 30, 50, 180))
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font = QtGui.QFont()
|
|
|
@ -138,105 +141,107 @@ class Ui_MainWindow(object):
|
|
|
|
font.setWeight(75)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.download.setFont(font)
|
|
|
|
self.download.setFont(font)
|
|
|
|
self.download.setObjectName("download")
|
|
|
|
self.download.setObjectName("download")
|
|
|
|
self.pushButton_6 = QtWidgets.QPushButton(self.frame_2)
|
|
|
|
self.btn_tello_down = QtWidgets.QPushButton(self.frame_2)
|
|
|
|
self.pushButton_6.setGeometry(QtCore.QRect(60, 310, 231, 91))
|
|
|
|
self.btn_tello_down.setGeometry(QtCore.QRect(60, 310, 231, 91))
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setFamily("Arial")
|
|
|
|
font.setFamily("Arial")
|
|
|
|
font.setPointSize(10)
|
|
|
|
font.setPointSize(10)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setItalic(False)
|
|
|
|
font.setItalic(False)
|
|
|
|
font.setWeight(75)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.pushButton_6.setFont(font)
|
|
|
|
self.btn_tello_down.setFont(font)
|
|
|
|
icon2 = QtGui.QIcon()
|
|
|
|
icon2 = QtGui.QIcon()
|
|
|
|
icon2.addPixmap(QtGui.QPixmap("tello_png/jiangluo.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
icon2.addPixmap(QtGui.QPixmap("tello_png/jiangluo.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
self.pushButton_6.setIcon(icon2)
|
|
|
|
self.btn_tello_down.setIcon(icon2)
|
|
|
|
self.pushButton_6.setIconSize(QtCore.QSize(150, 150))
|
|
|
|
self.btn_tello_down.setIconSize(QtCore.QSize(150, 150))
|
|
|
|
self.pushButton_6.setObjectName("pushButton_6")
|
|
|
|
self.btn_tello_down.setObjectName("btn_tello_down")
|
|
|
|
self.pushButton_4 = QtWidgets.QPushButton(self.frame_2)
|
|
|
|
self.btn_tello_right = QtWidgets.QPushButton(self.frame_2)
|
|
|
|
self.pushButton_4.setGeometry(QtCore.QRect(220, 220, 71, 71))
|
|
|
|
self.btn_tello_right.setGeometry(QtCore.QRect(220, 220, 71, 71))
|
|
|
|
self.pushButton_4.setText("")
|
|
|
|
self.btn_tello_right.setText("")
|
|
|
|
icon3 = QtGui.QIcon()
|
|
|
|
icon3 = QtGui.QIcon()
|
|
|
|
icon3.addPixmap(QtGui.QPixmap("tello_png/right.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
icon3.addPixmap(QtGui.QPixmap("tello_png/right.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
self.pushButton_4.setIcon(icon3)
|
|
|
|
self.btn_tello_right.setIcon(icon3)
|
|
|
|
self.pushButton_4.setIconSize(QtCore.QSize(70, 100))
|
|
|
|
self.btn_tello_right.setIconSize(QtCore.QSize(70, 100))
|
|
|
|
self.pushButton_4.setObjectName("pushButton_4")
|
|
|
|
self.btn_tello_right.setObjectName("btn_tello_right")
|
|
|
|
self.pushButton_2 = QtWidgets.QPushButton(self.frame_2)
|
|
|
|
self.btn_tello_left = QtWidgets.QPushButton(self.frame_2)
|
|
|
|
self.pushButton_2.setGeometry(QtCore.QRect(60, 220, 71, 71))
|
|
|
|
self.btn_tello_left.setGeometry(QtCore.QRect(60, 220, 71, 71))
|
|
|
|
self.pushButton_2.setText("")
|
|
|
|
self.btn_tello_left.setText("")
|
|
|
|
icon4 = QtGui.QIcon()
|
|
|
|
icon4 = QtGui.QIcon()
|
|
|
|
icon4.addPixmap(QtGui.QPixmap("tello_png/left.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
icon4.addPixmap(QtGui.QPixmap("tello_png/left.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
self.pushButton_2.setIcon(icon4)
|
|
|
|
self.btn_tello_left.setIcon(icon4)
|
|
|
|
self.pushButton_2.setIconSize(QtCore.QSize(70, 100))
|
|
|
|
self.btn_tello_left.setIconSize(QtCore.QSize(70, 100))
|
|
|
|
self.pushButton_2.setObjectName("pushButton_2")
|
|
|
|
self.btn_tello_left.setObjectName("btn_tello_left")
|
|
|
|
self.pushButton_5 = QtWidgets.QPushButton(self.frame_2)
|
|
|
|
self.btn_tello_hold = QtWidgets.QPushButton(self.frame_2)
|
|
|
|
self.pushButton_5.setGeometry(QtCore.QRect(140, 220, 71, 71))
|
|
|
|
self.btn_tello_hold.setGeometry(QtCore.QRect(140, 220, 71, 71))
|
|
|
|
self.pushButton_5.setText("")
|
|
|
|
self.btn_tello_hold.setText("")
|
|
|
|
icon5 = QtGui.QIcon()
|
|
|
|
icon5 = QtGui.QIcon()
|
|
|
|
icon5.addPixmap(QtGui.QPixmap("tello_png/hold.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
icon5.addPixmap(QtGui.QPixmap("tello_png/hold.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
self.pushButton_5.setIcon(icon5)
|
|
|
|
self.btn_tello_hold.setIcon(icon5)
|
|
|
|
self.pushButton_5.setIconSize(QtCore.QSize(70, 100))
|
|
|
|
self.btn_tello_hold.setIconSize(QtCore.QSize(70, 100))
|
|
|
|
self.pushButton_5.setObjectName("pushButton_5")
|
|
|
|
self.btn_tello_hold.setObjectName("btn_tello_hold")
|
|
|
|
self.pushButton = QtWidgets.QPushButton(self.frame_2)
|
|
|
|
self.btn_tello_forward = QtWidgets.QPushButton(self.frame_2)
|
|
|
|
self.pushButton.setGeometry(QtCore.QRect(140, 140, 71, 71))
|
|
|
|
self.btn_tello_forward.setGeometry(QtCore.QRect(140, 140, 71, 71))
|
|
|
|
self.pushButton.setText("")
|
|
|
|
self.btn_tello_forward.setText("")
|
|
|
|
icon6 = QtGui.QIcon()
|
|
|
|
icon6 = QtGui.QIcon()
|
|
|
|
icon6.addPixmap(QtGui.QPixmap("tello_png/up.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
icon6.addPixmap(QtGui.QPixmap("tello_png/up.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
self.pushButton.setIcon(icon6)
|
|
|
|
self.btn_tello_forward.setIcon(icon6)
|
|
|
|
self.pushButton.setIconSize(QtCore.QSize(70, 100))
|
|
|
|
self.btn_tello_forward.setIconSize(QtCore.QSize(70, 100))
|
|
|
|
self.pushButton.setObjectName("pushButton")
|
|
|
|
self.btn_tello_forward.setObjectName("btn_tello_forward")
|
|
|
|
self.pushButton_8 = QtWidgets.QPushButton(self.frame_2)
|
|
|
|
self.btn_tello_turnright = QtWidgets.QPushButton(self.frame_2)
|
|
|
|
self.pushButton_8.setGeometry(QtCore.QRect(220, 140, 71, 71))
|
|
|
|
self.btn_tello_turnright.setGeometry(QtCore.QRect(220, 140, 71, 71))
|
|
|
|
self.pushButton_8.setText("")
|
|
|
|
self.btn_tello_turnright.setText("")
|
|
|
|
icon6 = QtGui.QIcon()
|
|
|
|
icon6 = QtGui.QIcon()
|
|
|
|
icon6.addPixmap(QtGui.QPixmap("tello_png/return.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
icon6.addPixmap(QtGui.QPixmap("tello_png/return.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
self.pushButton_8.setIcon(icon6)
|
|
|
|
self.btn_tello_turnright.setIcon(icon6)
|
|
|
|
self.pushButton_8.setIconSize(QtCore.QSize(70, 100))
|
|
|
|
self.btn_tello_turnright.setIconSize(QtCore.QSize(70, 100))
|
|
|
|
self.pushButton_8.setObjectName("pushButton_8")
|
|
|
|
self.btn_tello_turnright.setObjectName("btn_tello_turnright")
|
|
|
|
self.pushButton_9 = QtWidgets.QPushButton(self.frame_2)
|
|
|
|
self.btn_tello_turnleft = QtWidgets.QPushButton(self.frame_2)
|
|
|
|
self.pushButton_9.setGeometry(QtCore.QRect(60, 140, 71, 71))
|
|
|
|
self.btn_tello_turnleft.setGeometry(QtCore.QRect(60, 140, 71, 71))
|
|
|
|
self.pushButton_9.setText("")
|
|
|
|
self.btn_tello_turnleft.setText("")
|
|
|
|
icon6 = QtGui.QIcon()
|
|
|
|
icon6 = QtGui.QIcon()
|
|
|
|
icon6.addPixmap(QtGui.QPixmap("tello_png/return_2.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
icon6.addPixmap(QtGui.QPixmap("tello_png/return_2.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
self.pushButton_9.setIcon(icon6)
|
|
|
|
self.btn_tello_turnleft.setIcon(icon6)
|
|
|
|
self.pushButton_9.setIconSize(QtCore.QSize(70, 100))
|
|
|
|
self.btn_tello_turnleft.setIconSize(QtCore.QSize(70, 100))
|
|
|
|
self.pushButton_9.setObjectName("pushButton_9")
|
|
|
|
self.btn_tello_turnleft.setObjectName("btn_tello_turnleft")
|
|
|
|
|
|
|
|
#设置无人机连接部分
|
|
|
|
self.frame_3 = QtWidgets.QFrame(self.centralwidget)
|
|
|
|
self.frame_3 = QtWidgets.QFrame(self.centralwidget)
|
|
|
|
self.frame_3.setGeometry(QtCore.QRect(840, 680, 391, 80))
|
|
|
|
self.frame_3.setGeometry(QtCore.QRect(840, 680, 391, 80))
|
|
|
|
self.frame_3.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
|
|
|
self.frame_3.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
|
|
|
self.frame_3.setFrameShadow(QtWidgets.QFrame.Raised)
|
|
|
|
self.frame_3.setFrameShadow(QtWidgets.QFrame.Raised)
|
|
|
|
self.frame_3.setObjectName("frame_3")
|
|
|
|
self.frame_3.setObjectName("frame_3")
|
|
|
|
self.pushButton_7 = QtWidgets.QPushButton(self.frame_3)
|
|
|
|
self.btn_tello_connect = QtWidgets.QPushButton(self.frame_3)
|
|
|
|
self.pushButton_7.setGeometry(QtCore.QRect(20, 10, 75, 61))
|
|
|
|
self.btn_tello_connect.setGeometry(QtCore.QRect(20, 10, 75, 61))
|
|
|
|
self.pushButton_7.setText("")
|
|
|
|
self.btn_tello_connect.setText("")
|
|
|
|
icon7 = QtGui.QIcon()
|
|
|
|
icon7 = QtGui.QIcon()
|
|
|
|
icon7.addPixmap(QtGui.QPixmap("window_png/连接.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
icon7.addPixmap(QtGui.QPixmap("window_png/连接.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
self.pushButton_7.setIcon(icon7)
|
|
|
|
self.btn_tello_connect.setIcon(icon7)
|
|
|
|
self.pushButton_7.setIconSize(QtCore.QSize(60, 60))
|
|
|
|
self.btn_tello_connect.setIconSize(QtCore.QSize(60, 60))
|
|
|
|
self.pushButton_7.setObjectName("pushButton_7")
|
|
|
|
self.btn_tello_connect.setObjectName("btn_tello_connect")
|
|
|
|
self.label_5 = QtWidgets.QLabel(self.frame_3)
|
|
|
|
self.connectstate = QtWidgets.QLabel(self.frame_3)
|
|
|
|
self.label_5.setGeometry(QtCore.QRect(120, 15, 231, 51))
|
|
|
|
self.connectstate.setGeometry(QtCore.QRect(120, 15, 231, 51))
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setFamily("微软雅黑")
|
|
|
|
font.setFamily("微软雅黑")
|
|
|
|
font.setPointSize(10)
|
|
|
|
font.setPointSize(10)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setWeight(75)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.label_5.setFont(font)
|
|
|
|
self.connectstate.setFont(font)
|
|
|
|
self.label_5.setObjectName("label_5")
|
|
|
|
self.connectstate.setObjectName("connectstate")
|
|
|
|
self.label_6 = QtWidgets.QLabel(self.frame_3)
|
|
|
|
self.connecttxt = QtWidgets.QLabel(self.frame_3)
|
|
|
|
self.label_6.setGeometry(QtCore.QRect(200, 15, 231, 51))
|
|
|
|
self.connecttxt.setGeometry(QtCore.QRect(200, 15, 231, 51))
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setFamily("微软雅黑")
|
|
|
|
font.setFamily("微软雅黑")
|
|
|
|
font.setPointSize(10)
|
|
|
|
font.setPointSize(10)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setWeight(75)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.label_6.setFont(font)
|
|
|
|
self.connecttxt.setFont(font)
|
|
|
|
self.label_6.setStyleSheet("QLabel\n"
|
|
|
|
self.connecttxt.setStyleSheet("QLabel\n"
|
|
|
|
"{\n"
|
|
|
|
"{\n"
|
|
|
|
" color:red\n"
|
|
|
|
" color:red\n"
|
|
|
|
"}\n"
|
|
|
|
"}\n"
|
|
|
|
"")
|
|
|
|
"")
|
|
|
|
self.label_6.setObjectName("label_6")
|
|
|
|
self.connecttxt.setObjectName("connecttxt")
|
|
|
|
MainWindow.setCentralWidget(self.centralwidget)
|
|
|
|
MainWindow.setCentralWidget(self.centralwidget)
|
|
|
|
|
|
|
|
#上方工具栏
|
|
|
|
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
|
|
|
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
|
|
|
self.menubar.setGeometry(QtCore.QRect(0, 0, 1260, 23))
|
|
|
|
self.menubar.setGeometry(QtCore.QRect(0, 0, 1260, 23))
|
|
|
|
self.menubar.setObjectName("menubar")
|
|
|
|
self.menubar.setObjectName("menubar")
|
|
|
@ -253,100 +258,103 @@ class Ui_MainWindow(object):
|
|
|
|
self.toolBar.setIconSize(QtCore.QSize(50, 24))
|
|
|
|
self.toolBar.setIconSize(QtCore.QSize(50, 24))
|
|
|
|
self.toolBar.setObjectName("toolBar")
|
|
|
|
self.toolBar.setObjectName("toolBar")
|
|
|
|
MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
|
|
|
|
MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
|
|
|
|
self.actionicon = QtWidgets.QAction(MainWindow)
|
|
|
|
self.tello = QtWidgets.QAction(MainWindow)
|
|
|
|
icon8 = QtGui.QIcon()
|
|
|
|
icon8 = QtGui.QIcon()
|
|
|
|
icon8.addPixmap(QtGui.QPixmap("window_png/实时画面-1.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
icon8.addPixmap(QtGui.QPixmap("window_png/实时画面-1.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
self.actionicon.setIcon(icon8)
|
|
|
|
self.tello.setIcon(icon8)
|
|
|
|
self.actionicon.setObjectName("actionicon")
|
|
|
|
self.tello.setObjectName("tello")
|
|
|
|
self.actionicon_2 = QtWidgets.QAction(MainWindow)
|
|
|
|
self.pathfind = QtWidgets.QAction(MainWindow)
|
|
|
|
icon9 = QtGui.QIcon()
|
|
|
|
icon9 = QtGui.QIcon()
|
|
|
|
icon9.addPixmap(QtGui.QPixmap("window_png/路径分析-1.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
icon9.addPixmap(QtGui.QPixmap("window_png/路径分析-1.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
self.actionicon_2.setIcon(icon9)
|
|
|
|
self.pathfind.setIcon(icon9)
|
|
|
|
self.actionicon_2.setObjectName("actionicon_2")
|
|
|
|
self.pathfind.setObjectName("pathfind")
|
|
|
|
self.actionicon_3 = QtWidgets.QAction(MainWindow)
|
|
|
|
self.screenshot = QtWidgets.QAction(MainWindow)
|
|
|
|
icon10 = QtGui.QIcon()
|
|
|
|
icon10 = QtGui.QIcon()
|
|
|
|
icon10.addPixmap(QtGui.QPixmap("window_png/录像.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
icon10.addPixmap(QtGui.QPixmap("window_png/录像.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
|
|
self.actionicon_3.setIcon(icon10)
|
|
|
|
self.screenshot.setIcon(icon10)
|
|
|
|
self.actionicon_3.setObjectName("actionicon_3")
|
|
|
|
self.screenshot.setObjectName("screenshot")
|
|
|
|
self.menubar.addAction(self.menu.menuAction())
|
|
|
|
self.menubar.addAction(self.menu.menuAction())
|
|
|
|
self.menubar.addAction(self.menu_2.menuAction())
|
|
|
|
self.menubar.addAction(self.menu_2.menuAction())
|
|
|
|
self.toolBar.addAction(self.actionicon)
|
|
|
|
self.toolBar.addAction(self.tello)
|
|
|
|
self.toolBar.addAction(self.actionicon_2)
|
|
|
|
self.toolBar.addAction(self.pathfind)
|
|
|
|
self.toolBar.addAction(self.actionicon_3)
|
|
|
|
self.toolBar.addAction(self.screenshot)
|
|
|
|
|
|
|
|
self.img_label = QtWidgets.QLabel()
|
|
|
|
self.connect_flag = False
|
|
|
|
self.connect_flag = False
|
|
|
|
self.actionicon_2.triggered.connect(lambda: self.path())
|
|
|
|
#槽函数部分
|
|
|
|
self.actionicon_3.triggered.connect(lambda: self.video())
|
|
|
|
self.pathfind.triggered.connect(lambda: self.path())
|
|
|
|
self.pushButton_7.clicked.connect(lambda: self.connect())
|
|
|
|
self.screenshot.triggered.connect(lambda: self.video())
|
|
|
|
self.pushButton_3.clicked.connect(lambda: self.up())
|
|
|
|
self.btn_tello_connect.clicked.connect(lambda: self.connect())
|
|
|
|
self.pushButton_6.clicked.connect(lambda: self.down())
|
|
|
|
self.btn_tello_up.clicked.connect(lambda: self.up())
|
|
|
|
self.pushButton.clicked.connect(lambda: self.forward())
|
|
|
|
self.btn_tello_down.clicked.connect(lambda: self.down())
|
|
|
|
self.pushButton_4.clicked.connect(lambda: self.right())
|
|
|
|
self.btn_tello_forward.clicked.connect(lambda: self.forward())
|
|
|
|
self.pushButton_2.clicked.connect(lambda: self.left())
|
|
|
|
self.btn_tello_right.clicked.connect(lambda: self.right())
|
|
|
|
self.pushButton_5.clicked.connect(lambda: self.Return())
|
|
|
|
self.btn_tello_left.clicked.connect(lambda: self.left())
|
|
|
|
|
|
|
|
self.btn_tello_hold.clicked.connect(lambda: self.Return())
|
|
|
|
self.retranslateUi(MainWindow)
|
|
|
|
self.retranslateUi(MainWindow)
|
|
|
|
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
|
|
|
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
|
|
|
|
|
|
|
#点击路径分析事件
|
|
|
|
def path(self):
|
|
|
|
def path(self):
|
|
|
|
self.MainWindow1 = QMainWindow()
|
|
|
|
self.MainWindow1 = QMainWindow()
|
|
|
|
ui = Ui_MainWindow1()
|
|
|
|
ui = Ui_MainWindow1()
|
|
|
|
ui.setupUi(self.MainWindow1)
|
|
|
|
ui.setupUi(self.MainWindow1)
|
|
|
|
self.MainWindow1.show()
|
|
|
|
self.MainWindow1.show()
|
|
|
|
|
|
|
|
#点击屏幕录制事件
|
|
|
|
def video(self):
|
|
|
|
def video(self):
|
|
|
|
bar.show()
|
|
|
|
bar.show()
|
|
|
|
|
|
|
|
#点击连接无人机事件
|
|
|
|
def connect(self):
|
|
|
|
def connect(self):
|
|
|
|
self.connect_flag = True
|
|
|
|
self.connect_flag = True
|
|
|
|
self.label_6.setStyleSheet("QLabel\n"
|
|
|
|
self.connecttxt.setStyleSheet("QLabel\n"
|
|
|
|
"{\n"
|
|
|
|
"{\n"
|
|
|
|
" color:green\n"
|
|
|
|
" color:green\n"
|
|
|
|
"}\n"
|
|
|
|
"}\n"
|
|
|
|
"")
|
|
|
|
"")
|
|
|
|
self.label_6.setText("已连接")
|
|
|
|
self.connecttxt.setText("已连接")
|
|
|
|
self.label_7.setStyleSheet("QLabel\n"
|
|
|
|
self.chargetxt.setStyleSheet("QLabel\n"
|
|
|
|
"{\n"
|
|
|
|
"{\n"
|
|
|
|
" color:green\n"
|
|
|
|
" color:green\n"
|
|
|
|
"}\n"
|
|
|
|
"}\n"
|
|
|
|
"")
|
|
|
|
"")
|
|
|
|
self.label_7.setText("100%")
|
|
|
|
self.chargetxt.setText("100%")
|
|
|
|
self.label_8.setStyleSheet("QLabel\n"
|
|
|
|
self.Wifitxt.setStyleSheet("QLabel\n"
|
|
|
|
"{\n"
|
|
|
|
"{\n"
|
|
|
|
" color:green\n"
|
|
|
|
" color:green\n"
|
|
|
|
"}\n"
|
|
|
|
"}\n"
|
|
|
|
"")
|
|
|
|
"")
|
|
|
|
self.label_8.setText("强")
|
|
|
|
self.Wifitxt.setText("强")
|
|
|
|
KeyControl.connect()
|
|
|
|
KeyControl.connect()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#点击无人机起飞事件
|
|
|
|
def up(self):
|
|
|
|
def up(self):
|
|
|
|
if self.connect_flag:
|
|
|
|
if self.connect_flag:
|
|
|
|
KeyControl.getKeyboardInput("UP")
|
|
|
|
KeyControl.getKeyboardInput("UP")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
#点击无人机降落事件
|
|
|
|
def down(self):
|
|
|
|
def down(self):
|
|
|
|
if self.connect_flag:
|
|
|
|
if self.connect_flag:
|
|
|
|
KeyControl.getKeyboardInput("DOWN")
|
|
|
|
KeyControl.getKeyboardInput("DOWN")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
#点击无人机前进事件
|
|
|
|
def forward(self):
|
|
|
|
def forward(self):
|
|
|
|
if self.connect_flag:
|
|
|
|
if self.connect_flag:
|
|
|
|
KeyControl.getKeyboardInput("i")
|
|
|
|
KeyControl.getKeyboardInput("i")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
#点击无人机右偏事件
|
|
|
|
def right(self):
|
|
|
|
def right(self):
|
|
|
|
if self.connect_flag:
|
|
|
|
if self.connect_flag:
|
|
|
|
KeyControl.getKeyboardInput("l")
|
|
|
|
KeyControl.getKeyboardInput("l")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
#点击无人机左偏事件
|
|
|
|
def left(self):
|
|
|
|
def left(self):
|
|
|
|
if self.connect_flag:
|
|
|
|
if self.connect_flag:
|
|
|
|
KeyControl.getKeyboardInput("j")
|
|
|
|
KeyControl.getKeyboardInput("j")
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
#点击无人机停止事件
|
|
|
|
def Return(self):
|
|
|
|
def Return(self):
|
|
|
|
if self.connect_flag:
|
|
|
|
if self.connect_flag:
|
|
|
|
KeyControl.getKeyboardInput("a")
|
|
|
|
KeyControl.getKeyboardInput("a")
|
|
|
@ -354,49 +362,27 @@ class Ui_MainWindow(object):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
def connect(self):
|
|
|
|
|
|
|
|
KeyControl.connect()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def up(self):
|
|
|
|
|
|
|
|
KeyControl.getKeyboardInput("UP")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def down(self):
|
|
|
|
|
|
|
|
KeyControl.getKeyboardInput("DOWN")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def forward(self):
|
|
|
|
|
|
|
|
KeyControl.getKeyboardInput("i")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def right(self):
|
|
|
|
|
|
|
|
KeyControl.getKeyboardInput("l")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def left(self):
|
|
|
|
|
|
|
|
KeyControl.getKeyboardInput("j")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def Return(self):
|
|
|
|
|
|
|
|
KeyControl.getKeyboardInput("a")
|
|
|
|
|
|
|
|
KeyControl.getKeyboardInput("dffsfdsa")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def retranslateUi(self, MainWindow):
|
|
|
|
def retranslateUi(self, MainWindow):
|
|
|
|
_translate = QtCore.QCoreApplication.translate
|
|
|
|
_translate = QtCore.QCoreApplication.translate
|
|
|
|
MainWindow.setWindowTitle(_translate("MainWindow", "无人机路径生成系统"))
|
|
|
|
MainWindow.setWindowTitle(_translate("MainWindow", "无人机路径生成系统"))
|
|
|
|
self.label.setText(_translate("MainWindow", "无人机状态"))
|
|
|
|
self.tellostate.setText(_translate("MainWindow", "无人机状态"))
|
|
|
|
self.label_2.setText(_translate("MainWindow", "剩余电量:"))
|
|
|
|
self.charge.setText(_translate("MainWindow", "剩余电量:"))
|
|
|
|
self.label_7.setText(_translate("MainWindow", "--"))
|
|
|
|
self.chargetxt.setText(_translate("MainWindow", "--"))
|
|
|
|
self.label_3.setText(_translate("MainWindow", "WIFI强度:"))
|
|
|
|
self.Wifi.setText(_translate("MainWindow", "WIFI强度:"))
|
|
|
|
self.label_8.setText(_translate("MainWindow", "--"))
|
|
|
|
self.Wifitxt.setText(_translate("MainWindow", "--"))
|
|
|
|
self.label_4.setText(_translate("MainWindow", "控制面板"))
|
|
|
|
self.tellocontrol.setText(_translate("MainWindow", "控制面板"))
|
|
|
|
self.pushButton_3.setText(_translate("MainWindow", "起飞"))
|
|
|
|
self.btn_tello_up.setText(_translate("MainWindow", "起飞"))
|
|
|
|
self.pushButton_6.setText(_translate("MainWindow", "降落"))
|
|
|
|
self.btn_tello_down.setText(_translate("MainWindow", "降落"))
|
|
|
|
self.upload.setText(_translate("MainWindow", "上升"))
|
|
|
|
self.upload.setText(_translate("MainWindow", "上升"))
|
|
|
|
self.download.setText(_translate("MainWindow", "下降"))
|
|
|
|
self.download.setText(_translate("MainWindow", "下降"))
|
|
|
|
self.label_5.setText(_translate("MainWindow", "连接状态:"))
|
|
|
|
self.connectstate.setText(_translate("MainWindow", "连接状态:"))
|
|
|
|
self.label_6.setText(_translate("MainWindow", "未连接"))
|
|
|
|
self.connecttxt.setText(_translate("MainWindow", "未连接"))
|
|
|
|
self.menu.setTitle(_translate("MainWindow", "实时画面"))
|
|
|
|
self.menu.setTitle(_translate("MainWindow", "实时画面"))
|
|
|
|
self.menu_2.setTitle(_translate("MainWindow", "路径分析"))
|
|
|
|
self.menu_2.setTitle(_translate("MainWindow", "路径分析"))
|
|
|
|
self.toolBar.setWindowTitle(_translate("MainWindow", "toolBar"))
|
|
|
|
self.toolBar.setWindowTitle(_translate("MainWindow", "toolBar"))
|
|
|
|
self.actionicon.setText(_translate("MainWindow", "实时画面"))
|
|
|
|
self.tello.setText(_translate("MainWindow", "实时画面"))
|
|
|
|
self.actionicon_2.setText(_translate("MainWindow", "路径分析"))
|
|
|
|
self.pathfind.setText(_translate("MainWindow", "路径分析"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if __name__ == '__main__':
|
|
|
|