From ef9dee71b0484fedcb4179c7f02f939605d73f64 Mon Sep 17 00:00:00 2001 From: bravochar <4663128+bravochar@users.noreply.github.com> Date: Wed, 11 Sep 2024 09:47:35 -0400 Subject: [PATCH 01/12] Update fingerprint for 2023 Ascent --- opendbc/car/subaru/fingerprints.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opendbc/car/subaru/fingerprints.py b/opendbc/car/subaru/fingerprints.py index 3c61915fc5..fe1fb2cdbc 100644 --- a/opendbc/car/subaru/fingerprints.py +++ b/opendbc/car/subaru/fingerprints.py @@ -45,9 +45,11 @@ ], (Ecu.engine, 0x7a2, None): [ b'\xe5,\xa0P\x07', + b'\xe5,\xa0p\x07', ], (Ecu.transmission, 0x7a3, None): [ b'\x04\xfe\xf3\x00\x00', + b'\x04\xfe\xf6\x00\x00', ], }, CAR.SUBARU_LEGACY: { From dbaf34e63f2cc41f5723039e85dba8db0ba2c714 Mon Sep 17 00:00:00 2001 From: bravochar <4663128+bravochar@users.noreply.github.com> Date: Wed, 11 Sep 2024 09:55:37 -0400 Subject: [PATCH 02/12] Remove engine and transmission ECUs Mentioned in @martinl PR, and it seems these are no longer queries/returned in my vehicle --- opendbc/car/subaru/fingerprints.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/opendbc/car/subaru/fingerprints.py b/opendbc/car/subaru/fingerprints.py index fe1fb2cdbc..0218230bf3 100644 --- a/opendbc/car/subaru/fingerprints.py +++ b/opendbc/car/subaru/fingerprints.py @@ -43,14 +43,6 @@ (Ecu.fwdCamera, 0x787, None): [ b'\x05!\x08\x1dK\x05!\x08\x01/', ], - (Ecu.engine, 0x7a2, None): [ - b'\xe5,\xa0P\x07', - b'\xe5,\xa0p\x07', - ], - (Ecu.transmission, 0x7a3, None): [ - b'\x04\xfe\xf3\x00\x00', - b'\x04\xfe\xf6\x00\x00', - ], }, CAR.SUBARU_LEGACY: { (Ecu.abs, 0x7b0, None): [ From 46f638c40350b55737728d9e57647ef0b323f669 Mon Sep 17 00:00:00 2001 From: bravochar <4663128+bravochar@users.noreply.github.com> Date: Wed, 11 Sep 2024 10:21:13 -0400 Subject: [PATCH 03/12] Add LKAS_ANGLE lat controls Shamelessley copied from jnewb1 to support my 2023 Ascent --- opendbc/car/subaru/carcontroller.py | 48 ++++++++++++++++++----------- opendbc/car/subaru/carstate.py | 16 +++++++--- opendbc/car/subaru/interface.py | 5 +++ opendbc/car/subaru/values.py | 5 ++- 4 files changed, 50 insertions(+), 24 deletions(-) diff --git a/opendbc/car/subaru/carcontroller.py b/opendbc/car/subaru/carcontroller.py index 4ee3655268..46600512c7 100644 --- a/opendbc/car/subaru/carcontroller.py +++ b/opendbc/car/subaru/carcontroller.py @@ -1,6 +1,6 @@ import copy from opendbc.can.packer import CANPacker -from opendbc.car import apply_driver_steer_torque_limits, common_fault_avoidance, make_tester_present_msg +from opendbc.car import apply_driver_steer_torque_limits, common_fault_avoidance, make_tester_present_msg, apply_std_steer_angle_limits from opendbc.car.common.numpy_fast import clip, interp from opendbc.car.interfaces import CarControllerBase from opendbc.car.subaru import subarucan @@ -32,26 +32,35 @@ def update(self, CC, CS, now_nanos): # *** steering *** if (self.frame % self.p.STEER_STEP) == 0: - apply_steer = int(round(actuators.steer * self.p.STEER_MAX)) + if self.CP.flags & SubaruFlags.LKAS_ANGLE: + apply_steer = apply_std_steer_angle_limits(actuators.steeringAngleDeg, self.apply_steer_last, CS.out.vEgoRaw, self.p) - # limits due to driver torque + if not CC.latActive: + apply_steer = CS.out.steeringAngleDeg - new_steer = int(round(apply_steer)) - apply_steer = apply_driver_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorque, self.p) + can_sends.append(subarucan.create_steering_control_angle(self.packer, apply_steer, CC.latActive)) - if not CC.latActive: - apply_steer = 0 - - if self.CP.flags & SubaruFlags.PREGLOBAL: - can_sends.append(subarucan.create_preglobal_steering_control(self.packer, self.frame // self.p.STEER_STEP, apply_steer, CC.latActive)) else: - apply_steer_req = CC.latActive + apply_steer = int(round(actuators.steer * self.p.STEER_MAX)) + + # limits due to driver torque - if self.CP.flags & SubaruFlags.STEER_RATE_LIMITED: - # Steering rate fault prevention - self.steer_rate_counter, apply_steer_req = \ - common_fault_avoidance(abs(CS.out.steeringRateDeg) > MAX_STEER_RATE, apply_steer_req, - self.steer_rate_counter, MAX_STEER_RATE_FRAMES) + new_steer = int(round(apply_steer)) + apply_steer = apply_driver_steer_torque_limits(new_steer, self.apply_steer_last, CS.out.steeringTorque, self.p) + + if not CC.latActive: + apply_steer = 0 + + if self.CP.flags & SubaruFlags.PREGLOBAL: + can_sends.append(subarucan.create_preglobal_steering_control(self.packer, self.frame // self.p.STEER_STEP, apply_steer, CC.latActive)) + else: + apply_steer_req = CC.latActive + + if self.CP.flags & SubaruFlags.STEER_RATE_LIMITED: + # Steering rate fault prevention + self.steer_rate_counter, apply_steer_req = \ + common_fault_avoidance(abs(CS.out.steeringRateDeg) > MAX_STEER_RATE, apply_steer_req, + self.steer_rate_counter, MAX_STEER_RATE_FRAMES) can_sends.append(subarucan.create_steering_control(self.packer, apply_steer, apply_steer_req)) @@ -137,8 +146,11 @@ def update(self, CC, CS, now_nanos): can_sends.append(subarucan.create_es_static_2(self.packer)) new_actuators = copy.copy(actuators) - new_actuators.steer = self.apply_steer_last / self.p.STEER_MAX - new_actuators.steerOutputCan = self.apply_steer_last + if self.CP.flags & SubaruFlags.LKAS_ANGLE: + new_actuators.steeringAngleDeg = self.apply_steer_last + else: + new_actuators.steer = self.apply_steer_last / self.p.STEER_MAX + new_actuators.steerOutputCan = self.apply_steer_last self.frame += 1 return new_actuators, can_sends diff --git a/opendbc/car/subaru/carstate.py b/opendbc/car/subaru/carstate.py index 84fa215815..e5a22bbe0f 100644 --- a/opendbc/car/subaru/carstate.py +++ b/opendbc/car/subaru/carstate.py @@ -74,13 +74,19 @@ def update(self, cp, cp_cam, _, cp_body, __) -> structs.CarState: steer_threshold = 75 if self.CP.flags & SubaruFlags.PREGLOBAL else 80 ret.steeringPressed = abs(ret.steeringTorque) > steer_threshold - cp_cruise = cp_body if self.CP.flags & SubaruFlags.GLOBAL_GEN2 else cp - if self.CP.flags & SubaruFlags.HYBRID: - ret.cruiseState.enabled = cp_cam.vl["ES_DashStatus"]['Cruise_Activated'] != 0 + if self.CP.flags & SubaruFlags.LKAS_ANGLE: + cp_es_status = cp_body if self.CP.flags & SubaruFlags.GLOBAL_GEN2 else cp_cam + ret.cruiseState.enabled = cp_es_status.vl["ES_Status"]['Cruise_Activated'] != 0 ret.cruiseState.available = cp_cam.vl["ES_DashStatus"]['Cruise_On'] != 0 + else: - ret.cruiseState.enabled = cp_cruise.vl["CruiseControl"]["Cruise_Activated"] != 0 - ret.cruiseState.available = cp_cruise.vl["CruiseControl"]["Cruise_On"] != 0 + cp_cruise = cp_body if self.CP.flags & SubaruFlags.GLOBAL_GEN2 else cp + if self.CP.flags & SubaruFlags.HYBRID: + ret.cruiseState.enabled = cp_cam.vl["ES_DashStatus"]['Cruise_Activated'] != 0 + ret.cruiseState.available = cp_cam.vl["ES_DashStatus"]['Cruise_On'] != 0 + else: + ret.cruiseState.enabled = cp_cruise.vl["CruiseControl"]["Cruise_Activated"] != 0 + ret.cruiseState.available = cp_cruise.vl["CruiseControl"]["Cruise_On"] != 0 ret.cruiseState.speed = cp_cam.vl["ES_DashStatus"]["Cruise_Set_Speed"] * CV.KPH_TO_MS if (self.CP.flags & SubaruFlags.PREGLOBAL and cp.vl["Dash_State2"]["UNITS"] == 1) or \ diff --git a/opendbc/car/subaru/interface.py b/opendbc/car/subaru/interface.py index 782f73e8c6..c0ea9e6971 100644 --- a/opendbc/car/subaru/interface.py +++ b/opendbc/car/subaru/interface.py @@ -30,6 +30,9 @@ def _get_params(ret: structs.CarParams, candidate: CAR, fingerprint, car_fw, exp ret.safetyConfigs = [get_safety_config(structs.CarParams.SafetyModel.subaru)] if ret.flags & SubaruFlags.GLOBAL_GEN2: ret.safetyConfigs[0].safetyParam |= Panda.FLAG_SUBARU_GEN2 + if ret.flags & SubaruFlags.LKAS_ANGLE: + ret.safetyConfigs[0].safetyParam |= Panda.FLAG_SUBARU_LKAS_ANGLE + ret.safetyConfigs[0].safetyParam |= Panda.FLAG_SUBARU_ES_STATUS ret.steerLimitTimer = 0.4 ret.steerActuatorDelay = 0.1 @@ -45,6 +48,8 @@ def _get_params(ret: structs.CarParams, candidate: CAR, fingerprint, car_fw, exp ret.lateralTuning.pid.kf = 0.00003 ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0., 20.], [0., 20.]] ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.0025, 0.1], [0.00025, 0.01]] + if candidate == CAR.SUBARU_ASCENT_2023: + ret.dashcamOnly = False elif candidate == CAR.SUBARU_IMPREZA: ret.steerActuatorDelay = 0.4 # end-to-end angle controller diff --git a/opendbc/car/subaru/values.py b/opendbc/car/subaru/values.py index c7f93f9fae..4d0f0b0747 100644 --- a/opendbc/car/subaru/values.py +++ b/opendbc/car/subaru/values.py @@ -2,7 +2,7 @@ from enum import Enum, IntFlag from panda import uds -from opendbc.car import CarSpecs, DbcDict, PlatformConfig, Platforms, dbc_dict +from opendbc.car import CarSpecs, DbcDict, PlatformConfig, Platforms, dbc_dict, AngleRateLimit from opendbc.car.structs import CarParams from opendbc.car.docs_definitions import CarFootnote, CarHarness, CarDocs, CarParts, Tool, Column from opendbc.car.fw_query_definitions import FwQueryConfig, Request, StdQueries, p16 @@ -27,6 +27,9 @@ def __init__(self, CP): elif CP.carFingerprint == CAR.SUBARU_IMPREZA_2020: self.STEER_DELTA_UP = 35 self.STEER_MAX = 1439 + elif CP.flags & SubaruFlags.LKAS_ANGLE: + self.ANGLE_RATE_LIMIT_UP = AngleRateLimit(speed_bp=[0.], angle_v=[1.]) + self.ANGLE_RATE_LIMIT_DOWN = AngleRateLimit(speed_bp=[0.], angle_v=[1.]) else: self.STEER_MAX = 2047 From f5d6fe34734ec1fb80ede533cb7df687d841982e Mon Sep 17 00:00:00 2001 From: bravochar <4663128+bravochar@users.noreply.github.com> Date: Wed, 11 Sep 2024 10:43:21 -0400 Subject: [PATCH 04/12] Add engine/transmission to extra ECUS for Subarus --- opendbc/car/subaru/values.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/opendbc/car/subaru/values.py b/opendbc/car/subaru/values.py index 4d0f0b0747..30ca439b2f 100644 --- a/opendbc/car/subaru/values.py +++ b/opendbc/car/subaru/values.py @@ -274,7 +274,13 @@ class CAR(Platforms): # We don't get the EPS from non-OBD queries on GEN2 cars. Note that we still attempt to match when it exists non_essential_ecus={ Ecu.eps: list(CAR.with_flags(SubaruFlags.GLOBAL_GEN2)), - } + }, + extra_ecus=[ + (Ecu.engine, 0x7e0, None), + (Ecu.engine, 0x7e2, None), + (Ecu.transmission, 0x7e1, None), + (Ecu.transmission, 0x7a3, None), + ], ) DBC = CAR.create_dbc_map() From fe317c2729ec2b2551e533b2e03f85c32ddad5a8 Mon Sep 17 00:00:00 2001 From: bravochar <4663128+bravochar@users.noreply.github.com> Date: Wed, 11 Sep 2024 12:32:40 -0400 Subject: [PATCH 05/12] Subaru: add fwdCamera to non_essential for ANGLE_LKAS cars --- opendbc/car/subaru/values.py | 1 + 1 file changed, 1 insertion(+) diff --git a/opendbc/car/subaru/values.py b/opendbc/car/subaru/values.py index 30ca439b2f..632fc469e2 100644 --- a/opendbc/car/subaru/values.py +++ b/opendbc/car/subaru/values.py @@ -274,6 +274,7 @@ class CAR(Platforms): # We don't get the EPS from non-OBD queries on GEN2 cars. Note that we still attempt to match when it exists non_essential_ecus={ Ecu.eps: list(CAR.with_flags(SubaruFlags.GLOBAL_GEN2)), + Ecu.fwdCamera: list(CAR.with_flags(SubaruFlags.LKAS_ANGLE)), }, extra_ecus=[ (Ecu.engine, 0x7e0, None), From 860fa0986f0af826dd9d8e5bd101e1f46ea110b6 Mon Sep 17 00:00:00 2001 From: bravochar <4663128+bravochar@users.noreply.github.com> Date: Wed, 11 Sep 2024 16:13:25 -0400 Subject: [PATCH 06/12] Update fingerprints --- opendbc/car/subaru/fingerprints.py | 1 + 1 file changed, 1 insertion(+) diff --git a/opendbc/car/subaru/fingerprints.py b/opendbc/car/subaru/fingerprints.py index 0218230bf3..9b59b341a7 100644 --- a/opendbc/car/subaru/fingerprints.py +++ b/opendbc/car/subaru/fingerprints.py @@ -42,6 +42,7 @@ ], (Ecu.fwdCamera, 0x787, None): [ b'\x05!\x08\x1dK\x05!\x08\x01/', + b'\x05!\x08\x1dK\x00\x00\x00\x00\x00', ], }, CAR.SUBARU_LEGACY: { From a053a61db4349025ead1c8816ae4b601b68a8011 Mon Sep 17 00:00:00 2001 From: Charlie <4663128+bravochar@users.noreply.github.com> Date: Thu, 12 Sep 2024 17:03:28 +0000 Subject: [PATCH 07/12] Fixes for failing tests scope errors, non-existent variables, other silly things --- opendbc/car/subaru/carcontroller.py | 3 ++- opendbc/car/subaru/carstate.py | 3 ++- opendbc/car/subaru/interface.py | 1 - opendbc/car/subaru/values.py | 6 +++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/opendbc/car/subaru/carcontroller.py b/opendbc/car/subaru/carcontroller.py index 46600512c7..1be4735774 100644 --- a/opendbc/car/subaru/carcontroller.py +++ b/opendbc/car/subaru/carcontroller.py @@ -32,6 +32,7 @@ def update(self, CC, CS, now_nanos): # *** steering *** if (self.frame % self.p.STEER_STEP) == 0: + apply_steer = 0 if self.CP.flags & SubaruFlags.LKAS_ANGLE: apply_steer = apply_std_steer_angle_limits(actuators.steeringAngleDeg, self.apply_steer_last, CS.out.vEgoRaw, self.p) @@ -62,7 +63,7 @@ def update(self, CC, CS, now_nanos): common_fault_avoidance(abs(CS.out.steeringRateDeg) > MAX_STEER_RATE, apply_steer_req, self.steer_rate_counter, MAX_STEER_RATE_FRAMES) - can_sends.append(subarucan.create_steering_control(self.packer, apply_steer, apply_steer_req)) + can_sends.append(subarucan.create_steering_control(self.packer, apply_steer, apply_steer_req)) self.apply_steer_last = apply_steer diff --git a/opendbc/car/subaru/carstate.py b/opendbc/car/subaru/carstate.py index e5a22bbe0f..d71ab5407e 100644 --- a/opendbc/car/subaru/carstate.py +++ b/opendbc/car/subaru/carstate.py @@ -74,19 +74,20 @@ def update(self, cp, cp_cam, _, cp_body, __) -> structs.CarState: steer_threshold = 75 if self.CP.flags & SubaruFlags.PREGLOBAL else 80 ret.steeringPressed = abs(ret.steeringTorque) > steer_threshold + cp_cruise = cp_body if self.CP.flags & SubaruFlags.GLOBAL_GEN2 else cp if self.CP.flags & SubaruFlags.LKAS_ANGLE: cp_es_status = cp_body if self.CP.flags & SubaruFlags.GLOBAL_GEN2 else cp_cam ret.cruiseState.enabled = cp_es_status.vl["ES_Status"]['Cruise_Activated'] != 0 ret.cruiseState.available = cp_cam.vl["ES_DashStatus"]['Cruise_On'] != 0 else: - cp_cruise = cp_body if self.CP.flags & SubaruFlags.GLOBAL_GEN2 else cp if self.CP.flags & SubaruFlags.HYBRID: ret.cruiseState.enabled = cp_cam.vl["ES_DashStatus"]['Cruise_Activated'] != 0 ret.cruiseState.available = cp_cam.vl["ES_DashStatus"]['Cruise_On'] != 0 else: ret.cruiseState.enabled = cp_cruise.vl["CruiseControl"]["Cruise_Activated"] != 0 ret.cruiseState.available = cp_cruise.vl["CruiseControl"]["Cruise_On"] != 0 + ret.cruiseState.speed = cp_cam.vl["ES_DashStatus"]["Cruise_Set_Speed"] * CV.KPH_TO_MS if (self.CP.flags & SubaruFlags.PREGLOBAL and cp.vl["Dash_State2"]["UNITS"] == 1) or \ diff --git a/opendbc/car/subaru/interface.py b/opendbc/car/subaru/interface.py index c0ea9e6971..a03c742ab5 100644 --- a/opendbc/car/subaru/interface.py +++ b/opendbc/car/subaru/interface.py @@ -32,7 +32,6 @@ def _get_params(ret: structs.CarParams, candidate: CAR, fingerprint, car_fw, exp ret.safetyConfigs[0].safetyParam |= Panda.FLAG_SUBARU_GEN2 if ret.flags & SubaruFlags.LKAS_ANGLE: ret.safetyConfigs[0].safetyParam |= Panda.FLAG_SUBARU_LKAS_ANGLE - ret.safetyConfigs[0].safetyParam |= Panda.FLAG_SUBARU_ES_STATUS ret.steerLimitTimer = 0.4 ret.steerActuatorDelay = 0.1 diff --git a/opendbc/car/subaru/values.py b/opendbc/car/subaru/values.py index 632fc469e2..47105b77df 100644 --- a/opendbc/car/subaru/values.py +++ b/opendbc/car/subaru/values.py @@ -27,9 +27,6 @@ def __init__(self, CP): elif CP.carFingerprint == CAR.SUBARU_IMPREZA_2020: self.STEER_DELTA_UP = 35 self.STEER_MAX = 1439 - elif CP.flags & SubaruFlags.LKAS_ANGLE: - self.ANGLE_RATE_LIMIT_UP = AngleRateLimit(speed_bp=[0.], angle_v=[1.]) - self.ANGLE_RATE_LIMIT_DOWN = AngleRateLimit(speed_bp=[0.], angle_v=[1.]) else: self.STEER_MAX = 2047 @@ -56,6 +53,9 @@ def __init__(self, CP): BRAKE_LOOKUP_BP = [-3.5, 0] BRAKE_LOOKUP_V = [BRAKE_MAX, BRAKE_MIN] + ANGLE_RATE_LIMIT_UP = AngleRateLimit(speed_bp=[0.], angle_v=[1.]) + ANGLE_RATE_LIMIT_DOWN = AngleRateLimit(speed_bp=[0.], angle_v=[1.]) + class SubaruFlags(IntFlag): # Detected flags From e7537815d25ca1ab8cf17d65647d9911c58ff0e3 Mon Sep 17 00:00:00 2001 From: Charlie <4663128+bravochar@users.noreply.github.com> Date: Fri, 13 Sep 2024 16:21:33 -0400 Subject: [PATCH 08/12] revert to Gen2 cruise activated message --- opendbc/car/subaru/carstate.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/opendbc/car/subaru/carstate.py b/opendbc/car/subaru/carstate.py index d71ab5407e..b721f4f776 100644 --- a/opendbc/car/subaru/carstate.py +++ b/opendbc/car/subaru/carstate.py @@ -76,8 +76,7 @@ def update(self, cp, cp_cam, _, cp_body, __) -> structs.CarState: cp_cruise = cp_body if self.CP.flags & SubaruFlags.GLOBAL_GEN2 else cp if self.CP.flags & SubaruFlags.LKAS_ANGLE: - cp_es_status = cp_body if self.CP.flags & SubaruFlags.GLOBAL_GEN2 else cp_cam - ret.cruiseState.enabled = cp_es_status.vl["ES_Status"]['Cruise_Activated'] != 0 + ret.cruiseState.enabled = cp_cam.vl["ES_DashStatus"]['Cruise_Activated'] != 0 ret.cruiseState.available = cp_cam.vl["ES_DashStatus"]['Cruise_On'] != 0 else: From c871c372817688db8193481dbc41d9f861dfb4f3 Mon Sep 17 00:00:00 2001 From: bravochar <4663128+bravochar@users.noreply.github.com> Date: Fri, 13 Sep 2024 19:59:33 -0400 Subject: [PATCH 09/12] Add back Ascent engine/transmission ECUs --- opendbc/car/subaru/fingerprints.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/opendbc/car/subaru/fingerprints.py b/opendbc/car/subaru/fingerprints.py index 9b59b341a7..970636734c 100644 --- a/opendbc/car/subaru/fingerprints.py +++ b/opendbc/car/subaru/fingerprints.py @@ -44,6 +44,14 @@ b'\x05!\x08\x1dK\x05!\x08\x01/', b'\x05!\x08\x1dK\x00\x00\x00\x00\x00', ], + (Ecu.engine, 0x7a2, None): [ + b'\xe5,\xa0P\x07', + b'\xe5,\xa0p\x07', + ], + (Ecu.transmission, 0x7a3, None): [ + b'\x04\xfe\xf3\x00\x00', + b'\x04\xfe\xf6\x00\x00', + ], }, CAR.SUBARU_LEGACY: { (Ecu.abs, 0x7b0, None): [ From 395dc3abf86e0a927e3fcfdaaecda597f84805e1 Mon Sep 17 00:00:00 2001 From: bravochar <4663128+bravochar@users.noreply.github.com> Date: Fri, 13 Sep 2024 20:05:03 -0400 Subject: [PATCH 10/12] Add back engine/transmission ECUs --- opendbc/car/subaru/values.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/opendbc/car/subaru/values.py b/opendbc/car/subaru/values.py index 47105b77df..84ebb178a0 100644 --- a/opendbc/car/subaru/values.py +++ b/opendbc/car/subaru/values.py @@ -274,14 +274,7 @@ class CAR(Platforms): # We don't get the EPS from non-OBD queries on GEN2 cars. Note that we still attempt to match when it exists non_essential_ecus={ Ecu.eps: list(CAR.with_flags(SubaruFlags.GLOBAL_GEN2)), - Ecu.fwdCamera: list(CAR.with_flags(SubaruFlags.LKAS_ANGLE)), }, - extra_ecus=[ - (Ecu.engine, 0x7e0, None), - (Ecu.engine, 0x7e2, None), - (Ecu.transmission, 0x7e1, None), - (Ecu.transmission, 0x7a3, None), - ], ) DBC = CAR.create_dbc_map() From beac94516b4a151f8f68863d78e0061110b65a9b Mon Sep 17 00:00:00 2001 From: bravochar <4663128+bravochar@users.noreply.github.com> Date: Sat, 21 Sep 2024 12:18:54 -0400 Subject: [PATCH 11/12] Break out 2023 Ascent tuning parameters --- opendbc/car/subaru/interface.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/opendbc/car/subaru/interface.py b/opendbc/car/subaru/interface.py index a03c742ab5..cb9e1b9261 100644 --- a/opendbc/car/subaru/interface.py +++ b/opendbc/car/subaru/interface.py @@ -41,14 +41,22 @@ def _get_params(ret: structs.CarParams, candidate: CAR, fingerprint, car_fw, exp else: CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) - if candidate in (CAR.SUBARU_ASCENT, CAR.SUBARU_ASCENT_2023): + if candidate == CAR.SUBARU_ASCENT: ret.steerActuatorDelay = 0.3 # end-to-end angle controller ret.lateralTuning.init('pid') ret.lateralTuning.pid.kf = 0.00003 ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0., 20.], [0., 20.]] ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.0025, 0.1], [0.00025, 0.01]] - if candidate == CAR.SUBARU_ASCENT_2023: - ret.dashcamOnly = False + + elif candidate == CAR.SUBARU_ASCENT_2023: + ret.dashcamOnly = False + ret.steerActuatorDelay = 0.3 # end-to-end angle controller + ret.lateralTuning.init('pid') + ret.lateralTuning.pid.kf = 0.00003 + ret.lateralTuning.pid.kpBP = [0., 20.] + ret.lateralTuning.pid.kiBP = [0., 20.] + ret.lateralTuning.pid.kpV = [0.0025, 0.1] + ret.lateralTuning.pid.kiV = [0.00225, 0.09] elif candidate == CAR.SUBARU_IMPREZA: ret.steerActuatorDelay = 0.4 # end-to-end angle controller From ea17eb0593c20530a91a385c0230f18de54fced7 Mon Sep 17 00:00:00 2001 From: bravochar <4663128+bravochar@users.noreply.github.com> Date: Sat, 21 Sep 2024 20:08:41 -0400 Subject: [PATCH 12/12] Remove engine/transmission fingerprints --- opendbc/car/subaru/fingerprints.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/opendbc/car/subaru/fingerprints.py b/opendbc/car/subaru/fingerprints.py index 970636734c..1ffeaf074b 100644 --- a/opendbc/car/subaru/fingerprints.py +++ b/opendbc/car/subaru/fingerprints.py @@ -44,14 +44,15 @@ b'\x05!\x08\x1dK\x05!\x08\x01/', b'\x05!\x08\x1dK\x00\x00\x00\x00\x00', ], - (Ecu.engine, 0x7a2, None): [ - b'\xe5,\xa0P\x07', - b'\xe5,\xa0p\x07', - ], - (Ecu.transmission, 0x7a3, None): [ - b'\x04\xfe\xf3\x00\x00', - b'\x04\xfe\xf6\x00\x00', - ], + # XXX: No longer showing up?! + #(Ecu.engine, 0x7a2, None): [ + # b'\xe5,\xa0P\x07', + # b'\xe5,\xa0p\x07', + #], + #(Ecu.transmission, 0x7a3, None): [ + # b'\x04\xfe\xf3\x00\x00', + # b'\x04\xfe\xf6\x00\x00', + #], }, CAR.SUBARU_LEGACY: { (Ecu.abs, 0x7b0, None): [