def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.setupUi(self) self.teleop = TeleopWidget(self) self.tlLayout.addWidget(self.teleop) self.teleop.setVisible(True) self.record = False self.updGUI.connect(self.updateGUI) self.cameraCheck.stateChanged.connect(self.showCameraWidget) self.sensorsCheck.stateChanged.connect(self.showSensorsWidget) self.rotationDial.valueChanged.connect(self.rotationChange) self.altdSlider.valueChanged.connect(self.altitudeChange) self.cameraWidget = CameraWidget(self) self.sensorsWidget = SensorsWidget(self) self.cameraCommunicator = Communicator() self.trackingCommunicator = Communicator() self.stopButton.clicked.connect(self.stopClicked) self.playButton.clicked.connect(self.playClicked) self.resetButton.clicked.connect(self.resetClicked) self.takeoffButton.clicked.connect(self.takeOffClicked) self.takeoff = False self.reset = False
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.setupUi(self) self.teleop = TeleopWidget(self) self.tlLayout.addWidget(self.teleop) self.teleop.setVisible(True) self.logo = LogoWidget(self, self.logoLayout.parent().width(), self.logoLayout.parent().height()) self.logoLayout.addWidget(self.logo) self.logo.setVisible(True) self.updGUI.connect(self.updateGUI) self.sensorsCheck.stateChanged.connect(self.showSensorsWidget) self.rotationDial.valueChanged.connect(self.rotationChange) self.altdSlider.valueChanged.connect(self.altitudeChange) self.cameraWidget = ColorFilterWidget(self) self.sensorsWidget = SensorsWidget(self) self.changeCamButton.clicked.connect(self.changeCamera) self.trackingCommunicator = Communicator() self.pushButton.clicked.connect(self.pushClicked) self.pushButton.setCheckable(True) self.resetButton.clicked.connect(self.resetClicked) self.takeoffButton.clicked.connect(self.takeOffClicked) self.camera1 = CameraWidget(self) self.takeoff = False self.reset = False self.record = False
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.setupUi(self) self.teleop=TeleopWidget(self) self.tlLayout.addWidget(self.teleop) self.teleop.setVisible(True) self.record = False self.updGUI.connect(self.updateGUI) self.cameraCheck.stateChanged.connect(self.showCameraWidget) self.sensorsCheck.stateChanged.connect(self.showSensorsWidget) self.colorFilterCheck.stateChanged.connect(self.showColorFilterWidget) self.rotationDial.valueChanged.connect(self.rotationChange) self.altdSlider.valueChanged.connect(self.altitudeChange) self.cameraWidget=CameraWidget(self) self.sensorsWidget=SensorsWidget(self) self.colorFilterWidget=ColorFilterWidget(self) self.cameraCommunicator=Communicator() self.colorFilterCommunicator=Communicator() self.trackingCommunicator = Communicator() self.stopButton.clicked.connect(self.stopClicked) self.playButton.clicked.connect(self.playClicked) self.resetButton.clicked.connect(self.resetClicked) self.takeoffButton.clicked.connect(self.takeOffClicked) self.takeoff=False self.reset=False
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.setupUi(self) self.teleop=TeleopWidget(self) self.tlLayout.addWidget(self.teleop) self.teleop.setVisible(True) self.logo = LogoWidget(self, self.logoLayout.parent().width(), self.logoLayout.parent().height()) self.logoLayout.addWidget(self.logo) self.logo.setVisible(True) self.updGUI.connect(self.updateGUI) self.sensorsCheck.stateChanged.connect(self.showSensorsWidget) self.sensorsWidget=SensorsWidget(self) self.rotationDial.valueChanged.connect(self.rotationChange) self.altdSlider.valueChanged.connect(self.altitudeChange) self.changeCamButton.clicked.connect(self.changeCamera) self.pushButton.clicked.connect(self.pushClicked) self.pushButton.setCheckable(True) self.resetButton.clicked.connect(self.resetClicked) self.takeoffButton.clicked.connect(self.takeOffClicked) self.camera1=CameraWidget(self) self.record = False self.takeoff=False self.reset=False
class MainWindow(QMainWindow, Ui_MainWindow): updGUI = pyqtSignal() def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.setupUi(self) self.teleop = TeleopWidget(self) self.tlLayout.addWidget(self.teleop) self.teleop.setVisible(True) self.logo = LogoWidget(self, self.logoLayout.parent().width(), self.logoLayout.parent().height()) self.logoLayout.addWidget(self.logo) self.logo.setVisible(True) self.record = False self.updGUI.connect(self.updateGUI) self.cameraCheck.stateChanged.connect(self.showCameraWidget) self.sensorsCheck.stateChanged.connect(self.showSensorsWidget) self.colorFilterCheck.stateChanged.connect(self.showColorFilterWidget) self.rotationDial.valueChanged.connect(self.rotationChange) self.altdSlider.valueChanged.connect(self.altitudeChange) self.cameraWidget = CameraWidget(self) self.sensorsWidget = SensorsWidget(self) self.colorFilterWidget = ColorFilterWidget(self) self.cameraCommunicator = Communicator() self.colorFilterCommunicator = Communicator() self.trackingCommunicator = Communicator() # self.stopButton.clicked.connect(self.stopClicked) self.playstopButton.clicked.connect(self.playstopClicked) self.resetButton.clicked.connect(self.resetClicked) self.takeoffButton.clicked.connect(self.takeOffClicked) self.takeoff = False self.reset = False def getCamera(self): return self.camera def setCamera(self, camera): self.camera = camera def getNavData(self): return self.navdata def setNavData(self, navdata): self.navdata = navdata def getPose3D(self): return self.pose def setPose3D(self, pose): self.pose = pose def getCMDVel(self): return self.cmdvel def setCMDVel(self, cmdvel): self.cmdvel = cmdvel def getExtra(self): return self.extra def setExtra(self, extra): self.extra = extra def setAlgorithm(self, algorithm): self.algorithm = algorithm def getAlgorithm(self): return self.algorithm def updateGUI(self): self.cameraWidget.imageUpdate.emit() self.sensorsWidget.sensorsUpdate.emit() self.colorFilterWidget.imageUpdate.emit() def playstopClicked(self): if self.playstopButton.isChecked(): if self.record == True: self.extra.record(True) self.playstopButton.setText("Stop code") self.playstopButton.setStyleSheet("background-color: #ec7063") self.playstopButton.setIcon(self.icon1) self.algorithm.play() else: if self.record == True: self.extra.record(False) self.algorithm.stop() self.playstopButton.setStyleSheet("background-color: #7dcea0") self.playstopButton.setText("Play code") self.playstopButton.setIcon(self.icon) self.rotationDial.setValue(self.altdSlider.maximum() / 2) self.altdSlider.setValue(self.altdSlider.maximum() / 2) self.cmdvel.sendCMDVel(0, 0, 0, 0, 0, 0) self.teleop.stopSIG.emit() def takeOffClicked(self): if (self.takeoff == True): self.takeoffButton.setText("Take Off") self.extra.land() self.takeoff = False else: self.takeoffButton.setText("Land") self.extra.takeoff() self.takeoff = True def resetClicked(self): if self.reset == True: self.resetButton.setText("Reset") self.extra.reset() self.reset = False else: self.resetButton.setText("Unreset") self.extra.reset() self.reset = True def showCameraWidget(self, state): if state == Qt.Checked: self.cameraWidget.show() else: self.cameraWidget.close() def closeCameraWidget(self): self.cameraCheck.setChecked(False) def showColorFilterWidget(self, state): if state == Qt.Checked: self.colorFilterWidget.show() else: self.colorFilterWidget.close() def closeColorFilterWidget(self): self.colorFilterCheck.setChecked(False) def showSensorsWidget(self, state): if state == Qt.Checked: self.sensorsWidget.show() else: self.sensorsWidget.close() def closeSensorsWidget(self): self.sensorsCheck.setChecked(False) def rotationChange(self, value): value = (1.0 / (self.rotationDial.maximum() / 2)) * ( value - (self.rotationDial.maximum() / 2)) self.rotValue.setText('%.2f' % value) self.cmdvel.setYaw(value) self.cmdvel.sendVelocities() def altitudeChange(self, value): value = (1.0 / (self.altdSlider.maximum() / 2)) * ( value - (self.altdSlider.maximum() / 2)) self.rotValue.setText('%.2f' % value) self.cmdvel.setVZ(value) self.cmdvel.sendVelocities() def setXYValues(self, newX, newY): self.XValue.setText('%.2f' % newX) self.YValue.setText('%.2f' % newY) self.cmdvel.setVX(-newY) self.cmdvel.setVY(-newX) self.cmdvel.sendVelocities() def closeEvent(self, event): self.algorithm.kill() self.camera.client.stop() self.navdata.stop() self.pose.stop() event.accept()
class MainWindow(QMainWindow, Ui_MainWindow): updGUI = pyqtSignal() def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.setupUi(self) self.teleop = TeleopWidget(self) self.tlLayout.addWidget(self.teleop) self.teleop.setVisible(True) self.logo = LogoWidget(self, self.logoLayout.parent().width(), self.logoLayout.parent().height()) self.logoLayout.addWidget(self.logo) self.logo.setVisible(True) self.updGUI.connect(self.updateGUI) self.sensorsCheck.stateChanged.connect(self.showSensorsWidget) self.rotationDial.valueChanged.connect(self.rotationChange) self.altdSlider.valueChanged.connect(self.altitudeChange) self.cameraWidget = ColorFilterWidget(self) self.sensorsWidget = SensorsWidget(self) self.changeCamButton.clicked.connect(self.changeCamera) self.trackingCommunicator = Communicator() self.pushButton.clicked.connect(self.pushClicked) self.pushButton.setCheckable(True) self.resetButton.clicked.connect(self.resetClicked) self.takeoffButton.clicked.connect(self.takeOffClicked) self.camera1 = CameraWidget(self) self.takeoff = False self.reset = False self.record = False def getDrone(self): return self.drone def setDrone(self, drone): self.drone = drone def setAlgorithm(self, algorithm): self.algorithm = algorithm def getAlgorithm(self): return self.algorithm def updateGUI(self): self.camera1.updateImage() self.sensorsWidget.sensorsUpdate.emit() def pushClicked(self): if self.pushButton.isChecked(): icon = QtGui.QIcon() self.pushButton.setText('Stop Code') self.pushButton.setStyleSheet("background-color: #ec7063") icon.addPixmap(QtGui.QPixmap(":/images/stop.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton.setIcon(icon) self.algorithm.play() else: icon = QtGui.QIcon() self.pushButton.setText('Play Code') self.pushButton.setStyleSheet("background-color: #7dcea0") icon.addPixmap(QtGui.QPixmap(":/images/play.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton.setIcon(icon) self.algorithm.stop() self.rotationDial.setValue(self.altdSlider.maximum() / 2) self.altdSlider.setValue(self.altdSlider.maximum() / 2) self.drone.sendCMDVel(0, 0, 0, 0, 0, 0) self.teleop.stopSIG.emit() def takeOffClicked(self): if (self.takeoff == True): self.takeoffButton.setText("Take Off") self.drone.land() self.takeoff = False else: self.takeoffButton.setText("Land") self.drone.takeoff() self.takeoff = True def resetClicked(self): if self.reset == True: self.resetButton.setText("Reset") self.drone.reset() self.reset = False else: self.resetButton.setText("Unreset") self.drone.reset() self.reset = True self.rotationDial.setValue(self.altdSlider.maximum() / 2) self.altdSlider.setValue(self.altdSlider.maximum() / 2) self.drone.sendCMDVel(0, 0, 0, 0, 0, 0) self.teleop.stopSIG.emit() def changeCamera(self): self.drone.toggleCam() def showSensorsWidget(self, state): if state == Qt.Checked: self.sensorsWidget.show() else: self.sensorsWidget.close() def closeSensorsWidget(self): self.sensorsCheck.setChecked(False) def rotationChange(self, value): value = (1.0 / (self.rotationDial.maximum() / 2)) * ( value - (self.rotationDial.maximum() / 2)) self.rotValue.setText('%.2f' % value) self.drone.setYaw(value) self.drone.sendVelocities() def altitudeChange(self, value): value = (1.0 / (self.altdSlider.maximum() / 2)) * ( value - (self.altdSlider.maximum() / 2)) self.altdValue.setText('%.2f' % value) self.drone.setVZ(value) self.drone.sendVelocities() def setXYValues(self, newX, newY): self.XValue.setText('%.2f' % newX) self.YValue.setText('%.2f' % newY) self.drone.setVX(-newY) self.drone.setVY(-newX) self.drone.sendVelocities() def closeEvent(self, event): self.algorithm.kill() self.drone.__camera.stop() #self.navdata.stop() self.drone.__pose.stop() event.accept()
class MainWindow(QMainWindow, Ui_MainWindow): updGUI=pyqtSignal() def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.setupUi(self) self.teleop=TeleopWidget(self) self.tlLayout.addWidget(self.teleop) self.teleop.setVisible(True) self.record = False self.updGUI.connect(self.updateGUI) self.cameraCheck.stateChanged.connect(self.showCameraWidget) self.sensorsCheck.stateChanged.connect(self.showSensorsWidget) self.colorFilterCheck.stateChanged.connect(self.showColorFilterWidget) self.rotationDial.valueChanged.connect(self.rotationChange) self.altdSlider.valueChanged.connect(self.altitudeChange) self.cameraWidget=CameraWidget(self) self.sensorsWidget=SensorsWidget(self) self.colorFilterWidget=ColorFilterWidget(self) self.cameraCommunicator=Communicator() self.colorFilterCommunicator=Communicator() self.trackingCommunicator = Communicator() self.stopButton.clicked.connect(self.stopClicked) self.playButton.clicked.connect(self.playClicked) self.resetButton.clicked.connect(self.resetClicked) self.takeoffButton.clicked.connect(self.takeOffClicked) self.takeoff=False self.reset=False def getCamera(self): return self.camera def setCamera(self,camera): self.camera = camera def getNavData(self): return self.navdata def setNavData(self,navdata): self.navdata = navdata def getPose3D(self): return self.pose def setPose3D(self,pose): self.pose = pose def getCMDVel(self): return self.cmdvel def setCMDVel(self,cmdvel): self.cmdvel = cmdvel def getExtra(self): return self.extra def setExtra(self,extra): self.extra = extra def setAlgorithm(self, algorithm ): self.algorithm=algorithm def getAlgorithm(self): return self.algorithm def updateGUI(self): self.cameraWidget.imageUpdate.emit() self.sensorsWidget.sensorsUpdate.emit() self.colorFilterWidget.imageUpdate.emit() def playClicked(self): if self.record == True: self.extra.record(True) self.algorithm.play() def stopClicked(self): if self.record == True: self.extra.record(False) self.algorithm.stop() self.rotationDial.setValue(self.altdSlider.maximum()/2) self.altdSlider.setValue(self.altdSlider.maximum()/2) self.cmdvel.sendCMDVel(0,0,0,0,0,0) self.teleop.stopSIG.emit() def takeOffClicked(self): if(self.takeoff==True): self.takeoffButton.setText("Take Off") self.extra.land() self.takeoff=False else: self.takeoffButton.setText("Land") self.extra.takeoff() self.takeoff=True def resetClicked(self): if self.reset == True: self.resetButton.setText("Reset") self.extra.reset() self.reset=False else: self.resetButton.setText("Unreset") self.extra.reset() self.reset=True def showCameraWidget(self,state): if state == Qt.Checked: self.cameraWidget.show() else: self.cameraWidget.close() def closeCameraWidget(self): self.cameraCheck.setChecked(False) def showColorFilterWidget(self,state): if state == Qt.Checked: self.colorFilterWidget.show() else: self.colorFilterWidget.close() def closeColorFilterWidget(self): self.colorFilterCheck.setChecked(False) def showSensorsWidget(self,state): if state == Qt.Checked: self.sensorsWidget.show() else: self.sensorsWidget.close() def closeSensorsWidget(self): self.sensorsCheck.setChecked(False) def rotationChange(self,value): value=(1.0/(self.rotationDial.maximum()/2))*(value - (self.rotationDial.maximum()/2)) self.rotValue.setText('%.2f' % value) self.cmdvel.setYaw(value) self.cmdvel.sendVelocities() def altitudeChange(self,value): value=(1.0/(self.altdSlider.maximum()/2))*(value - (self.altdSlider.maximum()/2)) self.rotValue.setText('%.2f' % value) self.cmdvel.setVZ(value) self.cmdvel.sendVelocities() def setXYValues(self,newX,newY): self.XValue.setText('%.2f' % newX) self.YValue.setText('%.2f' % newY) self.cmdvel.setVX(-newY) self.cmdvel.setVY(-newX) self.cmdvel.sendVelocities() def closeEvent(self, event): self.algorithm.kill() self.camera.client.stop() self.navdata.stop() self.pose.stop() event.accept()
class MainWindow(QtGui.QMainWindow, Ui_MainWindow): updGUI=QtCore.pyqtSignal() def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.setupUi(self) self.teleop=TeleopWidget(self) self.tlLayout.addWidget(self.teleop) self.teleop.setVisible(True) self.record = False self.updGUI.connect(self.updateGUI) self.cameraCheck.stateChanged.connect(self.showCameraWidget) self.sensorsCheck.stateChanged.connect(self.showSensorsWidget) self.colorFilterCheck.stateChanged.connect(self.showColorFilterWidget) self.rotationDial.valueChanged.connect(self.rotationChange) self.altdSlider.valueChanged.connect(self.altitudeChange) self.cameraWidget=CameraWidget(self) self.sensorsWidget=SensorsWidget(self) self.colorFilterWidget=ColorFilterWidget(self) self.cameraCommunicator=Communicator() self.colorFilterCommunicator=Communicator() self.stopButton.clicked.connect(self.stopClicked) self.playButton.clicked.connect(self.playClicked) self.takeoffButton.clicked.connect(self.takeOffClicked) self.takeoff=False def setSensor(self,sensor): self.sensor=sensor def getSensor(self): return self.sensor def updateGUI(self): self.cameraWidget.imageUpdate.emit() self.colorFilterWidget.imageUpdate.emit() self.sensorsWidget.sensorsUpdate.emit() def playClicked(self): if self.record == True: self.sensor.record(True) self.sensor.setPlayButton(True) def stopClicked(self): if self.record == True: self.sensor.record(False) self.sensor.setPlayButton(False) self.rotationDial.setValue(self.altdSlider.maximum()/2) self.altdSlider.setValue(self.altdSlider.maximum()/2) self.teleop.stopSIG.emit() def takeOffClicked(self): if(self.takeoff==True): self.takeoffButton.setText("Take Off") self.sensor.land() self.takeoff=False else: self.takeoffButton.setText("Land") self.sensor.takeoff() self.takeoff=True def showCameraWidget(self,state): if state == QtCore.Qt.Checked: self.cameraWidget.show() else: self.cameraWidget.close() def closeCameraWidget(self): self.cameraCheck.setChecked(False) def showColorFilterWidget(self,state): if state == QtCore.Qt.Checked: self.colorFilterWidget.show() else: self.colorFilterWidget.close() def closeColorFilterWidget(self): self.colorFilterCheck.setChecked(False) def showSensorsWidget(self,state): if state == QtCore.Qt.Checked: self.sensorsWidget.show() else: self.sensorsWidget.close() def closeSensorsWidget(self): self.sensorsCheck.setChecked(False) def rotationChange(self,value): value=(1.0/(self.rotationDial.maximum()/2))*(value - (self.rotationDial.maximum()/2)) self.rotValue.setText(unicode(value)) self.sensor.setYaw(value) self.sensor.sendVelocities() def altitudeChange(self,value): value=(1.0/(self.altdSlider.maximum()/2))*(value - (self.altdSlider.maximum()/2)) self.altdValue.setText(unicode(value)) self.sensor.setVZ(value) self.sensor.sendVelocities() def setXYValues(self,newX,newY): self.XValue.setText(unicode(newX)) self.YValue.setText(unicode(newY)) if not self.sensor.isVirtual(): self.sensor.setVX(-newY/10.0) self.sensor.setVY(-newX/10.0) else: self.sensor.setVX(-newY) self.sensor.setVY(-newX) self.sensor.sendVelocities()
class MainWindow(QMainWindow, Ui_MainWindow): updGUI = pyqtSignal() def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.setupUi(self) self.teleop = TeleopWidget(self, 0) self.teleop1 = TeleopWidget(self, 1) self.tlLayout.addWidget(self.teleop) self.tlLayout_1.addWidget(self.teleop1) self.teleop.setVisible(True) self.record = False self.updGUI.connect(self.updateGUI) self.cameraCheck.stateChanged.connect(self.showCameraWidget) self.sensorsCheck.stateChanged.connect(self.showSensorsWidget) self.cameraWidget = CameraWidget(self) self.sensorsWidget = SensorsWidget(self) self.cameraCommunicator = Communicator() self.trackingCommunicator = Communicator() self.stopButton.clicked.connect(self.stopClicked) self.resetButton.clicked.connect(self.resetClicked) self.takeoffButton.clicked.connect(self.takeOffClicked) self.takeoff = False self.reset = False def getCamera(self): return self.camera def setCamera(self, camera): self.camera = camera def getNavData(self): return self.navdata def setNavData(self, navdata): self.navdata = navdata def getPose3D(self): return self.pose def setPose3D(self, pose): self.pose = pose def getCMDVel(self): return self.cmdvel def setCMDVel(self, cmdvel): self.cmdvel = cmdvel def getExtra(self): return self.extra def setExtra(self, extra): self.extra = extra def updateGUI(self): self.cameraWidget.imageUpdate.emit() self.sensorsWidget.sensorsUpdate.emit() def stopClicked(self): if self.record == True: self.extra.record(False) self.cmdvel.sendCMDVel(0, 0, 0, 0, 0, 0) self.teleop.stopSIG.emit() self.teleop1.stopSIG.emit() def takeOffClicked(self): if (self.takeoff == True): self.takeoffButton.setText("Take Off") self.extra.land() self.takeoff = False else: self.takeoffButton.setText("Land") self.extra.takeoff() self.takeoff = True def resetClicked(self): if self.reset == True: self.resetButton.setText("Reset") self.extra.reset() self.reset = False else: self.resetButton.setText("Unreset") self.extra.reset() self.reset = True def showCameraWidget(self, state): if state == Qt.Checked: self.cameraWidget.show() else: self.cameraWidget.close() def closeCameraWidget(self): self.cameraCheck.setChecked(False) def showSensorsWidget(self, state): if state == Qt.Checked: self.sensorsWidget.show() else: self.sensorsWidget.close() def closeSensorsWidget(self): self.sensorsCheck.setChecked(False) def setXYValues(self, newX, newY): self.XValue.setText('%.2f' % newX) self.YValue.setText('%.2f' % -newY) self.cmdvel.setVX(-newY) self.cmdvel.setVY(-newX) self.cmdvel.sendVelocities() def setZYawValues(self, newZ, newYaw): self.altdValue.setText('%.2f' % -newZ) self.rotValue.setText('%.2f' % newYaw) self.cmdvel.setVZ(-newZ) self.cmdvel.setYaw(newYaw) self.cmdvel.sendVelocities() def closeEvent(self, event): self.camera.stop() self.navdata.stop() self.pose.stop() event.accept()
class MainWindow(QMainWindow, Ui_MainWindow): updGUI=pyqtSignal() def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.setupUi(self) self.teleop=TeleopWidget(self) self.tlLayout.addWidget(self.teleop) self.teleop.setVisible(True) self.logo = LogoWidget(self, self.logoLayout.parent().width(), self.logoLayout.parent().height()) self.logoLayout.addWidget(self.logo) self.logo.setVisible(True) self.updGUI.connect(self.updateGUI) self.sensorsCheck.stateChanged.connect(self.showSensorsWidget) self.sensorsWidget=SensorsWidget(self) self.rotationDial.valueChanged.connect(self.rotationChange) self.altdSlider.valueChanged.connect(self.altitudeChange) self.changeCamButton.clicked.connect(self.changeCamera) self.pushButton.clicked.connect(self.pushClicked) self.pushButton.setCheckable(True) self.resetButton.clicked.connect(self.resetClicked) self.takeoffButton.clicked.connect(self.takeOffClicked) self.camera1=CameraWidget(self) self.record = False self.takeoff=False self.reset=False def getCamera(self): return self.camera def setCamera(self,camera): self.camera = camera def getNavData(self): return self.navdata def setNavData(self,navdata): self.navdata = navdata def getPose3D(self): return self.pose def setPose3D(self,pose): self.pose = pose def getCMDVel(self): return self.cmdvel def setCMDVel(self,cmdvel): self.cmdvel = cmdvel def getExtra(self): return self.extra def setExtra(self,extra): self.extra = extra def setAlgorithm(self, algorithm ): self.algorithm=algorithm def getAlgorithm(self): return self.algorithm def updateGUI(self): self.camera1.updateImage() self.sensorsWidget.sensorsUpdate.emit() def pushClicked(self): if self.pushButton.isChecked(): icon = QtGui.QIcon() self.pushButton.setText('Stop Code') self.pushButton.setStyleSheet("background-color: #ec7063") icon.addPixmap(QtGui.QPixmap(":/images/stop.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton.setIcon(icon) self.algorithm.play() else: icon = QtGui.QIcon() self.pushButton.setText('Play Code') self.pushButton.setStyleSheet("background-color: #7dcea0") icon.addPixmap(QtGui.QPixmap(":/images/play.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.pushButton.setIcon(icon) self.algorithm.stop() def resetClicked(self): if self.reset == True: self.resetButton.setText("Reset") self.extra.reset() self.reset=False else: self.resetButton.setText("Unreset") self.extra.reset() self.reset=True def takeOffClicked(self): if(self.takeoff==True): self.takeoffButton.setText("Take Off") self.extra.land() self.takeoff=False else: self.takeoffButton.setText("Land") self.extra.takeoff() self.takeoff=True def resetClicked(self): if self.reset == True: self.resetButton.setText("Reset") self.extra.reset() self.reset=False else: self.resetButton.setText("Unreset") self.extra.reset() self.reset=True def changeCamera(self): self.extra.toggleCam() def showSensorsWidget(self,state): if state == Qt.Checked: self.sensorsWidget.show() else: self.sensorsWidget.close() def closeSensorsWidget(self): self.sensorsCheck.setChecked(False) def rotationChange(self,value): value=(1.0/(self.rotationDial.maximum()/2))*(value - (self.rotationDial.maximum()/2)) self.rotValue.setText('%.2f' % value) self.cmdvel.setYaw(value) self.cmdvel.sendVelocities() def altitudeChange(self,value): value=(1.0/(self.altdSlider.maximum()/2))*(value - (self.altdSlider.maximum()/2)) self.rotValue.setText('%.2f' % value) self.cmdvel.setVZ(value) self.cmdvel.sendVelocities() def setXYValues(self,newX,newY): self.XValue.setText('%.2f' % newX) self.YValue.setText('%.2f' % newY) self.cmdvel.setVX(-newY) self.cmdvel.setVY(-newX) self.cmdvel.sendVelocities() def closeEvent(self, event): self.algorithm.kill() self.camera.stop() self.navdata.stop() self.pose.stop() event.accept()