diff --git a/Car.py b/Car.py index 08cec49..6e7132c 100644 --- a/Car.py +++ b/Car.py @@ -433,7 +433,7 @@ class Car(): #print(self.distToInter, self.minSpace, dts) # Si on est bloqué dans une dépendance circulaire - if self.timeAtInter >= 0 and self.leader is None and self.circularLeaderDep(self.leaderAtInter, 20): + if self.timeAtInter >= 1 and self.leader is None and self.circularLeaderDep(self.leaderAtInter, 20): self.forceThrough = True # si on est suffisement loin de l'intersection (i.e on s'en fout du leader) diff --git a/main.py b/main.py index 1008cdb..cba0b1d 100644 --- a/main.py +++ b/main.py @@ -68,8 +68,6 @@ class MainWindow(QMainWindow): self.close() elif e.key() == Qt.Key_V: self.mainLoop.controller.vroomEnable = not self.mainLoop.controller.vroomEnable - elif e.key() == Qt.Key_S: - self.mainLoop.quickLoad() elif e.key() == Qt.Key_G: self.startMainLoop.emit() elif e.key() == Qt.Key_E: @@ -78,6 +76,8 @@ class MainWindow(QMainWindow): self.setPhTimerInterval.emit(17) elif e.key() == Qt.Key_F: self.setPhTimerInterval.emit(500) + else: + self.mainLoop.quickLoad(e.key()) def mousePressEvent(self, QMouseEvent): tran = self.ui.mainSurf.transform.inverted()[0] diff --git a/mainLoop.py b/mainLoop.py index 619760b..235bda7 100644 --- a/mainLoop.py +++ b/mainLoop.py @@ -4,11 +4,20 @@ from Map import Map from CarController import CarController from PySide6.QtWidgets import QFileDialog, QToolBox -from PySide6.QtCore import QElapsedTimer, QTimer, QElapsedTimer, QObject, Signal, Slot, QThread, QMutex +from PySide6.QtCore import QElapsedTimer, QTimer, QElapsedTimer, QObject, Signal, Slot, QThread, QMutex, Qt class mainLoop(QObject): updateFPS = Signal(int) mutex = QMutex() + + qlPresets = { + Qt.Key_0 : ["comp_inter.net.xml", "comp_inter.rou.xml"], + Qt.Key_1 : ["comp_inter.net.xml", "comp_inter_t2.rou.xml"], + Qt.Key_2 : ["comp_rdp.net.xml", "comp_rdp.rou.xml"], + Qt.Key_3 : ["comp_rdp.net.xml", "comp_rdp_t3.rou.xml"], + Qt.Key_4 : ["rdpt_polytech_fixed.net.xml", "rdpt_polytech_burst.rou.xml"], + Qt.Key_5 : ["rdpt_polytech_fixed.net.xml", "rdpt_polytech_burst_2.rou.xml"] + } def __init__(self, parent): super().__init__() @@ -87,10 +96,13 @@ class mainLoop(QObject): self.controller.prepareRoute() @threadSafe - def quickLoad(self): - self.map.fromPath("comp_rdp.net.xml") + def quickLoad(self, key): + paths = self.qlPresets.get(key) + if paths == None: + return + self.map.fromPath(paths[0]) self.painter.generateTransform() - self.controller.fromPath("comp_rdp.rou.xml") + self.controller.fromPath(paths[1]) self.controller.prepareRoute() def updateFps(self):