Skip to content

Commit

Permalink
VW PQ: update AWV brake ramp logic
Browse files Browse the repository at this point in the history
* bugfix logic issue, brake would have been applied all the time otherwise
  • Loading branch information
dkiiv committed Nov 1, 2024
1 parent 42c99cf commit 2600079
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions selfdrive/car/volkswagen/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,12 @@ def update(self, CC, CS, now_nanos):
if self.CCS == pqcan and CC.longActive and actuators.accel <= 0 and CS.out.vEgoRaw <= 6:
accel = clip(actuators.accel, self.CCP.ACCEL_MIN, 0)
self.AWV_enable = 1
self.AWV_brake = clip(actuators.accel, self.CCP.ACCEL_MIN, 0)
self.AWV_brake = clip(actuators.accel, self.CCP.ACCEL_MIN, 0) * (max(0, CS.out.vEgo / 1.5) if CS.out.vEgoRaw <= 1.5 else 1)
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
self.AWV_brake *= max(0, CS.out.vEgo / 1.5) if CS.out.vEgoRaw <= 1.5 else 1
self.long_deviation = 0 # TODO: make dynamic again
self.long_ratelimit = 4 # TODO: make dynamic again

Expand Down

0 comments on commit 2600079

Please sign in to comment.