From 7e6549a4e8a93108c889e79c7976133002c8d3e3 Mon Sep 17 00:00:00 2001 From: Jason Young Date: Sat, 20 Nov 2021 23:42:13 -0500 Subject: [PATCH] borrow decel comp from HKG --- selfdrive/car/volkswagen/carcontroller.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/volkswagen/carcontroller.py b/selfdrive/car/volkswagen/carcontroller.py index 8f925f7841..e95694c074 100644 --- a/selfdrive/car/volkswagen/carcontroller.py +++ b/selfdrive/car/volkswagen/carcontroller.py @@ -1,4 +1,4 @@ -from common.numpy_fast import clip +from common.numpy_fast import clip, interp from cereal import car from selfdrive.config import Conversions as CV from selfdrive.car import apply_std_steer_torque_limits @@ -40,7 +40,12 @@ class CarController(): else: acc_status = CS.tsk_status - accel = clip(actuators.accel, P.ACCEL_MIN, P.ACCEL_MAX) if enabled else 0 + accel = actuators.accel if enabled else 0 + + if accel < 0: + accel = interp(accel - CS.out.aEgo, [-1.0, -0.5], [2 * accel, accel]) + + accel = clip(accel, P.ACCEL_MIN, P.ACCEL_MAX) if enabled else 0 acc_hold_request, acc_hold_release = False, False if actuators.longControlState == LongCtrlState.stopping: