From e980ccdc2b53811076810415479fa7bf5307d1fc Mon Sep 17 00:00:00 2001 From: actuallylemoncurd Date: Sat, 2 Nov 2024 14:51:18 -0400 Subject: [PATCH] VW PQ: bugfixing AWV controls * make halten latch * fix ramping? --- selfdrive/car/volkswagen/carcontroller.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/volkswagen/carcontroller.py b/selfdrive/car/volkswagen/carcontroller.py index 8788434a112fc7..dab09f94b68b89 100644 --- a/selfdrive/car/volkswagen/carcontroller.py +++ b/selfdrive/car/volkswagen/carcontroller.py @@ -159,14 +159,17 @@ def update(self, CC, CS, now_nanos): accel = clip(actuators.accel, self.CCP.ACCEL_MIN, 0) self.AWV_enable = 1 if self.AWV_halten: - self.AWV_brake *= max(0, CS.out.vEgo / 1.5) + self.AWV_brake = min(self.AWV_brake + abs(self.AWV_brake) / 7, 0) else: self.AWV_brake = clip(actuators.accel, self.CCP.ACCEL_MIN, 0) else: accel = clip(actuators.accel, self.CCP.ACCEL_MIN, self.CCP.ACCEL_MAX) if CC.longActive else 0 self.AWV_enable = 0 if CS.out.vEgoRaw >= 6 else self.AWV_enable self.AWV_brake = 0 - self.AWV_halten = 1 if CS.out.vEgoRaw <= 3 and self.AWV_enable else 0 + if self.AWV_enable and CS.out.vEgoRaw <= 3: + self.AWV_halten = 1 + elif CS.out.vEgoRaw >= 4 or not self.AWV_enable: + self.AWV_halten = 0 self.long_deviation = 0 # TODO: make dynamic again self.long_ratelimit = 4 # TODO: make dynamic again