This commit is contained in:
leo 2022-05-15 12:56:26 +02:00
parent d38f6b10d1
commit cfc12f3c49
Signed by: leo
GPG Key ID: 0DD993BFB2B307DB

8
Car.py
View File

@ -433,12 +433,13 @@ class Car():
#print(self.distToInter, self.minSpace, dts)
# Si on est bloqué dans une dépendance circulaire
maxInterTime = 0
if self.leader is None and self.timeAtInter >= 0:
cd, maxInterTime = self.circularLeaderDep(self.leaderAtInter, 0, 20)
if cd and self.timeAtInter >= maxInterTime:
self.forceThrough = True
# Ou si notre leader est bloqué devant un autre leader
if self.leader is None and self.leaderAtInter.v == 0 and self.leaderAtInter.leaderAtInter is not None and self.leaderAtInter.leaderAtInterDist > self.interMinSpace:
if self.leader is None and self.leaderAtInter.v == 0 and self.leaderAtInter.leaderAtInter is not None and self.leaderAtInter.leaderAtInterDist > self.interMinSpace and maxInterTime != -1:
self.forceThrough = True
# si on est suffisement loin de l'intersection (i.e on s'en fout du leader)
@ -476,7 +477,7 @@ class Car():
return False, 0
if car.forceThrough:
return False, 0
return False, -1
maxTimeStopped = max(maxTimeStopped, car.timeAtInter)
@ -488,6 +489,9 @@ class Car():
res2,mts2 = self.circularLeaderDep(car.leaderAtInter, maxTimeStopped, timeout)
maxTimeStopped = max(mts, mts2)
if min(mts, mts2) == -1:
return False, -1
return (res or res2), maxTimeStopped
def updateGraph(self, v, vmax, vsec, interVsec):