Пример #1
0
    def __init__(self, grid, pose3d, start):
        self.grid = grid
        self.pose3d = pose3d
        self.grid.initPose(self.pose3d.getPose3d().x,
                           self.pose3d.getPose3d().y,
                           self.pose3d.getPose3d().yaw)
        
        self.kill_event = threading.Event()
        
        self.thread = ThreadSensor(self, self.kill_event)

        self.thread.daemon = True
        if start:
            self.start()
Пример #2
0
class Sensor(threading.Thread):

    def __init__(self, grid, pose3d, start):
        self.grid = grid
        self.pose3d = pose3d
        self.grid.initPose(self.pose3d.getPose3d().x,
                           self.pose3d.getPose3d().y,
                           self.pose3d.getPose3d().yaw)
        
        self.kill_event = threading.Event()
        
        self.thread = ThreadSensor(self, self.kill_event)

        self.thread.daemon = True
        if start:
            self.start()

    # if client is stopped you can not start again, Threading.Thread raised error
    def start(self):
        self.kill_event.clear()
        self.thread.start()

    # if client is stopped you can not start again
    def stop(self):
        self.kill_event.set()

    def update(self):
        self.grid.updatePose(self.pose3d.getPose3d().x,
                             self.pose3d.getPose3d().y,
                             self.pose3d.getPose3d().yaw)

    def setGetPathSignal(self, signal):
        self.getPathSig = signal

    def getPose3D(self):
        return self.pose3d.getPose3d()

    def getRobotX(self):
        return self.pose3d.getPose3d().x

    def getRobotY(self):
        return self.pose3d.getPose3d().y

    def getRobotTheta(self):
        return self.pose3d.getPose3d().yaw
Пример #3
0
from PyQt4 import QtCore, QtGui
from gui.GUI import MainWindow
from gui.threadGUI import ThreadGUI
from sensors.sensor import Sensor
from sensors.threadSensor import ThreadSensor
from MyAlgorithm import MyAlgorithm




if __name__ == "__main__":
    sensor = Sensor()
    algorithm=MyAlgorithm(sensor)

    app = QtGui.QApplication(sys.argv)
    myGUI = MainWindow()
    myGUI.setSensor(sensor)
    myGUI.setAlgorithm(algorithm)
    myGUI.show()

    t1 = ThreadSensor(sensor,algorithm)
    t1.daemon=True
    t1.start()

    t2 = ThreadGUI(myGUI)
    t2.daemon=True
    t2.start()


    sys.exit(app.exec_())
Пример #4
0
from sensors.camera import Camera
from actuators.motors import Motors
from sensors.threadSensor import ThreadSensor
from gui.threadGUI import ThreadGUI
from gui.GUI import MainWindow
from PyQt4 import QtGui

import signal

signal.signal(signal.SIGINT, signal.SIG_DFL)

if __name__ == '__main__':
    camera = Camera()
    motors = Motors()

    app = QtGui.QApplication(sys.argv)
    frame = MainWindow()
    frame.setMotors(motors)
    frame.setCamera(camera)
    frame.show()

    t1 = ThreadSensor(camera)
    t1.daemon = True
    t1.start()

    t2 = ThreadGUI(frame)
    t2.daemon = True
    t2.start()

    sys.exit(app.exec_())