From 3c703688e7e1f689b9fbf1ddb086efa077baec15 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/14] 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 1b6971bbd3..e10f9f9cac 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 dbabb33c77af0c7bc3f5c4d54fad3d037ebead50 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/14] 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 e10f9f9cac..1304e271c2 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 58eb4ee1c9741100afdc40f575681d5722479181 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/14] 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 | 14 ++++++--- opendbc/car/subaru/interface.py | 5 +++ opendbc/car/subaru/values.py | 5 ++- 4 files changed, 49 insertions(+), 23 deletions(-) diff --git a/opendbc/car/subaru/carcontroller.py b/opendbc/car/subaru/carcontroller.py index 1fca8cff1e..4ef28c7b34 100644 --- a/opendbc/car/subaru/carcontroller.py +++ b/opendbc/car/subaru/carcontroller.py @@ -1,5 +1,5 @@ from opendbc.can.packer import CANPacker -from opendbc.car import Bus, apply_driver_steer_torque_limits, common_fault_avoidance, make_tester_present_msg +from opendbc.car import Bus, 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 @@ -31,26 +31,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)) @@ -136,8 +145,11 @@ def update(self, CC, CS, now_nanos): can_sends.append(subarucan.create_es_static_2(self.packer)) new_actuators = actuators.as_builder() - 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 5e4343c2d0..d7d7fe011e 100644 --- a/opendbc/car/subaru/carstate.py +++ b/opendbc/car/subaru/carstate.py @@ -78,12 +78,18 @@ def update(self, can_parsers) -> structs.CarState: ret.steeringPressed = abs(ret.steeringTorque) > steer_threshold cp_cruise = cp_alt 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 + 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 f16192cebc..efb69a30d2 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 8dd9e7d5a9..3229cd157b 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 Bus, CarSpecs, DbcDict, PlatformConfig, Platforms +from opendbc.car import Bus, 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 c5492ce8ab9dbd7f724aa7f2cfa397584bc37a6d 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/14] 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 3229cd157b..550cedb9a6 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 7c37ec41c38bae940867703c93114117fa56da62 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/14] 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 550cedb9a6..d11a5dbaf7 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 804320b1444d788e6cdc6cc64ddfcafef5721450 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/14] 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 1304e271c2..52f0c9cf3b 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 f588c4bc43441ab879208946d88ccfe3d9c64a1f 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/14] 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 4ef28c7b34..0fc0a9aae6 100644 --- a/opendbc/car/subaru/carcontroller.py +++ b/opendbc/car/subaru/carcontroller.py @@ -31,6 +31,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) @@ -61,7 +62,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 d7d7fe011e..a57e6660b6 100644 --- a/opendbc/car/subaru/carstate.py +++ b/opendbc/car/subaru/carstate.py @@ -79,7 +79,7 @@ def update(self, can_parsers) -> structs.CarState: cp_cruise = cp_alt 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 + cp_es_status = cp_alt 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 @@ -90,6 +90,7 @@ def update(self, can_parsers) -> structs.CarState: 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 efb69a30d2..e27c47c808 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 d11a5dbaf7..aa8dcf060a 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 66a0df5f18add55388c4cb4e0304d8b8763e05be 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/14] 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 a57e6660b6..c0002a0779 100644 --- a/opendbc/car/subaru/carstate.py +++ b/opendbc/car/subaru/carstate.py @@ -79,8 +79,7 @@ def update(self, can_parsers) -> structs.CarState: cp_cruise = cp_alt if self.CP.flags & SubaruFlags.GLOBAL_GEN2 else cp if self.CP.flags & SubaruFlags.LKAS_ANGLE: - cp_es_status = cp_alt 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 c8ba019698b46b51c04bb6d29f3b0c120fa96a93 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/14] 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 52f0c9cf3b..b5e0468337 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 1edb296a7962d49f358c3ace2ff337ca9467cb2b 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/14] 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 aa8dcf060a..e5f257564b 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 f2342429decc8f9834f7fb4cff3ec90670f791df 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/14] 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 e27c47c808..c406b042ec 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 92cc2ceb051daf323f32eab5316a731d25f63698 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/14] 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 b5e0468337..1e5cc2ce41 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): [ From f0fbafcf203cff86772455aa1f455a779bde7475 Mon Sep 17 00:00:00 2001 From: bravochar <4663128+bravochar@users.noreply.github.com> Date: Sat, 23 Nov 2024 09:08:47 -0500 Subject: [PATCH 13/14] Update Ascent Tune --- opendbc/car/subaru/interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/subaru/interface.py b/opendbc/car/subaru/interface.py index c406b042ec..4f988c2815 100644 --- a/opendbc/car/subaru/interface.py +++ b/opendbc/car/subaru/interface.py @@ -56,7 +56,7 @@ def _get_params(ret: structs.CarParams, candidate: CAR, fingerprint, car_fw, exp 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] + ret.lateralTuning.pid.kiV = [0.00025, 0.01] elif candidate == CAR.SUBARU_IMPREZA: ret.steerActuatorDelay = 0.4 # end-to-end angle controller From 1c5665a7cafacb6d651bd46c3eaf4fdb237b39a3 Mon Sep 17 00:00:00 2001 From: bravochar <4663128+bravochar@users.noreply.github.com> Date: Sat, 23 Nov 2024 11:44:08 -0500 Subject: [PATCH 14/14] Remove deprecated `dbc_dict` import --- opendbc/car/subaru/values.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opendbc/car/subaru/values.py b/opendbc/car/subaru/values.py index e5f257564b..9f6a2a1e0b 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 Bus, CarSpecs, DbcDict, PlatformConfig, Platforms, dbc_dict, AngleRateLimit +from opendbc.car import Bus, CarSpecs, DbcDict, PlatformConfig, Platforms, 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