def __init__(self, map_img, parent=None):
        super(MainWindow, self).__init__(parent)
        self.teleop = TeleopWidget(self)
        self.map_img = map_img
        self.map = MapWidget(self)
        self.setupUi(self, self.map.width, self.map.height)
        self.map1 = LaserWidget(self)
        self.logo = LogoWidget(self, "resources/logo_jderobot1.png")
        self.logo2 = LogoWidget(self, "resources/logo_jderobot2.png")
        self.tlLayout.addWidget(self.teleop)
        self.teleop.setVisible(True)
        self.mapLayout.addWidget(self.map)
        self.map1Layout.addWidget(self.map1)
        self.logoLayout.addWidget(self.logo)
        self.roboticsLogoLayout.addWidget(self.logo2)
        self.map.setVisible(True)
        self.map1.setVisible(True)
        self.logo.setVisible(True)

        #self.rotationDial.valueChanged.connect(self.rotationChange)
        #self.probButton.clicked.connect(self.recalculate)
        #self.probButton.setCheckable(True)
        #self.newGeneration.clicked.connect(self.nextGeneration)
        #self.newGeneration.setCheckable(True)
        self.pushButton.clicked.connect(self.playClicked)
        self.pushButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)

        self.particles = []
        self.estimation = []
Example #2
0
    def __init__(self, map_img, parent=None):
        super(MainWindow, self).__init__(parent)
        self.teleop=TeleopWidget(self)
        self.map_img = map_img
        self.map=MapWidget(self)
        self.setupUi(self, self.map.width, self.map.height)
        self.map1=LaserWidget(self)
        self.logo = LogoWidget(self, "resources/logo_jderobot1.png")
        self.logo2 = LogoWidget(self, "resources/logo_jderobot2.png")
        self.tlLayout.addWidget(self.teleop)
        self.teleop.setVisible(True)
        self.mapLayout.addWidget(self.map)
        self.map1Layout.addWidget(self.map1)
        self.logoLayout.addWidget(self.logo)
        self.roboticsLogoLayout.addWidget(self.logo2)
        self.map.setVisible(True)
        self.map1.setVisible(True)
        self.logo.setVisible(True)

        #self.rotationDial.valueChanged.connect(self.rotationChange)
        #self.probButton.clicked.connect(self.recalculate)
        #self.probButton.setCheckable(True)
        #self.newGeneration.clicked.connect(self.nextGeneration)
        #self.newGeneration.setCheckable(True)
        self.pushButton.clicked.connect(self.playClicked)
        self.pushButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)

        self.particles = []
        self.estimation = []
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)
        self.teleop = TeleopWidget(self)
        self.map = MapWidget(self)
        self.tlLayout.addWidget(self.teleop)
        self.teleop.setVisible(True)
        self.mapLayout.addWidget(self.map)
        self.map.setVisible(True)

        self.pushButton.clicked.connect(self.playClicked)
        self.pushButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)
        self.camera1 = CameraWidget(self)

        self.stopButton.clicked.connect(self.stopClicked)
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)
        # self.setStyleSheet(open("gui/style.qss", "r").read())
        #self.teleop=TeleopWidget(self)
        #self.tlLayout.addWidget(self.teleop)
        #self.teleop.setVisible(True)
        #self.logo = LogoWidget(self)
        #self.logoLayout.addWidget(self.logo)
        #self.logo.setVisible(True)

        #self.pushButton.clicked.connect(self.playClicked)
        #self.pushButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)
        self.camera1=CameraWidget(self)
        self.mapW = MapWidget(self)
        self.verticalLayoutMap.addWidget(self.mapW)
        print(self.mapW.width(), self.mapW.height())
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)
        self.teleop=TeleopWidget(self)
        self.map=MapWidget(self)
        self.map1=MapWidget1(self)
        self.logo = LogoWidget(self)
        self.tlLayout.addWidget(self.teleop)
        self.teleop.setVisible(True)
        self.mapLayout.addWidget(self.map)
        self.map1Layout.addWidget(self.map1)
        self.logoLayout.addWidget(self.logo)
        self.map.setVisible(True)
        self.map1.setVisible(True)
        self.logo.setVisible(True)

        self.pushButton.clicked.connect(self.playClicked)
        self.pushButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)
Example #6
0
    def __init__(self, pose3d, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)
        self.teleop=TeleopWidget(self)
        self.map=MapWidget(self)
        self.logo = LogoWidget(self)
        self.tlLayout.addWidget(self.teleop)
        self.teleop.setVisible(True)
        self.mapLayout.addWidget(self.map)
        self.logoLayout.addWidget(self.logo)
        self.map.setVisible(True)
        self.logo.setVisible(True)

        self.percentajeCheck.stateChanged.connect(self.showPercentajeWidget)
        self.percentajeWidget=PercentajeWidget(self, pose3d)
        self.percentajeCommunicator=Communicator()

        self.pushButton.clicked.connect(self.playClicked)
        self.pushButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)

        self.stopButton.clicked.connect(self.stopClicked)
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)
        self.teleop=TeleopWidget(self)
        self.map=MapWidget(self)
        self.tlLayout.addWidget(self.teleop)
        self.teleop.setVisible(True)
        self.mapLayout.addWidget(self.map)
        self.map.setVisible(True)

        self.pushButton.clicked.connect(self.playClicked)
        self.pushButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)
        self.camera1=CameraWidget(self)

        self.stopButton.clicked.connect(self.stopClicked)
Example #8
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)
        # self.setStyleSheet(open("gui/style.qss", "r").read())
        #self.teleop=TeleopWidget(self)
        #self.tlLayout.addWidget(self.teleop)
        #self.teleop.setVisible(True)
        #self.logo = LogoWidget(self)
        #self.logoLayout.addWidget(self.logo)
        #self.logo.setVisible(True)

        self.pushButton.clicked.connect(self.playClicked)
        self.pushButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)
        self.camera1=CameraWidget(self)
        self.mapW = MapWidget(self)
        self.verticalLayoutMap.addWidget(self.mapW)
        self.chronoW = ChronoWidget(self)
        self.verticalLayoutChrono.addWidget(self.chronoW)
        print(self.mapW.width(), self.mapW.height())

        self.stopButton.clicked.connect(self.stopClicked)
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.map = MapWidget(self)
        self.tlLayout.addWidget(self.teleop)
        self.teleop.setVisible(True)
        self.mapLayout.addWidget(self.map)
        self.map.setVisible(True)

        self.pushButton.clicked.connect(self.playClicked)
        self.pushButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)
        self.camera1 = CameraWidget(self)

        self.stopButton.clicked.connect(self.stopClicked)

    def updateGUI(self):
        self.camera1.updateImage()
        (cx, cy) = self.algorithm.getCarDirection()
        (ox, oy) = self.algorithm.getObstaclesDirection()
        (ax, ay) = self.algorithm.getAverageDirection()
        (tx, ty) = self.algorithm.getCurrentTarget()
        self.map.setCarArrow(cx, cy)
        self.map.setObstaclesArrow(ox, oy)
        self.map.setAverageArrow(ax, ay)
        if (self.pose3d):
            self.map.setTarget(tx, ty,
                               self.pose3d.getX() / 1000,
                               self.pose3d.getY() / 1000, self.pose3d.getYaw())
        laserdata = self.laser.getLaserData()
        if (laserdata):
            self.map.setLaserValues(laserdata)
        self.map.update()

    def getCameraL(self):
        return self.cameraL

    def setCameraL(self, camera):
        self.cameraL = camera

    def getCameraR(self):
        return self.cameraR

    def setCameraR(self, camera):
        self.cameraR = camera

    def getPose3D(self):
        return self.pose3d

    def setPose3D(self, pose3d):
        self.pose3d = pose3d

    def getLaser(self):
        return self.laser

    def setLaser(self, laser):
        self.laser = laser

    def getMotors(self):
        return self.motors

    def setMotors(self, motors):
        self.motors = motors

    def playClicked(self):
        if self.pushButton.isChecked():
            self.pushButton.setText('RUNNING')
            self.pushButton.setStyleSheet("background-color: green")
            self.algorithm.play()
        else:
            self.pushButton.setText('STOPPED')
            self.pushButton.setStyleSheet("background-color: red")
            self.algorithm.stop()

    def setAlgorithm(self, algorithm):
        self.algorithm = algorithm

    def getAlgorithm(self):
        return self.algorithm

    def setXYValues(self, newX, newY):
        myW = -newX * self.motors.getMaxW()
        myV = -newY * self.motors.getMaxV()
        self.motors.setV(myV)
        self.motors.setW(myW)
        self.motors.sendVelocities()

    def stopClicked(self):
        self.motors.setV(0)
        self.motors.setW(0)
        self.motors.sendVelocities()
        self.teleop.returnToOrigin()
Example #10
0
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.map = MapWidget(self)
        self.tlLayout.addWidget(self.teleop)
        self.teleop.setVisible(True)
        self.mapLayout.addWidget(self.map)
        self.map.setVisible(True)

        self.verticalLayout_2.addWidget(self.stopButton, 3)

        self.logo = LogoWidget(self, 60, 60)
        self.verticalLayout_2.addWidget(self.logo, 4)
        self.logo.setVisible(True)

        self.playButton.clicked.connect(self.playClicked)
        self.playButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)
        #self.camera1=CameraWidget(self)

        self.stopButton.clicked.connect(self.stopClicked)

    def updateGUI(self):
        #self.camera1.updateImage()
        (cx, cy) = self.algorithm.getCarDirection()
        (ox, oy) = self.algorithm.getObstaclesDirection()
        (ax, ay) = self.algorithm.getAverageDirection()
        (tx, ty, id) = self.algorithm.getCurrentTarget()
        self.map.setCarArrow(cx, cy)
        self.map.setObstaclesArrow(ox, oy)
        self.map.setAverageArrow(ax, ay)
        if (self.pose3d):
            self.map.setTarget(tx, ty,
                               self.pose3d.getPose3d().x,
                               self.pose3d.getPose3d().y,
                               self.pose3d.getPose3d().yaw, id)
        laserdata = self.laser.getLaserData()
        if (laserdata):
            self.map.setLaserValues(laserdata)
        self.map.update()

    #def getCamera(self):
    #return self.camera

    #def setCamera(self,camera):
    #self.camera=camera

    def getPose3D(self):
        return self.pose3d

    def setPose3D(self, pose3d):
        self.pose3d = pose3d

    def getLaser(self):
        return self.laser

    def setLaser(self, laser):
        self.laser = laser

    def getMotors(self):
        return self.motors

    def setMotors(self, motors):
        self.motors = motors

    def playClicked(self):
        if self.playButton.isChecked():
            icon = QtGui.QIcon()
            self.playButton.setStyleSheet("background-color: #ec7063")
            icon.addPixmap(QtGui.QPixmap(":/images/stop.png"),
                           QtGui.QIcon.Normal, QtGui.QIcon.Off)
            self.playButton.setIcon(icon)
            self.algorithm.play()
        else:
            icon = QtGui.QIcon()
            self.playButton.setStyleSheet("background-color: #7dcea0")
            icon.addPixmap(QtGui.QPixmap(":/images/play.png"),
                           QtGui.QIcon.Normal, QtGui.QIcon.Off)
            self.playButton.setIcon(icon)
            self.algorithm.stop()
            self.motors.sendV(0)
            self.motors.sendW(0)
            #self.motors.sendVelocities()
            self.teleop.returnToOrigin()

    def setAlgorithm(self, algorithm):
        self.algorithm = algorithm

    def getAlgorithm(self):
        return self.algorithm

    def setXYValues(self, newX, newY):
        myW = -newX * self.motors.getMaxW()
        myV = -newY * self.motors.getMaxV()
        self.motors.sendV(myV)
        self.motors.sendW(myW)
        #self.motors.sendVelocities(self.motors)

    def stopClicked(self):
        self.motors.sendV(0)
        self.motors.sendW(0)
        # self.motors.sendVelocities()
        self.teleop.returnToOrigin()
Example #11
0
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.map=MapWidget(self)
        self.tlLayout.addWidget(self.teleop)
        self.teleop.setVisible(True)
        self.mapLayout.addWidget(self.map)
        self.map.setVisible(True)


        self.verticalLayout_2.addWidget(self.stopButton,3)

        self.logo = LogoWidget(self, 60, 60)
        self.verticalLayout_2.addWidget(self.logo,4)
        self.logo.setVisible(True)

        self.playButton.clicked.connect(self.playClicked)
        self.playButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)
        self.camera1=CameraWidget(self)

        self.stopButton.clicked.connect(self.stopClicked)

    def updateGUI(self):
        self.camera1.updateImage()
        (cx, cy) = self.algorithm.getCarDirection()
        (ox, oy) = self.algorithm.getObstaclesDirection()
        (ax, ay) = self.algorithm.getAverageDirection()
        (tx, ty, id) = self.algorithm.getCurrentTarget()
        self.map.setCarArrow(cx, cy)
        self.map.setObstaclesArrow(ox, oy)
        self.map.setAverageArrow(ax, ay)
        if (self.pose3d):
            self.map.setTarget(tx, ty, self.pose3d.getPose3d().x/1000, self.pose3d.getPose3d().y/1000, self.pose3d.getPose3d().yaw, id)
        laserdata = self.laser.getLaserData()
        if (laserdata):
            self.map.setLaserValues(laserdata)
        self.map.update()

    def getCamera(self):
        return self.camera

    def setCamera(self,camera):
        self.camera=camera

    def getPose3D(self):
        return self.pose3d

    def setPose3D(self,pose3d):
        self.pose3d=pose3d

    def getLaser(self):
        return self.laser

    def setLaser(self,laser):
        self.laser=laser

    def getMotors(self):
        return self.motors

    def setMotors(self,motors):
        self.motors=motors

    def playClicked(self):
        if self.playButton.isChecked():
            icon = QtGui.QIcon()
            self.playButton.setStyleSheet("background-color: #ec7063")
            icon.addPixmap(QtGui.QPixmap(":/images/stop.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
            self.playButton.setIcon(icon)
            self.algorithm.play()
        else:
            icon = QtGui.QIcon()
            self.playButton.setStyleSheet("background-color: #7dcea0")
            icon.addPixmap(QtGui.QPixmap(":/images/play.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
            self.playButton.setIcon(icon)
            self.algorithm.stop()
            self.motors.sendV(0)
            self.motors.sendW(0)
            #self.motors.sendVelocities()
            self.teleop.returnToOrigin()

    def setAlgorithm(self, algorithm ):
        self.algorithm=algorithm

    def getAlgorithm(self):
        return self.algorithm

    def setXYValues(self,newX,newY):
        myW=-newX*self.motors.getMaxW()
        myV=-newY*self.motors.getMaxV()
        self.motors.sendV(myV)
        self.motors.sendW(myW)
        #self.motors.sendVelocities(self.motors)

    def stopClicked(self):
        self.motors.sendV(0)
        self.motors.sendW(0)
        # self.motors.sendVelocities()
        self.teleop.returnToOrigin()
class MainWindow(QMainWindow, Ui_MainWindow):

    updGUI = pyqtSignal()

    def __init__(self, map_img, parent=None):
        super(MainWindow, self).__init__(parent)
        self.teleop = TeleopWidget(self)
        self.map_img = map_img
        self.map = MapWidget(self)
        self.setupUi(self, self.map.width, self.map.height)
        self.map1 = LaserWidget(self)
        self.logo = LogoWidget(self, "resources/logo_jderobot1.png")
        self.logo2 = LogoWidget(self, "resources/logo_jderobot2.png")
        self.tlLayout.addWidget(self.teleop)
        self.teleop.setVisible(True)
        self.mapLayout.addWidget(self.map)
        self.map1Layout.addWidget(self.map1)
        self.logoLayout.addWidget(self.logo)
        self.roboticsLogoLayout.addWidget(self.logo2)
        self.map.setVisible(True)
        self.map1.setVisible(True)
        self.logo.setVisible(True)

        #self.rotationDial.valueChanged.connect(self.rotationChange)
        #self.probButton.clicked.connect(self.recalculate)
        #self.probButton.setCheckable(True)
        #self.newGeneration.clicked.connect(self.nextGeneration)
        #self.newGeneration.setCheckable(True)
        self.pushButton.clicked.connect(self.playClicked)
        self.pushButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)

        self.particles = []
        self.estimation = []

    def updateGUI(self):
        laserdata = self.sensors.laserdata
        if (laserdata):
            self.map1.setLaserValues(laserdata)
        self.map.update()
        self.map1.update()

    def setSensors(self, sensors):
        ''' Declares the Sensors object and its corresponding control thread. '''
        self.sensors = sensors

    def setAlgorithm(self, algorithm):
        self.algorithm = algorithm
        algorithm.gui = self
        algorithm.map = self.map

    def getAlgorithm(self):
        return self.algorithm

    def getPose3D(self):
        return self.sensors.actualPose

    def getLaserData(self):
        return self.sensors.laserdata

    def getMapImg(self):
        return self.map_img

    def setMapImg(self, map_img):
        self.map_img = map_img

    def getParticles(self):
        return self.particles

    def setParticles(self, particles):
        self.particles = particles

    def getEstimation(self):
        return self.estimation

    def setEstimation(self, est):
        if len(self.estimation) >= 15:
            self.estimation.pop(0)

        self.estimation.append(est)

    def playClicked(self):
        if self.pushButton.isChecked():
            self.pushButton.setStyleSheet("background-color: #ec7063")
            icon = QtGui.QIcon()
            icon.addPixmap(QtGui.QPixmap(":/images/stop.png"),
                           QtGui.QIcon.Normal, QtGui.QIcon.Off)
            self.pushButton.setIcon(icon)
            self.algorithm.play()
        else:
            self.sensors.motors.sendV(0)
            self.sensors.motors.sendW(0)
            icon = QtGui.QIcon()
            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.teleop.returnToOrigin()

    def setAlgorithm(self, algorithm):
        self.algorithm = algorithm
        algorithm.gui = self
        algorithm.map = self.map

    def getAlgorithm(self):
        return self.algorithm

    def setXYValues(self, newX, newY):
        vel = CMDVel()
        myW = -newX * (self.sensors.motors.getMaxW()) * 2
        myV = -newY * (self.sensors.motors.getMaxV())
        vel.vx = myV
        vel.az = myW
        self.sensors.motors.sendVelocities(vel)
        #self.sensors.motors.sendV(myV)
        #self.sensors.motors.sendW(myW)

    def rotationChange(self, value):
        val = (
            (value * 2 * math.pi) / 360)  # - (self.rotationDial.maximum()/2))
        #self.rotValue.setText('%.2f' % value)
        if (self.algorithm):
            self.algorithm.changeYaw(val)

    def recalculate(self):
        if (self.algorithm):
            self.algorithm.recalculateProb()

    def nextGeneration(self):
        if (self.algorithm):
            self.algorithm.calculateNewGeneration()
Example #13
0
class MainWindow(QMainWindow, Ui_MainWindow):

    updGUI=pyqtSignal()
    def __init__(self, pose3d, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)
        self.teleop=TeleopWidget(self)
        self.map=MapWidget(self)
        self.logo = LogoWidget(self)
        self.tlLayout.addWidget(self.teleop)
        self.teleop.setVisible(True)
        self.mapLayout.addWidget(self.map)
        self.logoLayout.addWidget(self.logo)
        self.map.setVisible(True)
        self.logo.setVisible(True)

        self.percentajeCheck.stateChanged.connect(self.showPercentajeWidget)
        self.percentajeWidget=PercentajeWidget(self, pose3d)
        self.percentajeCommunicator=Communicator()

        self.pushButton.clicked.connect(self.playClicked)
        self.pushButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)

        self.stopButton.clicked.connect(self.stopClicked)

    def updateGUI(self):
        laserdata = self.laser.getLaserData()
        if (laserdata):
            self.map.setLaserValues(laserdata)
        self.map.update()

    def getPose3D(self):
        return self.pose3d

    def setPose3D(self,pose3d):
        self.pose3d=pose3d

    def getLaser(self):
        return self.laser

    def setLaser(self,laser):
        self.laser=laser

    def getMotors(self):
        return self.motors

    def setMotors(self,motors):
        self.motors=motors

    def getBumper(self):
        return self.bumper

    def setBumper(self,bumper):
        self.bumper=bumper

    def showPercentajeWidget(self,state):
        if state == Qt.Checked:
            self.percentajeWidget.show()
        else:
            self.percentajeWidget.close()

    def closePercentajeWidget(self):
        self.percentajeCheck.setChecked(False)

    def playClicked(self):
        if self.pushButton.isChecked():
            self.pushButton.setText('RUNNING')
            self.pushButton.setStyleSheet("background-color: #ec7063")
            self.algorithm.play()
        else:
            self.pushButton.setText('STOPPED')
            self.pushButton.setStyleSheet("background-color: #7dcea0")
            self.algorithm.stop()

    def setAlgorithm(self, algorithm ):
        self.algorithm=algorithm

    def getAlgorithm(self):
        return self.algorithm

    def setXYValues(self,newX,newY):
        vel = CMDVel()
        myW=-newX*(self.motors.getMaxW())*2
        myV=-newY*(self.motors.getMaxV())
        vel.vx = myV
        vel.az = myW
        self.motors.sendVelocities(vel)

    def stopClicked(self):
        self.motors.sendV(0)
        self.motors.sendW(0)
        self.teleop.returnToOrigin()
Example #14
0
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.map = MapWidget(self)
        self.map1 = MapWidget1(self)
        self.tlLayout.addWidget(self.teleop)
        self.teleop.setVisible(True)
        self.mapLayout.addWidget(self.map)
        self.map1Layout.addWidget(self.map1)
        self.map.setVisible(True)
        self.map1.setVisible(True)

        self.pushButton.clicked.connect(self.playClicked)
        self.pushButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)
        #self.camera1=CameraWidget(self)

        self.stopButton.clicked.connect(self.stopClicked)

    def updateGUI(self):
        #self.camera1.updateImage()
        (cx, cy) = self.algorithm.getCarDirection()
        (ox, oy) = self.algorithm.getObstaclesDirection()
        (ax, ay) = self.algorithm.getAverageDirection()
        laserdata1 = self.laser1.getLaserData()
        laserdata2 = self.laser2.getLaserData()
        laserdata3 = self.laser3.getLaserData()
        if (laserdata1):
            self.map.setLaserValues(1, laserdata1)
            self.map1.setLaserValues(1, laserdata1)
        if (laserdata2):
            self.map.setLaserValues(2, laserdata2)
            self.map1.setLaserValues(2, laserdata2)
        if (laserdata3):
            self.map.setLaserValues(3, laserdata3)
            self.map1.setLaserValues(3, laserdata3)
        self.map.update()
        self.map1.update()

    def getPose3D(self):
        return self.pose3d

    def setPose3D(self, pose3d):
        self.pose3d = pose3d

    def getLaser(self):
        return self.laser

    def setLaser1(self, laser):
        self.laser1 = laser

    def setLaser2(self, laser):
        self.laser2 = laser

    def setLaser3(self, laser):
        self.laser3 = laser

    def getMotors(self):
        return self.motors

    def setMotors(self, motors):
        self.motors = motors

    def playClicked(self):
        if self.pushButton.isChecked():
            self.pushButton.setText('RUNNING')
            self.pushButton.setStyleSheet("background-color: green")
            self.algorithm.play()
        else:
            self.pushButton.setText('STOPPED')
            self.pushButton.setStyleSheet("background-color: red")
            self.algorithm.stop()

    def setAlgorithm(self, algorithm):
        self.algorithm = algorithm

    def getAlgorithm(self):
        return self.algorithm

    def setXYValues(self, newX, newY):
        myW = -newX * self.motors.getMaxW()
        myV = -newY * self.motors.getMaxV()
        self.motors.setV(myV)
        self.motors.setW(myW)
        self.motors.sendVelocities()

    def stopClicked(self):
        self.motors.setV(0)
        self.motors.setW(0)
        self.motors.sendVelocities()
        self.teleop.returnToOrigin()
Example #15
0
class MainWindow(QMainWindow, Ui_MainWindow):

    updGUI=pyqtSignal()
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)
        # self.setStyleSheet(open("gui/style.qss", "r").read())
        #self.teleop=TeleopWidget(self)
        #self.tlLayout.addWidget(self.teleop)
        #self.teleop.setVisible(True)
        #self.logo = LogoWidget(self)
        #self.logoLayout.addWidget(self.logo)
        #self.logo.setVisible(True)

        self.pushButton.clicked.connect(self.playClicked)
        self.pushButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)
        self.camera1=CameraWidget(self)
        self.mapW = MapWidget(self)
        self.verticalLayoutMap.addWidget(self.mapW)
        self.chronoW = ChronoWidget(self)
        self.verticalLayoutChrono.addWidget(self.chronoW)
        print(self.mapW.width(), self.mapW.height())

        self.stopButton.clicked.connect(self.stopClicked)

    def updateGUI(self):
        #print 'update gui'
        cx = self.pose3d.getPose3d().x
        cy = self.pose3d.getPose3d().y
        phx, phy = self.algorithm.synchronize()
        self.mapW.setCarPos(cx, cy)
        self.mapW.setPhantomPos(phx, phy)
        duration = self.algorithm.get_duration()
        initime = self.algorithm.get_initime()
        self.chronoW.setTime(initime, duration)
        self.camera1.updateImage()

    def getCamera(self):
        return self.camera

    def setCamera(self,camera):
        self.camera=camera

    def getMotors(self):
        return self.motors

    def setMotors(self,motors):
        self.motors=motors

    def getPose3D(self):
        return self.pose3d

    def setPose3D(self,pose3d, pose3dphantom):
        self.pose3dphantom = pose3dphantom
        self.pose3d=pose3d

    def playClicked(self):
        if self.pushButton.isChecked():
            self.pushButton.setText('Stop Code')
            self.pushButton.setStyleSheet("background-color: #ec7063")
            self.algorithm.play()
        else:
            self.pushButton.setText('Play Code')
            self.pushButton.setStyleSheet("background-color: #7dcea0")
            self.algorithm.stop()

    def setAlgorithm(self, algorithm ):
        self.algorithm=algorithm

    def getAlgorithm(self):
        return self.algorithm

    def setXYValues(self,newX,newY):
        #print ("newX: %f, newY: %f" % (newX, newY) )
        myW=-newX*self.motors.getMaxW()
        myV=-newY*self.motors.getMaxV()
        self.motors.sendV(myV)
        self.motors.sendW(myW)

    def stopClicked(self):
        self.motors.sendV(0)
        self.motors.sendW(0)
        #self.teleop.returnToOrigin()

    def closeEvent(self, event):
        self.algorithm.kill()
        self.camera.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.map=MapWidget(self)
        self.map1=MapWidget1(self)
        self.logo = LogoWidget(self)
        self.tlLayout.addWidget(self.teleop)
        self.teleop.setVisible(True)
        self.mapLayout.addWidget(self.map)
        self.map1Layout.addWidget(self.map1)
        self.logoLayout.addWidget(self.logo)
        self.map.setVisible(True)
        self.map1.setVisible(True)
        self.logo.setVisible(True)

        self.pushButton.clicked.connect(self.playClicked)
        self.pushButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)

        #self.stopButton.clicked.connect(self.stopClicked)

    def updateGUI(self):
        laserdata1 = self.laser1.getLaserData()
        laserdata2 = self.laser2.getLaserData()
        laserdata3 = self.laser3.getLaserData()
        if (laserdata1):
            self.map.setLaserValues(1,laserdata1)
        if (laserdata2):
            self.map.setLaserValues(2,laserdata2)
        if (laserdata3):
            self.map.setLaserValues(3,laserdata3)
        self.map.update()
        self.map1.update()

    def getPose3D(self):
        return self.pose3d

    def setPose3D(self,pose3d):
        self.pose3d=pose3d

    def getLaser(self):
        return self.laser

    def setLaser1(self,laser):
        self.laser1=laser

    def setLaser2(self,laser):
        self.laser2=laser

    def setLaser3(self,laser):
        self.laser3=laser

    def getMotors(self):
        return self.motors

    def setMotors(self,motors):
        self.motors=motors

    def playClicked(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.setStyleSheet("background-color: #7dcea0")
            icon.addPixmap(QtGui.QPixmap(":/images/play.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
            self.pushButton.setIcon(icon)
            #self.pushButton.setText("                                          Play Code")
            self.algorithm.stop()
            self.motors.sendV(0)
            self.motors.sendW(0)
            #self.motors.sendVelocities()
            self.teleop.returnToOrigin()

    def setAlgorithm(self, algorithm ):
        self.algorithm=algorithm

    def getAlgorithm(self):
        return self.algorithm

    def setXYValues(self,newX,newY):
        myW=-newX*self.motors.getMaxW()
        myV=-newY*self.motors.getMaxV()
        self.motors.sendV(myV)
        self.motors.sendW(myW)
Example #17
0
class MainWindow(QMainWindow, Ui_MainWindow):

    updGUI = pyqtSignal()

    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)
        # self.setStyleSheet(open("gui/style.qss", "r").read())
        #self.teleop=TeleopWidget(self)
        #self.tlLayout.addWidget(self.teleop)
        #self.teleop.setVisible(True)
        #self.logo = LogoWidget(self)
        #self.logoLayout.addWidget(self.logo)
        #self.logo.setVisible(True)

        self.pushButton.clicked.connect(self.playClicked)
        self.pushButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)
        self.camera1 = CameraWidget(self)
        self.mapW = MapWidget(self)
        self.verticalLayoutMap.addWidget(self.mapW)
        self.chronoW = ChronoWidget(self)
        self.verticalLayoutChrono.addWidget(self.chronoW)
        print(self.mapW.width(), self.mapW.height())

        self.stopButton.clicked.connect(self.stopClicked)

    def updateGUI(self):
        #print 'update gui'
        cx = self.pose3d.getPose3d().x
        cy = self.pose3d.getPose3d().y
        phx, phy = self.algorithm.synchronize()
        self.mapW.setCarPos(cx, cy)
        self.mapW.setPhantomPos(phx, phy)
        duration = self.algorithm.get_duration()
        initime = self.algorithm.get_initime()
        self.chronoW.setTime(initime, duration)
        self.camera1.updateImage()

    def getCamera(self):
        return self.camera

    def setCamera(self, camera):
        self.camera = camera

    def getMotors(self):
        return self.motors

    def setMotors(self, motors):
        self.motors = motors

    def getPose3D(self):
        return self.pose3d

    def setPose3D(self, pose3d, pose3dphantom):
        self.pose3dphantom = pose3dphantom
        self.pose3d = pose3d

    def playClicked(self):
        if self.pushButton.isChecked():
            self.pushButton.setText('Stop Code')
            self.pushButton.setStyleSheet("background-color: #ec7063")
            self.algorithm.play()
        else:
            self.pushButton.setText('Play Code')
            self.pushButton.setStyleSheet("background-color: #7dcea0")
            self.algorithm.stop()

    def setAlgorithm(self, algorithm):
        self.algorithm = algorithm

    def getAlgorithm(self):
        return self.algorithm

    def setXYValues(self, newX, newY):
        #print ("newX: %f, newY: %f" % (newX, newY) )
        myW = -newX * self.motors.getMaxW()
        myV = -newY * self.motors.getMaxV()
        self.motors.sendV(myV)
        self.motors.sendW(myW)

    def stopClicked(self):
        self.motors.sendV(0)
        self.motors.sendW(0)
        #self.teleop.returnToOrigin()

    def closeEvent(self, event):
        self.algorithm.kill()
        self.camera.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.map=MapWidget(self)
        self.tlLayout.addWidget(self.teleop)
        self.teleop.setVisible(True)
        self.mapLayout.addWidget(self.map)
        self.map.setVisible(True)

        self.pushButton.clicked.connect(self.playClicked)
        self.pushButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)
        self.camera1=CameraWidget(self)

        self.stopButton.clicked.connect(self.stopClicked)

    def updateGUI(self):
        self.camera1.updateImage()
        laserdata = self.laser.getLaserData()
        if (laserdata):
            self.map.setLaserValues(laserdata)
        self.map.update()

    def getCameraL(self):
        return self.cameraL

    def setCameraL(self,camera):
        self.cameraL=camera

    def getCameraR(self):
        return self.cameraR

    def setCameraR(self,camera):
        self.cameraR=camera

    def getPose3D(self):
        return self.pose3d

    def setPose3D(self,pose3d):
        self.pose3d=pose3d

    def getLaser(self):
        return self.laser

    def setLaser(self,laser):
        self.laser=laser

    def getMotors(self):
        return self.motors

    def setMotors(self,motors):
        self.motors=motors

    def playClicked(self):
        if self.pushButton.isChecked():
            self.pushButton.setText('RUNNING')
            self.pushButton.setStyleSheet("background-color: green")
            self.algorithm.play()
        else:
            self.pushButton.setText('STOPPED')
            self.pushButton.setStyleSheet("background-color: red")
            self.algorithm.stop()

    def setAlgorithm(self, algorithm ):
        self.algorithm=algorithm

    def getAlgorithm(self):
        return self.algorithm

    def setXYValues(self,newX,newY):
        myW=-newX*self.motors.getMaxW()
        myV=-newY*self.motors.getMaxV()
        self.motors.setV(myV)
        self.motors.setW(myW)
        self.motors.sendVelocities()

    def stopClicked(self):
        self.motors.setV(0)
        self.motors.setW(0)
        self.motors.sendVelocities()
        self.teleop.returnToOrigin()
Example #19
0
class MainWindow(QMainWindow, Ui_MainWindow):

    updGUI=pyqtSignal()
    def __init__(self, map_img, parent=None):
        super(MainWindow, self).__init__(parent)
        self.teleop=TeleopWidget(self)
        self.map_img = map_img
        self.map=MapWidget(self)
        self.setupUi(self, self.map.width, self.map.height)
        self.map1=LaserWidget(self)
        self.logo = LogoWidget(self, "resources/logo_jderobot1.png")
        self.logo2 = LogoWidget(self, "resources/logo_jderobot2.png")
        self.tlLayout.addWidget(self.teleop)
        self.teleop.setVisible(True)
        self.mapLayout.addWidget(self.map)
        self.map1Layout.addWidget(self.map1)
        self.logoLayout.addWidget(self.logo)
        self.roboticsLogoLayout.addWidget(self.logo2)
        self.map.setVisible(True)
        self.map1.setVisible(True)
        self.logo.setVisible(True)

        #self.rotationDial.valueChanged.connect(self.rotationChange)
        #self.probButton.clicked.connect(self.recalculate)
        #self.probButton.setCheckable(True)
        #self.newGeneration.clicked.connect(self.nextGeneration)
        #self.newGeneration.setCheckable(True)
        self.pushButton.clicked.connect(self.playClicked)
        self.pushButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)

        self.particles = []
        self.estimation = []

    def updateGUI(self):
        laserdata = self.sensors.laserdata
        if (laserdata):
            self.map1.setLaserValues(laserdata)
        self.map.update()
        self.map1.update()
    
    def setSensors(self, sensors):
        ''' Declares the Sensors object and its corresponding control thread. '''
        self.sensors = sensors

    def setAlgorithm(self, algorithm ):
        self.algorithm=algorithm
        algorithm.gui = self
        algorithm.map = self.map

    def getAlgorithm(self):
        return self.algorithm

    def getPose3D(self):
        return self.sensors.actualPose

    def getLaserData(self):
        return self.sensors.laserdata

    def getMapImg(self):
        return self.map_img

    def setMapImg(self,map_img):
        self.map_img=map_img

    def getParticles(self):
        return self.particles

    def setParticles(self,particles):
        self.particles=particles

    def getEstimation(self):
        return self.estimation

    def setEstimation(self,est):
        if len(self.estimation) >= 15:
            self.estimation.pop(0)

        self.estimation.append(est)

    def playClicked(self):
        if self.pushButton.isChecked():
            self.pushButton.setStyleSheet("background-color: #ec7063")
            icon = QtGui.QIcon()
            icon.addPixmap(QtGui.QPixmap(":/images/stop.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
            self.pushButton.setIcon(icon)
            self.algorithm.play()
        else:
            self.sensors.motors.sendV(0)
            self.sensors.motors.sendW(0)
            icon = QtGui.QIcon()
            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.teleop.returnToOrigin()

    def setAlgorithm(self, algorithm ):
        self.algorithm=algorithm
        algorithm.gui = self
        algorithm.map = self.map

    def getAlgorithm(self):
        return self.algorithm

    def setXYValues(self,newX,newY):
        vel = CMDVel()
        myW=-newX*(self.sensors.motors.getMaxW())*2
        myV=-newY*(self.sensors.motors.getMaxV())
        vel.vx = myV
        vel.az = myW
        self.sensors.motors.sendVelocities(vel)
        #self.sensors.motors.sendV(myV)
        #self.sensors.motors.sendW(myW)

    def rotationChange(self,value):
        val = ((value*2*math.pi)/360)# - (self.rotationDial.maximum()/2))
        #self.rotValue.setText('%.2f' % value)
        if (self.algorithm):
            self.algorithm.changeYaw(val)

    def recalculate(self):
        if (self.algorithm):
            self.algorithm.recalculateProb()

    def nextGeneration(self):
        if (self.algorithm):
            self.algorithm.calculateNewGeneration()
Example #20
0
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.map = MapWidget(self)
        self.logo = LogoWidget(self)
        self.tlLayout.addWidget(self.teleop)
        self.teleop.setVisible(True)
        self.mapLayout.addWidget(self.map)
        self.logoLayout.addWidget(self.logo)
        self.map.setVisible(True)
        self.logo.setVisible(True)

        self.pushButton.clicked.connect(self.playClicked)
        self.pushButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)

        self.stopButton.clicked.connect(self.stopClicked)

    def updateGUI(self):
        laserdata = self.laser.getLaserData()
        if (laserdata):
            self.map.setLaserValues(laserdata)
        self.map.update()

    def getPose3D(self):
        return self.pose3d

    def setPose3D(self, pose3d):
        self.pose3d = pose3d

    def getLaser(self):
        return self.laser

    def setLaser(self, laser):
        self.laser = laser

    def getBumper(self):
        return self.bumper

    def setBumper(self, bumper):
        self.bumper = bumper

    def getMotors(self):
        return self.motors

    def setMotors(self, motors):
        self.motors = motors

    def playClicked(self):
        if self.pushButton.isChecked():
            self.pushButton.setText('RUNNING')
            self.pushButton.setStyleSheet("background-color: green")
            self.algorithm.play()
        else:
            self.pushButton.setText('STOPPED')
            self.pushButton.setStyleSheet("background-color: red")
            self.algorithm.stop()

    def setAlgorithm(self, algorithm):
        self.algorithm = algorithm

    def getAlgorithm(self):
        return self.algorithm

    def setXYValues(self, newX, newY):
        myW = -newX * self.motors.getMaxW()
        myV = -newY * self.motors.getMaxV()
        self.motors.sendV(myV)
        self.motors.sendW(myW)

    def stopClicked(self):
        self.motors.sendV(0)
        self.motors.sendW(0)
        self.teleop.returnToOrigin()
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.map=MapWidget(self)
        self.tlLayout.addWidget(self.teleop)
        self.teleop.setVisible(True)
        self.mapLayout.addWidget(self.map)
        self.map.setVisible(True)

        self.pushButton.clicked.connect(self.playClicked)
        self.pushButton.setCheckable(True)
        self.updGUI.connect(self.updateGUI)
        self.camera1=CameraWidget(self)

        self.stopButton.clicked.connect(self.stopClicked)

    def updateGUI(self):
        self.camera1.updateImage()
        (cx, cy) = self.algorithm.getCarDirection()
        (ox, oy) = self.algorithm.getObstaclesDirection()
        (ax, ay) = self.algorithm.getAverageDirection()
        (tx, ty) = self.algorithm.getCurrentTarget()
        self.map.setCarArrow(cx, cy)
        self.map.setObstaclesArrow(ox, oy)
        self.map.setAverageArrow(ax, ay)
        self.map.setTarget(tx, ty, self.sensor.getRobotX(), self.sensor.getRobotY(), self.sensor.getRobotTheta())
        self.map.setLaserValues(self.sensor.getLaserData())
        self.map.update()

    def getSensor(self):
        return self.sensor

    def setSensor(self,sensor):
        self.sensor=sensor

    def playClicked(self):
        self.sensor.setPlayButton(self.pushButton.isChecked())
        if self.pushButton.isChecked():
            self.pushButton.setText('RUNNING')
            self.pushButton.setStyleSheet("background-color: green")
        else:
            self.pushButton.setText('STOPPED')
            self.pushButton.setStyleSheet("background-color: red")

    def setAlgorithm(self, algorithm ):
        self.algorithm=algorithm

    def getAlgorithm(self):
        return self.algorithm

    def setXYValues(self,newX,newY):
        self.sensor.setV(-newY)
        self.sensor.setW(newX)

    def stopClicked(self):
        self.sensor.setV(0)
        self.sensor.setW(0)
        self.teleop.returnToOrigin()