Skip to content

Commit

Permalink
VW PQ: update car API and PIF
Browse files Browse the repository at this point in the history
  • Loading branch information
dkiiv committed Nov 11, 2024
1 parent a2948f4 commit 55ec0fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions selfdrive/car/volkswagen/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ def update(self, CC, CS, now_nanos):
accel = clip(actuators.accel, self.CCP.ACCEL_MIN, self.CCP.ACCEL_MAX) if CC.longActive else 0
# 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], [.2, .15, 0]) # floating comfort band calculation
self.long_deviation = interp(abs(accel - self.accel_diff), [0, .3, .4], [.2, .2, 0]) # floating comfort band calculation
self.long_jerklimit = (0.007 * (clip(abs(accel), 0.7, 2))) + (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_jerklimit, 0.02) # 0.02 = 50hz
self.EPB_brake = limit_jerk(accel, self.EPB_brake_last, 0.7, 0.01)
self.EPB_brake_last = self.EPB_brake
self.EPB_enable = 1
else:
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/car/volkswagen/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def _get_params(ret, candidate: CAR, fingerprint, car_fw, experimental_long, doc
ret.longitudinalTuning.kf = 1.
ret.longitudinalTuning.kpBP = [0.]
ret.longitudinalTuning.kpV = [0.]
ret.longitudinalTuning.kiBP = [0., 22, 35]
ret.longitudinalTuning.kiV = [2.8, 2., 1.9]
ret.longitudinalTuning.kiBP = [0., 11, 22, 35]
ret.longitudinalTuning.kiV = [3.2, 2.3, 2., 1.9]
ret.longitudinalActuatorDelay = 0.6
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
else:
Expand Down

0 comments on commit 55ec0fa

Please sign in to comment.