From c3eec36f4f7e8ec2d10252a900e3376b2c2bf863 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 7 Aug 2024 13:15:00 -0400 Subject: [PATCH 1/2] speed logic --- selfdrive/controls/controlsd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index eba02394c8..b9ee81ed9a 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -829,7 +829,7 @@ class Controls: self.prev_overtaking_accel_engaged = self.overtaking_accel_engaged ttc = self.sm['radarState'].leadOne.dRel / CS.vEgo if CS.vEgo > 0 else 255 overtaking_accel_engaged = self.overtaking_accel and overtaking_accel_allowed and \ - CS.vEgo > (60 * CV.KPH_TO_MS) if self.is_metric else (40 * CV.MPH_TO_MS) and long_plan.hasLead and \ + (CS.vEgo > ((60 * CV.KPH_TO_MS) if self.is_metric else (40 * CV.MPH_TO_MS))) and long_plan.hasLead and \ long_plan.aTarget > -0.2 and not (CS.leftBlinker and CS.rightBlinker) and ttc > 0.75 if ttc <= 0.75 and self.prev_overtaking_accel_engaged and overtaking_accel_engaged: overtaking_accel_engaged = False From 560b6e79bc86916364062e9c756224b37daf8239 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Wed, 7 Aug 2024 13:23:40 -0400 Subject: [PATCH 2/2] more checks --- selfdrive/controls/controlsd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index b9ee81ed9a..6d1cc2b531 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -830,7 +830,7 @@ class Controls: ttc = self.sm['radarState'].leadOne.dRel / CS.vEgo if CS.vEgo > 0 else 255 overtaking_accel_engaged = self.overtaking_accel and overtaking_accel_allowed and \ (CS.vEgo > ((60 * CV.KPH_TO_MS) if self.is_metric else (40 * CV.MPH_TO_MS))) and long_plan.hasLead and \ - long_plan.aTarget > -0.2 and not (CS.leftBlinker and CS.rightBlinker) and ttc > 0.75 + long_plan.aTarget > -0.2 and not (CS.leftBlinker and CS.rightBlinker) and (0.75 < ttc < 3.0) if ttc <= 0.75 and self.prev_overtaking_accel_engaged and overtaking_accel_engaged: overtaking_accel_engaged = False if overtaking_accel_engaged and not self.prev_overtaking_accel_engaged: