Skip to content

Commit

Permalink
VW PQ: refactor filter controls
Browse files Browse the repository at this point in the history
* force filter motor2 and bremse8 while ACC is on
* set EPB on only while Sollbeschl <0 not <=0. try to fix 0m/s with EPB enabled fault
  • Loading branch information
dkiiv committed Dec 14, 2024
1 parent ad7d80b commit a51330f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions selfdrive/car/volkswagen/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def limit_jerk(accel, prev_accel, max_jerk, dt):
return prev_accel + delta_accel

def EPB_handler(CS, self, ACS_Sta_ADR, ACS_Sollbeschl, vEgo, stopping):
if ACS_Sta_ADR == 1 and ACS_Sollbeschl <= 0 and vEgo <= (18 * CV.KPH_TO_MS):
if ACS_Sta_ADR == 1 and ACS_Sollbeschl < 0 and vEgo <= (18 * CV.KPH_TO_MS):
if not self.EPB_enable: # First frame of EPB entry
self.EPB_counter = 0
self.EPB_brake = 0
Expand Down Expand Up @@ -308,9 +308,9 @@ def update(self, CC, CS, now_nanos):
if CS.acc_anz_stock["COUNTER"] != self.acc_anz_counter_last:
can_sends.append(self.CCS.filter_ACC_Anzeige(self.packer_pt, CANBUS.pt, CS.acc_anz_stock, self.ACC_anz_blind))
if self.frame % 2 or CS.motor2_stock != getattr(self, 'motor2_last', CS.motor2_stock): # 50hz / 20ms
can_sends.append(self.CCS.filter_motor2(self.packer_pt, CANBUS.cam, CS.motor2_stock, self.EPB_active))
can_sends.append(self.CCS.filter_motor2(self.packer_pt, CANBUS.cam, CS.motor2_stock, active = CS.acc_sys_stock["ACS_Sta_ADR"] == 1))
if CS.bremse8_stock["COUNTER"] != self.bremse8_counter_last:
can_sends.append(self.CCS.filter_bremse8(self.packer_pt, CANBUS.cam, CS.bremse8_stock, self.EPB_active))
can_sends.append(self.CCS.filter_bremse8(self.packer_pt, CANBUS.cam, CS.bremse8_stock, active = CS.acc_sys_stock["ACS_Sta_ADR"] == 1))
if CS.bremse11_stock["COUNTER"] != self.bremse11_counter_last:
can_sends.append(self.CCS.filter_bremse11(self.packer_pt, CANBUS.cam, CS.bremse11_stock, self.stopped))
if CS.gra_stock_values["COUNTER"] != self.gra_acc_counter_last:
Expand Down
8 changes: 4 additions & 4 deletions selfdrive/car/volkswagen/pqcan.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,17 @@ def create_motor2_control(packer, bus, motor2_stock):
# Bremse_8 : BR8_StaBrSyst 1 --> 0
# Motor_2 : GRA_Status 1 --> 0

def filter_motor2(packer, bus, motor2_car, epb_freigabe): # bus 0 --> 2
def filter_motor2(packer, bus, motor2_car, active): # bus 0 --> 2
values = motor2_car
if epb_freigabe:
if active:
values.update({
"GRA_Status": 1,
})
return packer.make_can_msg("Motor_2", bus, values)

def filter_bremse8(packer, bus, bremse8_car, epb_freigabe): # bus 0 --> 2
def filter_bremse8(packer, bus, bremse8_car, active): # bus 0 --> 2
values = bremse8_car
if epb_freigabe:
if active:
values.update({
"BR8_Sta_ACC_Anf": 1,
"BR8_Verz_EPB_akt": 0,
Expand Down

0 comments on commit a51330f

Please sign in to comment.