diff --git a/selfdrive/car/volkswagen/carcontroller.py b/selfdrive/car/volkswagen/carcontroller.py index fd7b7a412f0c05..e7c3f61d6a487a 100644 --- a/selfdrive/car/volkswagen/carcontroller.py +++ b/selfdrive/car/volkswagen/carcontroller.py @@ -41,7 +41,7 @@ def __init__(self, dbc_name, CP, VM): self.EPB_counter = 0 self.accel_diff = 0 self.long_deviation = 0 - self.long_ratelimit = 0 + self.long_jerklimit = 0 self.sm = messaging.SubMaster(['longitudinalPlanSP']) self.param_s = Params() @@ -159,14 +159,14 @@ def update(self, CC, CS, now_nanos): # SMA to EMA conversion: alpha = 2 / (n + 1) n = SMA-sample self.accel_diff = (0.0019 * (accel - self.accel_last)) + (1 - 0.0019) * self.accel_diff # 1000 SMA equivalence self.long_deviation = interp(abs(accel - self.accel_diff), [0, .2, .3], [.13, .1, 0]) # floating comfort band calculation - self.long_ratelimit = (0.007 * (clip(abs(accel), 0.7, 3))) + (1 - 0.007) * self.long_ratelimit # set jerk/rate limit based on accel + self.long_jerklimit = (0.007 * (clip(abs(accel), 0.7, 3))) + (1 - 0.007) * self.long_jerklimit # set jerk limit based on accel if self.CCS == pqcan and CC.longActive and actuators.accel <= 0 and CS.out.vEgoRaw <= 5: if not self.EPB_enable: self.EPB_counter = 0 # Reset frame counter when EPB_enable is first activated self.EPB_brake = 0 else: - self.EPB_brake = limit_jerk(accel, self.EPB_brake_last, self.long_ratelimit, 0.02) # 0.02 = 50hz + self.EPB_brake = limit_jerk(accel, self.EPB_brake_last, self.long_jerklimit, 0.02) # 0.02 = 50hz self.EPB_brake_last = self.EPB_brake self.EPB_enable = 1 else: @@ -188,7 +188,7 @@ def update(self, CC, CS, now_nanos): can_sends.append(self.CCS.create_epb_control(self.packer_pt, CANBUS.br, self.EPB_brake, self.EPB_enable)) can_sends.extend(self.CCS.create_acc_accel_control(self.packer_pt, CANBUS.pt, CS.acc_type, accel, acc_control, stopping, starting, CS.esp_hold_confirmation, - self.long_deviation, self.long_ratelimit)) + self.long_deviation, self.long_jerklimit)) # **** HUD Controls ***************************************************** #