From 45d9a43b1d32003c7d6a1e373d73ea0e963a1d4f Mon Sep 17 00:00:00 2001 From: Jason Young Date: Tue, 13 Sep 2022 21:45:16 -0400 Subject: [PATCH] partial FtS/basic support --- selfdrive/car/volkswagen/carcontroller.py | 4 ++-- selfdrive/car/volkswagen/carstate.py | 1 + selfdrive/car/volkswagen/mqbcan.py | 4 ++-- selfdrive/car/volkswagen/pqcan.py | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/selfdrive/car/volkswagen/carcontroller.py b/selfdrive/car/volkswagen/carcontroller.py index 0436d3de0..4db3e5992 100644 --- a/selfdrive/car/volkswagen/carcontroller.py +++ b/selfdrive/car/volkswagen/carcontroller.py @@ -74,8 +74,8 @@ class CarController: accel = clip(actuators.accel, self.CCP.ACCEL_MIN, self.CCP.ACCEL_MAX) if CC.longActive else 0 stopping = actuators.longControlState == LongCtrlState.stopping starting = actuators.longControlState == LongCtrlState.starting - can_sends.extend(self.CCS.create_acc_accel_control(self.packer_pt, CANBUS.pt, CC.longActive, acc_status, accel, - stopping, starting, CS.out.cruiseState.standstill)) + can_sends.extend(self.CCS.create_acc_accel_control(self.packer_pt, CANBUS.pt, CS.acc_type, CC.longActive, accel, + acc_status, stopping, starting, CS.out.cruiseState.standstill)) # **** HUD Controls ***************************************************** # diff --git a/selfdrive/car/volkswagen/carstate.py b/selfdrive/car/volkswagen/carstate.py index 3ed4956d8..d799bf5a5 100644 --- a/selfdrive/car/volkswagen/carstate.py +++ b/selfdrive/car/volkswagen/carstate.py @@ -218,6 +218,7 @@ class CarState(CarStateBase): ret.stockAeb = False # Update ACC radar status. + self.acc_type = 0 # TODO: this is ACC "basic" with nonzero min speed, support FtS (1) later ret.cruiseState.available = bool(pt_cp.vl["Motor_5"]["GRA_Hauptschalter"]) ret.cruiseState.enabled = bool(pt_cp.vl["Motor_2"]["GRA_Status"]) if self.CP.pcmCruise: diff --git a/selfdrive/car/volkswagen/mqbcan.py b/selfdrive/car/volkswagen/mqbcan.py index e3a1e14a7..30b1dbd7f 100644 --- a/selfdrive/car/volkswagen/mqbcan.py +++ b/selfdrive/car/volkswagen/mqbcan.py @@ -64,11 +64,11 @@ def acc_hud_status_value(main_switch_on, acc_faulted, long_active): return hud_status -def create_acc_accel_control(packer, bus, enabled, acc_status, accel, stopping, starting, standstill): +def create_acc_accel_control(packer, bus, acc_type, enabled, accel, acc_status, stopping, starting, standstill): commands = [] acc_06_values = { - "ACC_Typ": 2, # TODO: fixed requirement for SnG stopping coordinator, allow FtS and basic later + "ACC_Typ": acc_type, "ACC_Status_ACC": acc_status, "ACC_StartStopp_Info": enabled, "ACC_Sollbeschleunigung_02": accel if enabled else 3.01, diff --git a/selfdrive/car/volkswagen/pqcan.py b/selfdrive/car/volkswagen/pqcan.py index 8a711e703..8adcdfa58 100644 --- a/selfdrive/car/volkswagen/pqcan.py +++ b/selfdrive/car/volkswagen/pqcan.py @@ -59,11 +59,11 @@ def acc_hud_status_value(main_switch_on, acc_faulted, long_active): return hud_status -def create_acc_accel_control(packer, bus, enabled, acc_status, accel, stopping, starting, standstill): +def create_acc_accel_control(packer, bus, acc_type, enabled, accel, acc_status, stopping, starting, standstill): values = { "ACS_Sta_ADR": acc_status, "ACS_StSt_Info": acc_status != 1, - "ACS_Typ_ACC": 0, # TODO: this is ACC "basic", find a way to detect FtS support (1) + "ACS_Typ_ACC": acc_type, "ACS_Sollbeschl": accel if acc_status == 1 else 3.01, "ACS_zul_Regelabw": 0.2 if acc_status == 1 else 1.27, "ACS_max_AendGrad": 3.0 if acc_status == 1 else 5.08,