Skip to content

Commit

Permalink
VW: update variable name
Browse files Browse the repository at this point in the history
* change from ratelimit to jerklimit
  • Loading branch information
dkiiv committed Nov 8, 2024
1 parent ccf480b commit 3c2ad0b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions selfdrive/car/volkswagen/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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:
Expand All @@ -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 ***************************************************** #

Expand Down

0 comments on commit 3c2ad0b

Please sign in to comment.