From 4e2d8cf5236858e6b1de438c1d8f0a64515936b9 Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Fri, 29 Mar 2024 12:41:10 -0700 Subject: [PATCH 01/26] Init 24 Integra --- selfdrive/car/honda/carstate.py | 4 ++-- selfdrive/car/honda/fingerprints.py | 20 ++++++++++++++++++++ selfdrive/car/honda/interface.py | 2 +- selfdrive/car/honda/values.py | 6 ++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index c98d1a72d3cc15..b92222f0da86ad 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -65,7 +65,7 @@ def get_can_messages(CP, gearbox_msg): # TODO: clean this up if CP.carFingerprint in (CAR.HONDA_ACCORD, CAR.HONDA_CIVIC_BOSCH, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.HONDA_CRV_HYBRID, CAR.HONDA_INSIGHT, - CAR.ACURA_RDX_3G, CAR.HONDA_E, CAR.HONDA_CIVIC_2022, CAR.HONDA_HRV_3G): + CAR.ACURA_RDX_3G, CAR.HONDA_E, CAR.HONDA_CIVIC_2022, CAR.HONDA_HRV_3G, CAR.ACURA_INTEGRA): pass elif CP.carFingerprint in (CAR.HONDA_ODYSSEY_CHN, CAR.HONDA_FREED, CAR.HONDA_HRV): pass @@ -126,7 +126,7 @@ def update(self, cp, cp_cam, cp_body): ret.standstill = cp.vl["ENGINE_DATA"]["XMISSION_SPEED"] < 1e-5 # TODO: find a common signal across all cars if self.CP.carFingerprint in (CAR.HONDA_ACCORD, CAR.HONDA_CIVIC_BOSCH, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.HONDA_CRV_HYBRID, CAR.HONDA_INSIGHT, - CAR.ACURA_RDX_3G, CAR.HONDA_E, CAR.HONDA_CIVIC_2022, CAR.HONDA_HRV_3G): + CAR.ACURA_RDX_3G, CAR.HONDA_E, CAR.HONDA_CIVIC_2022, CAR.HONDA_HRV_3G, CAR.ACURA_INTEGRA): ret.doorOpen = bool(cp.vl["SCM_FEEDBACK"]["DRIVERS_DOOR_OPEN"]) elif self.CP.carFingerprint in (CAR.HONDA_ODYSSEY_CHN, CAR.HONDA_FREED, CAR.HONDA_HRV): ret.doorOpen = bool(cp.vl["SCM_BUTTONS"]["DRIVERS_DOOR_OPEN"]) diff --git a/selfdrive/car/honda/fingerprints.py b/selfdrive/car/honda/fingerprints.py index c1714fe81038ac..5857521a6880a5 100644 --- a/selfdrive/car/honda/fingerprints.py +++ b/selfdrive/car/honda/fingerprints.py @@ -1411,4 +1411,24 @@ b'37805-64S-AA10\x00\x00', ], }, + CAR.ACURA_INTEGRA: { + (Ecu.eps, 0x18da30f1, None): [ + b'39990-T38-A040\x00\x00', + ], + (Ecu.gateway, 0x18daeff1, None): [ + b'38897-3S5-A210\x00\x00', + ], + (Ecu.srs, 0x18da53f1, None): [ + b'77959-3S5-A920\x00\x00', + ], + (Ecu.combinationMeter, 0x18da60f1, None): [ + b'8108-3S5-AC20\x00\x00', + ], + (Ecu.vsa, 0x18da28f1, None): [ + b'57114-3S5-CA30\x00\x00', + ], + (Ecu.programmedFuelInjection, 0x18da10f1, None): [ + b'37805-6LM-A020\x00\x00', + ], + }, } diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 2a5a07093d9732..dc8d050aa59721 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -103,7 +103,7 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2560], [0, 2560]] ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[1.1], [0.33]] - elif candidate in (CAR.HONDA_CIVIC_BOSCH, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.HONDA_CIVIC_2022): + elif candidate in (CAR.HONDA_CIVIC_BOSCH, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.HONDA_CIVIC_2022, CAR.ACURA_INTEGRA): ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]] diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index 36cdbc87328d1d..7c4cb588c5f93e 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -183,6 +183,12 @@ class CAR(Platforms): CarSpecs(mass=3338.8 * CV.LB_TO_KG, wheelbase=2.5, centerToFrontRatio=0.5, steerRatio=16.71, tireStiffnessFactor=0.82), dbc_dict('acura_rdx_2020_can_generated', None), ) + ACURA_INTEGRA = HondaBoschPlatformConfig( + [HondaCarDocs("Acura Integra 2024", "All")], + CarSpecs(mass=3338.8 * CV.LB_TO_KG, wheelbase=2.5, centerToFrontRatio=0.5, steerRatio=16.71, tireStiffnessFactor=0.82), + dbc_dict('honda_civic_ex_2022_can_generated', None), + flags=HondaFlags.BOSCH_RADARLESS, + ) # Nidec Cars ACURA_ILX = HondaNidecPlatformConfig( From 5ba4328683aa17825497c6483c849c4305c5dced Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Fri, 29 Mar 2024 12:54:01 -0700 Subject: [PATCH 02/26] subs --- selfdrive/car/torque_data/substitute.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/car/torque_data/substitute.toml b/selfdrive/car/torque_data/substitute.toml index 22ee134ae374aa..e81f109cf66965 100644 --- a/selfdrive/car/torque_data/substitute.toml +++ b/selfdrive/car/torque_data/substitute.toml @@ -48,6 +48,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"] "HONDA_CIVIC_BOSCH_DIESEL" = "HONDA_CIVIC_BOSCH" "HONDA_E" = "HONDA_CIVIC_BOSCH" "HONDA_ODYSSEY_CHN" = "HONDA_ODYSSEY" +"ACURA_INTEGRA" = "HONDA_CIVIC_2022" "BUICK_LACROSSE" = "CHEVROLET_VOLT" "BUICK_REGAL" = "CHEVROLET_VOLT" From f0a3526024fce4b7dcdae6c69b15e292af8af267 Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Fri, 5 Apr 2024 21:32:29 -0700 Subject: [PATCH 03/26] add MT support --- selfdrive/car/honda/carstate.py | 21 +++++++++++++++++---- selfdrive/car/honda/interface.py | 3 +++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index b92222f0da86ad..6ee2fd3a3bea90 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -16,7 +16,6 @@ def get_can_messages(CP, gearbox_msg): messages = [ - ("ENGINE_DATA", 100), ("WHEEL_SPEEDS", 50), ("STEERING_SENSORS", 100), ("SEATBELT_STATUS", 10), @@ -38,8 +37,15 @@ def get_can_messages(CP, gearbox_msg): ("SCM_FEEDBACK", 10), ("SCM_BUTTONS", 25), ] - - if CP.carFingerprint in (CAR.HONDA_CRV_HYBRID, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.ACURA_RDX_3G, CAR.HONDA_E): + if CP.carFingerprint != CAR.ACURA_INTEGRA: + messages += [ + ("ENGINE_DATA", 100), + ] + if CP.carFingerprint == CAR.ACURA_INTEGRA: + messages += [ + ("GEARBOX_MT", 50), + ] + if CP.carFingerprint in (CAR.HONDA_CRV_HYBRID, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.ACURA_RDX_3G, CAR.HONDA_E, CAR.ACURA_INTEGRA): messages.append((gearbox_msg, 50)) else: messages.append((gearbox_msg, 100)) @@ -87,6 +93,8 @@ def __init__(self, CP): self.gearbox_msg = "GEARBOX" if CP.carFingerprint == CAR.HONDA_ACCORD and CP.transmissionType == TransmissionType.cvt: self.gearbox_msg = "GEARBOX_15T" + elif self.CP.transmissionType == TransmissionType.manual: + self.gearbox_msg == "GEARBOX_MT" self.main_on_sig_msg = "SCM_FEEDBACK" if CP.carFingerprint in HONDA_NIDEC_ALT_SCM_MESSAGES: @@ -123,7 +131,10 @@ def update(self, cp, cp_cam, cp_body): # ******************* parse out can ******************* # STANDSTILL->WHEELS_MOVING bit can be noisy around zero, so use XMISSION_SPEED # panda checks if the signal is non-zero - ret.standstill = cp.vl["ENGINE_DATA"]["XMISSION_SPEED"] < 1e-5 + if CP.carFingerprint == CAR.ACURA_INTEGRA: + ret.standstill = cp.vl["CAR_SPEED"]["CAR_SPEED"] < 1e-5 + else: + ret.standstill = cp.vl["ENGINE_DATA"]["XMISSION_SPEED"] < 1e-5 # TODO: find a common signal across all cars if self.CP.carFingerprint in (CAR.HONDA_ACCORD, CAR.HONDA_CIVIC_BOSCH, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.HONDA_CRV_HYBRID, CAR.HONDA_INSIGHT, CAR.ACURA_RDX_3G, CAR.HONDA_E, CAR.HONDA_CIVIC_2022, CAR.HONDA_HRV_3G, CAR.ACURA_INTEGRA): @@ -186,6 +197,8 @@ def update(self, cp, cp_cam, cp_body): gear = int(cp.vl[self.gearbox_msg]["GEAR_SHIFTER"]) ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear, None)) + if self.CP.transmissionType == TransmissionType.manual: + ret.clutchPressed = cp.vl["GEARBOX_MT"]["GEAR"] == 0 ret.gas = cp.vl["POWERTRAIN_DATA"]["PEDAL_GAS"] ret.gasPressed = ret.gas > 1e-5 diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index dc8d050aa59721..f0f1301041f9cc 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -62,6 +62,9 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): # Accord ICE 1.5T CVT has different gearbox message if candidate == CAR.HONDA_ACCORD and 0x191 in fingerprint[CAN.pt]: ret.transmissionType = TransmissionType.cvt + # Integra has MT option + elif candidate == CAR.ACURA_INTEGRA and 0x191 not in fingerprint[CAN.pt]: + ret.transmissionType = TransmissionType.manual # Certain Hondas have an extra steering sensor at the bottom of the steering rack, # which improves controls quality as it removes the steering column torsion from feedback. From 45c0346bfda5317e012e953bcd0196cd0d610c8c Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Fri, 5 Apr 2024 21:39:50 -0700 Subject: [PATCH 04/26] fix --- selfdrive/car/honda/carstate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 6ee2fd3a3bea90..9570b3e16ffece 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -93,7 +93,7 @@ def __init__(self, CP): self.gearbox_msg = "GEARBOX" if CP.carFingerprint == CAR.HONDA_ACCORD and CP.transmissionType == TransmissionType.cvt: self.gearbox_msg = "GEARBOX_15T" - elif self.CP.transmissionType == TransmissionType.manual: + elif CP.transmissionType == TransmissionType.manual: self.gearbox_msg == "GEARBOX_MT" self.main_on_sig_msg = "SCM_FEEDBACK" @@ -131,7 +131,7 @@ def update(self, cp, cp_cam, cp_body): # ******************* parse out can ******************* # STANDSTILL->WHEELS_MOVING bit can be noisy around zero, so use XMISSION_SPEED # panda checks if the signal is non-zero - if CP.carFingerprint == CAR.ACURA_INTEGRA: + if self.CP.carFingerprint == CAR.ACURA_INTEGRA: ret.standstill = cp.vl["CAR_SPEED"]["CAR_SPEED"] < 1e-5 else: ret.standstill = cp.vl["ENGINE_DATA"]["XMISSION_SPEED"] < 1e-5 From 1681389d8a535591ae8d574a0a08b913d1bf869b Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Fri, 5 Apr 2024 21:44:57 -0700 Subject: [PATCH 05/26] fix --- selfdrive/car/honda/carstate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 9570b3e16ffece..460b1589de97d2 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -94,7 +94,7 @@ def __init__(self, CP): if CP.carFingerprint == CAR.HONDA_ACCORD and CP.transmissionType == TransmissionType.cvt: self.gearbox_msg = "GEARBOX_15T" elif CP.transmissionType == TransmissionType.manual: - self.gearbox_msg == "GEARBOX_MT" + self.gearbox_msg = "GEARBOX_MT" self.main_on_sig_msg = "SCM_FEEDBACK" if CP.carFingerprint in HONDA_NIDEC_ALT_SCM_MESSAGES: From 0e178033c4c87b8ac87420b7fe60347c9e93c403 Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Sat, 6 Apr 2024 14:50:48 -0700 Subject: [PATCH 06/26] MT gear support --- opendbc | 2 +- selfdrive/car/honda/carstate.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/opendbc b/opendbc index 3c926e88e87594..3dff4b30f19ee4 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit 3c926e88e87594e788ab96d32ecdd8f66cb01aed +Subproject commit 3dff4b30f19ee40b5c2162024a1946307792422f diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 460b1589de97d2..6442358c9a2cee 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -198,7 +198,11 @@ def update(self, cp, cp_cam, cp_body): gear = int(cp.vl[self.gearbox_msg]["GEAR_SHIFTER"]) ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear, None)) if self.CP.transmissionType == TransmissionType.manual: - ret.clutchPressed = cp.vl["GEARBOX_MT"]["GEAR"] == 0 + ret.clutchPressed = cp.vl["GEARBOX_MT"]["GEAR_MT"] == 0 + if cp.vl["GEARBOX_MT"]["GEAR_MT"] == 14; + ret.gearShifter = GearShifter.reverse + else; + ret.gearShifter = GearShifter.drive ret.gas = cp.vl["POWERTRAIN_DATA"]["PEDAL_GAS"] ret.gasPressed = ret.gas > 1e-5 From 82b7544e2692f9ab4810d296da1060e5dae55232 Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Sun, 7 Apr 2024 06:42:38 -0700 Subject: [PATCH 07/26] Revert "MT gear support" This reverts commit 0e178033c4c87b8ac87420b7fe60347c9e93c403. --- opendbc | 2 +- selfdrive/car/honda/carstate.py | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/opendbc b/opendbc index 3dff4b30f19ee4..3c926e88e87594 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit 3dff4b30f19ee40b5c2162024a1946307792422f +Subproject commit 3c926e88e87594e788ab96d32ecdd8f66cb01aed diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 6442358c9a2cee..460b1589de97d2 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -198,11 +198,7 @@ def update(self, cp, cp_cam, cp_body): gear = int(cp.vl[self.gearbox_msg]["GEAR_SHIFTER"]) ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear, None)) if self.CP.transmissionType == TransmissionType.manual: - ret.clutchPressed = cp.vl["GEARBOX_MT"]["GEAR_MT"] == 0 - if cp.vl["GEARBOX_MT"]["GEAR_MT"] == 14; - ret.gearShifter = GearShifter.reverse - else; - ret.gearShifter = GearShifter.drive + ret.clutchPressed = cp.vl["GEARBOX_MT"]["GEAR"] == 0 ret.gas = cp.vl["POWERTRAIN_DATA"]["PEDAL_GAS"] ret.gasPressed = ret.gas > 1e-5 From 3ad8ec78b39af4663f6197cad18c048287346b45 Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Sun, 7 Apr 2024 06:48:36 -0700 Subject: [PATCH 08/26] remove MT for now --- selfdrive/car/honda/carstate.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 460b1589de97d2..33deecc4c9d6e6 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -41,10 +41,6 @@ def get_can_messages(CP, gearbox_msg): messages += [ ("ENGINE_DATA", 100), ] - if CP.carFingerprint == CAR.ACURA_INTEGRA: - messages += [ - ("GEARBOX_MT", 50), - ] if CP.carFingerprint in (CAR.HONDA_CRV_HYBRID, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.ACURA_RDX_3G, CAR.HONDA_E, CAR.ACURA_INTEGRA): messages.append((gearbox_msg, 50)) else: @@ -93,8 +89,6 @@ def __init__(self, CP): self.gearbox_msg = "GEARBOX" if CP.carFingerprint == CAR.HONDA_ACCORD and CP.transmissionType == TransmissionType.cvt: self.gearbox_msg = "GEARBOX_15T" - elif CP.transmissionType == TransmissionType.manual: - self.gearbox_msg = "GEARBOX_MT" self.main_on_sig_msg = "SCM_FEEDBACK" if CP.carFingerprint in HONDA_NIDEC_ALT_SCM_MESSAGES: @@ -197,8 +191,6 @@ def update(self, cp, cp_cam, cp_body): gear = int(cp.vl[self.gearbox_msg]["GEAR_SHIFTER"]) ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear, None)) - if self.CP.transmissionType == TransmissionType.manual: - ret.clutchPressed = cp.vl["GEARBOX_MT"]["GEAR"] == 0 ret.gas = cp.vl["POWERTRAIN_DATA"]["PEDAL_GAS"] ret.gasPressed = ret.gas > 1e-5 From ee25ef18812d7515c252aaf6eda425e20768f87a Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Sun, 7 Apr 2024 08:09:57 -0700 Subject: [PATCH 09/26] more fw versions --- selfdrive/car/honda/fingerprints.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/selfdrive/car/honda/fingerprints.py b/selfdrive/car/honda/fingerprints.py index 5857521a6880a5..8722a770dedf76 100644 --- a/selfdrive/car/honda/fingerprints.py +++ b/selfdrive/car/honda/fingerprints.py @@ -1416,19 +1416,23 @@ b'39990-T38-A040\x00\x00', ], (Ecu.gateway, 0x18daeff1, None): [ + b'38897-3S5-A110\x00\x00', b'38897-3S5-A210\x00\x00', ], (Ecu.srs, 0x18da53f1, None): [ b'77959-3S5-A920\x00\x00', ], (Ecu.combinationMeter, 0x18da60f1, None): [ - b'8108-3S5-AC20\x00\x00', + b'78108-3S5-AC20\x00\x00', + b'78108-3S5-A220\x00\x00', ], (Ecu.vsa, 0x18da28f1, None): [ b'57114-3S5-CA30\x00\x00', + b'57114-3S5-CB30\x00\x00' ], (Ecu.programmedFuelInjection, 0x18da10f1, None): [ b'37805-6LM-A020\x00\x00', + b'37805-6LM-A520\x00\x00', ], }, } From 3796249685d8ed3c4c27df1f14992dd99802d4d8 Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Sun, 7 Apr 2024 16:26:48 -0700 Subject: [PATCH 10/26] use car speed on integra --- selfdrive/car/honda/carstate.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 33deecc4c9d6e6..fd77b7252b7bf4 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -170,7 +170,10 @@ def update(self, cp, cp_cam, cp_body): # blend in transmission speed at low speed, since it has more low speed accuracy v_weight = interp(v_wheel, v_weight_bp, v_weight_v) - ret.vEgoRaw = (1. - v_weight) * cp.vl["ENGINE_DATA"]["XMISSION_SPEED"] * CV.KPH_TO_MS * self.CP.wheelSpeedFactor + v_weight * v_wheel + if self.CP.carFingerprint == CAR.ACURA_INTEGRA; + ret.vEgoRaw = (1. - v_weight) * cp.vl["CAR_SPEED"]["CAR_SPEED"] * CV.KPH_TO_MS * self.CP.wheelSpeedFactor + v_weight * v_wheel + else: + ret.vEgoRaw = (1. - v_weight) * cp.vl["ENGINE_DATA"]["XMISSION_SPEED"] * CV.KPH_TO_MS * self.CP.wheelSpeedFactor + v_weight * v_wheel ret.vEgo, ret.aEgo = self.update_speed_kf(ret.vEgoRaw) self.dash_speed_seen = self.dash_speed_seen or cp.vl["CAR_SPEED"]["ROUGH_CAR_SPEED_2"] > 1e-3 From 9dace70b66b4216550e1199c11afe817a850b275 Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Sun, 7 Apr 2024 16:34:24 -0700 Subject: [PATCH 11/26] fix --- selfdrive/car/honda/carstate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index fd77b7252b7bf4..e67150ea461e46 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -170,7 +170,7 @@ def update(self, cp, cp_cam, cp_body): # blend in transmission speed at low speed, since it has more low speed accuracy v_weight = interp(v_wheel, v_weight_bp, v_weight_v) - if self.CP.carFingerprint == CAR.ACURA_INTEGRA; + if self.CP.carFingerprint == CAR.ACURA_INTEGRA: ret.vEgoRaw = (1. - v_weight) * cp.vl["CAR_SPEED"]["CAR_SPEED"] * CV.KPH_TO_MS * self.CP.wheelSpeedFactor + v_weight * v_wheel else: ret.vEgoRaw = (1. - v_weight) * cp.vl["ENGINE_DATA"]["XMISSION_SPEED"] * CV.KPH_TO_MS * self.CP.wheelSpeedFactor + v_weight * v_wheel From 1481c33a6f467b9aa386d896bb65367ed616355d Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Sun, 7 Apr 2024 18:10:14 -0700 Subject: [PATCH 12/26] attempt MT Integra support --- opendbc | 2 +- selfdrive/car/honda/carstate.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/opendbc b/opendbc index 3c926e88e87594..3dff4b30f19ee4 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit 3c926e88e87594e788ab96d32ecdd8f66cb01aed +Subproject commit 3dff4b30f19ee40b5c2162024a1946307792422f diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index e67150ea461e46..14be087a6e3ee5 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -41,6 +41,10 @@ def get_can_messages(CP, gearbox_msg): messages += [ ("ENGINE_DATA", 100), ] + if CP.carFingerprint == CAR.ACURA_INTEGRA: + messages += [ + ("GEARBOX_MT", 50), + ] if CP.carFingerprint in (CAR.HONDA_CRV_HYBRID, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.ACURA_RDX_3G, CAR.HONDA_E, CAR.ACURA_INTEGRA): messages.append((gearbox_msg, 50)) else: @@ -89,6 +93,8 @@ def __init__(self, CP): self.gearbox_msg = "GEARBOX" if CP.carFingerprint == CAR.HONDA_ACCORD and CP.transmissionType == TransmissionType.cvt: self.gearbox_msg = "GEARBOX_15T" + elif CP.transmissionType == TransmissionType.manual: + self.gearbox_msg = "GEARBOX_MT" self.main_on_sig_msg = "SCM_FEEDBACK" if CP.carFingerprint in HONDA_NIDEC_ALT_SCM_MESSAGES: @@ -194,6 +200,12 @@ def update(self, cp, cp_cam, cp_body): gear = int(cp.vl[self.gearbox_msg]["GEAR_SHIFTER"]) ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear, None)) + if self.CP.transmissionType == TransmissionType.manual: + ret.clutchPressed = cp.vl["GEARBOX_MT"]["GEAR_MT"] == 0 + if cp.vl["GEARBOX_MT"]["GEAR_MT"] == 14; + ret.gearShifter = GearShifter.reverse + else; + ret.gearShifter = GearShifter.drive ret.gas = cp.vl["POWERTRAIN_DATA"]["PEDAL_GAS"] ret.gasPressed = ret.gas > 1e-5 From 874297a9ae2b53c62c6cc904e947be42f2d0d1c1 Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Sun, 7 Apr 2024 18:19:33 -0700 Subject: [PATCH 13/26] fix --- selfdrive/car/honda/carstate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 14be087a6e3ee5..7dc1b2afe2c3c1 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -202,7 +202,7 @@ def update(self, cp, cp_cam, cp_body): ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear, None)) if self.CP.transmissionType == TransmissionType.manual: ret.clutchPressed = cp.vl["GEARBOX_MT"]["GEAR_MT"] == 0 - if cp.vl["GEARBOX_MT"]["GEAR_MT"] == 14; + if cp.vl["GEARBOX_MT"]["GEAR_MT"] == 14: ret.gearShifter = GearShifter.reverse else; ret.gearShifter = GearShifter.drive From 9c6f3fb0c4e31a92f22244059d2fe4a22fe78ba6 Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Sun, 7 Apr 2024 18:23:13 -0700 Subject: [PATCH 14/26] fix --- selfdrive/car/honda/carstate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 7dc1b2afe2c3c1..5df0f817cb0452 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -204,7 +204,7 @@ def update(self, cp, cp_cam, cp_body): ret.clutchPressed = cp.vl["GEARBOX_MT"]["GEAR_MT"] == 0 if cp.vl["GEARBOX_MT"]["GEAR_MT"] == 14: ret.gearShifter = GearShifter.reverse - else; + else: ret.gearShifter = GearShifter.drive ret.gas = cp.vl["POWERTRAIN_DATA"]["PEDAL_GAS"] From 229d7195c772757a4024c815472c3720dd1e2570 Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Mon, 8 Apr 2024 07:51:23 -0700 Subject: [PATCH 15/26] integra panda safety --- panda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda b/panda index 01c54d11990fb8..2ab5af3552e086 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 01c54d11990fb82b85acc322a6e2e34a4b7ee389 +Subproject commit 2ab5af3552e086c3b9f77ddbb0dd4f5ea6708c2f From a1727007eb00884177e33698233335c7d36f2fc0 Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Mon, 8 Apr 2024 07:52:24 -0700 Subject: [PATCH 16/26] integra panda safety --- panda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda b/panda index 01c54d11990fb8..2ab5af3552e086 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 01c54d11990fb82b85acc322a6e2e34a4b7ee389 +Subproject commit 2ab5af3552e086c3b9f77ddbb0dd4f5ea6708c2f From a79aef2693a05c709e4f68f68a041ffe2bce8aba Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Mon, 8 Apr 2024 12:55:58 -0700 Subject: [PATCH 17/26] test --- selfdrive/car/honda/carstate.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 5df0f817cb0452..127fa3729a825d 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -100,7 +100,8 @@ def __init__(self, CP): if CP.carFingerprint in HONDA_NIDEC_ALT_SCM_MESSAGES: self.main_on_sig_msg = "SCM_BUTTONS" - self.shifter_values = can_define.dv[self.gearbox_msg]["GEAR_SHIFTER"] + if CP.carFingerprint != CAR.ACURA_INTEGRA: + self.shifter_values = can_define.dv[self.gearbox_msg]["GEAR_SHIFTER"] self.steer_status_values = defaultdict(lambda: "UNKNOWN", can_define.dv["STEER_STATUS"]["STEER_STATUS"]) self.brake_switch_prev = False @@ -199,13 +200,15 @@ def update(self, cp, cp_cam, cp_body): ret.parkingBrake = cp.vl["EPB_STATUS"]["EPB_STATE"] != 0 gear = int(cp.vl[self.gearbox_msg]["GEAR_SHIFTER"]) - ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear, None)) if self.CP.transmissionType == TransmissionType.manual: - ret.clutchPressed = cp.vl["GEARBOX_MT"]["GEAR_MT"] == 0 - if cp.vl["GEARBOX_MT"]["GEAR_MT"] == 14: - ret.gearShifter = GearShifter.reverse - else: - ret.gearShifter = GearShifter.drive + ret.clutchPressed = cp.vl["GEARBOX_MT"]["GEAR_MT"] == 0 + if cp.vl["GEARBOX_MT"]["GEAR_MT"] == 14: + ret.gearShifter = GearShifter.reverse + else: + ret.gearShifter = GearShifter.drive + else: + ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear, None)) + ret.gas = cp.vl["POWERTRAIN_DATA"]["PEDAL_GAS"] ret.gasPressed = ret.gas > 1e-5 From 03a9835fa33b789db6553a52f8e00e34308ad745 Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Mon, 8 Apr 2024 13:18:47 -0700 Subject: [PATCH 18/26] bump panda --- panda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda b/panda index 2ab5af3552e086..a00b77c78a33b8 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 2ab5af3552e086c3b9f77ddbb0dd4f5ea6708c2f +Subproject commit a00b77c78a33b8c19a02ac4ccba17618f863b50c From 499f1384d69e02e64d7afd7dbce974806bc35bb8 Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Mon, 8 Apr 2024 13:27:45 -0700 Subject: [PATCH 19/26] bump panda --- panda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda b/panda index a00b77c78a33b8..b1586fa87caf9d 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit a00b77c78a33b8c19a02ac4ccba17618f863b50c +Subproject commit b1586fa87caf9d95074fc3bf8a4e2cc694b94ef2 From 1d24c702a6f26038ee9da2b4189e7253066e39e3 Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Mon, 8 Apr 2024 20:21:53 -0700 Subject: [PATCH 20/26] bump panda and remove freq check --- panda | 2 +- selfdrive/car/honda/carstate.py | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/panda b/panda index 2ab5af3552e086..b1586fa87caf9d 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 2ab5af3552e086c3b9f77ddbb0dd4f5ea6708c2f +Subproject commit b1586fa87caf9d95074fc3bf8a4e2cc694b94ef2 diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 127fa3729a825d..941bc13d6f7db9 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -41,10 +41,6 @@ def get_can_messages(CP, gearbox_msg): messages += [ ("ENGINE_DATA", 100), ] - if CP.carFingerprint == CAR.ACURA_INTEGRA: - messages += [ - ("GEARBOX_MT", 50), - ] if CP.carFingerprint in (CAR.HONDA_CRV_HYBRID, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.ACURA_RDX_3G, CAR.HONDA_E, CAR.ACURA_INTEGRA): messages.append((gearbox_msg, 50)) else: From 2c0a8a94f239a466cc3ae579411dfabbfefe0f7a Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Tue, 9 Apr 2024 06:48:44 -0700 Subject: [PATCH 21/26] move this --- selfdrive/car/honda/carstate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index 941bc13d6f7db9..ac0fc654ddeacf 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -195,7 +195,6 @@ def update(self, cp, cp_cam, cp_body): if self.CP.carFingerprint in (HONDA_BOSCH | {CAR.HONDA_CIVIC, CAR.HONDA_ODYSSEY, CAR.HONDA_ODYSSEY_CHN}): ret.parkingBrake = cp.vl["EPB_STATUS"]["EPB_STATE"] != 0 - gear = int(cp.vl[self.gearbox_msg]["GEAR_SHIFTER"]) if self.CP.transmissionType == TransmissionType.manual: ret.clutchPressed = cp.vl["GEARBOX_MT"]["GEAR_MT"] == 0 if cp.vl["GEARBOX_MT"]["GEAR_MT"] == 14: @@ -203,6 +202,7 @@ def update(self, cp, cp_cam, cp_body): else: ret.gearShifter = GearShifter.drive else: + gear = int(cp.vl[self.gearbox_msg]["GEAR_SHIFTER"]) ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear, None)) From 1d3816de6f7713a8b2e195d0b80b9534ddf95ca0 Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Tue, 9 Apr 2024 22:25:56 -0700 Subject: [PATCH 22/26] more fixes --- selfdrive/car/honda/carstate.py | 6 +++--- selfdrive/car/honda/values.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index ac0fc654ddeacf..b7eb42f2f0742f 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -8,7 +8,7 @@ from openpilot.selfdrive.car.honda.hondacan import CanBus, get_cruise_speed_conversion from openpilot.selfdrive.car.honda.values import CAR, DBC, STEER_THRESHOLD, HONDA_BOSCH, \ HONDA_NIDEC_ALT_SCM_MESSAGES, HONDA_BOSCH_RADARLESS, \ - HondaFlags + HondaFlags, GearShifter from openpilot.selfdrive.car.interfaces import CarStateBase TransmissionType = car.CarParams.TransmissionType @@ -37,7 +37,7 @@ def get_can_messages(CP, gearbox_msg): ("SCM_FEEDBACK", 10), ("SCM_BUTTONS", 25), ] - if CP.carFingerprint != CAR.ACURA_INTEGRA: + if CP.carFingerprint not in (CAR.ACURA_INTEGRA): messages += [ ("ENGINE_DATA", 100), ] @@ -96,7 +96,7 @@ def __init__(self, CP): if CP.carFingerprint in HONDA_NIDEC_ALT_SCM_MESSAGES: self.main_on_sig_msg = "SCM_BUTTONS" - if CP.carFingerprint != CAR.ACURA_INTEGRA: + if CP.carFingerprint not in (CAR.ACURA_INTEGRA): self.shifter_values = can_define.dv[self.gearbox_msg]["GEAR_SHIFTER"] self.steer_status_values = defaultdict(lambda: "UNKNOWN", can_define.dv["STEER_STATUS"]["STEER_STATUS"]) diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index 7c4cb588c5f93e..de77d4c3c9656c 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -10,6 +10,7 @@ Ecu = car.CarParams.Ecu VisualAlert = car.CarControl.HUDControl.VisualAlert +GearShifter = car.CarState.GearShifter class CarControllerParams: From 1020cf7bcf60743388b34dcfb4a9b5074eeb8143 Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Sun, 14 Apr 2024 14:21:47 -0700 Subject: [PATCH 23/26] update gearbox msg --- opendbc | 2 +- selfdrive/car/honda/carstate.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/opendbc b/opendbc index 3dff4b30f19ee4..0211b3a2d756c3 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit 3dff4b30f19ee40b5c2162024a1946307792422f +Subproject commit 0211b3a2d756c396a63543051467a51f1b6ee550 diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index b7eb42f2f0742f..c6092f04c84228 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -90,13 +90,13 @@ def __init__(self, CP): if CP.carFingerprint == CAR.HONDA_ACCORD and CP.transmissionType == TransmissionType.cvt: self.gearbox_msg = "GEARBOX_15T" elif CP.transmissionType == TransmissionType.manual: - self.gearbox_msg = "GEARBOX_MT" + self.gearbox_msg = "GEARBOX_BOH" self.main_on_sig_msg = "SCM_FEEDBACK" if CP.carFingerprint in HONDA_NIDEC_ALT_SCM_MESSAGES: self.main_on_sig_msg = "SCM_BUTTONS" - if CP.carFingerprint not in (CAR.ACURA_INTEGRA): + if CP.transmission != TransmissionType.manual: self.shifter_values = can_define.dv[self.gearbox_msg]["GEAR_SHIFTER"] self.steer_status_values = defaultdict(lambda: "UNKNOWN", can_define.dv["STEER_STATUS"]["STEER_STATUS"]) @@ -196,8 +196,8 @@ def update(self, cp, cp_cam, cp_body): ret.parkingBrake = cp.vl["EPB_STATUS"]["EPB_STATE"] != 0 if self.CP.transmissionType == TransmissionType.manual: - ret.clutchPressed = cp.vl["GEARBOX_MT"]["GEAR_MT"] == 0 - if cp.vl["GEARBOX_MT"]["GEAR_MT"] == 14: + ret.clutchPressed = cp.vl["GEARBOX_BOH"]["GEAR_MT"] == 0 + if cp.vl["GEARBOX_BOH"]["GEAR_MT"] == 14: ret.gearShifter = GearShifter.reverse else: ret.gearShifter = GearShifter.drive From ebc0bb1d67d3ec67030927c976d7c08b180bfdb0 Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Sun, 14 Apr 2024 19:09:44 -0700 Subject: [PATCH 24/26] type --- selfdrive/car/honda/carstate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index c6092f04c84228..c818ab8c372f9b 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -96,7 +96,7 @@ def __init__(self, CP): if CP.carFingerprint in HONDA_NIDEC_ALT_SCM_MESSAGES: self.main_on_sig_msg = "SCM_BUTTONS" - if CP.transmission != TransmissionType.manual: + if CP.transmissionType != TransmissionType.manual: self.shifter_values = can_define.dv[self.gearbox_msg]["GEAR_SHIFTER"] self.steer_status_values = defaultdict(lambda: "UNKNOWN", can_define.dv["STEER_STATUS"]["STEER_STATUS"]) From 7a45c48f9e38981348d3f6064d8a43d5ad4a6b32 Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Sun, 21 Apr 2024 11:05:01 -0700 Subject: [PATCH 25/26] 24 integra mt (#8) * bump panda * bump opendbc * apply PR 31022 --- opendbc | 2 +- panda | 2 +- selfdrive/car/honda/carcontroller.py | 25 +++++++++++++++++++++---- selfdrive/car/honda/carstate.py | 1 + selfdrive/car/honda/hondacan.py | 15 +++++++++++---- selfdrive/car/honda/values.py | 5 +++++ 6 files changed, 40 insertions(+), 10 deletions(-) diff --git a/opendbc b/opendbc index 0211b3a2d756c3..d3489b5ec8d427 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit 0211b3a2d756c396a63543051467a51f1b6ee550 +Subproject commit d3489b5ec8d4278debe67a85090bb03e50277023 diff --git a/panda b/panda index b1586fa87caf9d..523534ccaff6b6 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit b1586fa87caf9d95074fc3bf8a4e2cc694b94ef2 +Subproject commit 523534ccaff6b67e6e86774d96f75fcf37366b4b diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 6fe8c275850f6e..21a614caebf2c1 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -203,11 +203,28 @@ def update(self, CC, CS, now_nanos): if not self.CP.openpilotLongitudinalControl: if self.frame % 2 == 0 and self.CP.carFingerprint not in HONDA_BOSCH_RADARLESS: # radarless cars don't have supplemental message can_sends.append(hondacan.create_bosch_supplemental_1(self.packer, self.CAN, self.CP.carFingerprint)) - # If using stock ACC, spam cancel command to kill gas when OP disengages. + # Buttons: spam the cancel or resume buttons. + cruise = None + setting = CruiseButtons.NONE if pcm_cancel_cmd: - can_sends.append(hondacan.spam_buttons_command(self.packer, self.CAN, CruiseButtons.CANCEL, self.CP.carFingerprint)) - elif CC.cruiseControl.resume: - can_sends.append(hondacan.spam_buttons_command(self.packer, self.CAN, CruiseButtons.RES_ACCEL, self.CP.carFingerprint)) + cruise = CruiseButtons.CANCEL + elif self.CP.carFingerprint not in HONDA_BOSCH_RADARLESS and CC.cruiseControl.resume: + cruise = CruiseButtons.RES_ACCEL + elif self.CP.carFingerprint in HONDA_BOSCH_RADARLESS and CC.enabled and self.frame % 4 == 0: + # Send buttons to the camera when engaged. Only send the LKAS button to turn off stock LKAS off so it can't disengage cruise. + # Priority: pcm_cancel > user > auto resume > turn off lkas > none/idle + cruise = CruiseButtons.NONE + if CS.cruise_buttons or (CS.cruise_setting and CS.cruise_setting != CruiseButtons.LKAS): + cruise = CS.cruise_buttons + setting = CS.cruise_setting + # simulate a momentary press + elif self.frame % 100 <= 25: + if CC.cruiseControl.resume: + cruise = CruiseButtons.RES_ACCEL + elif CS.lkas_hud['ENABLED']: + setting = CruiseButtons.LKAS + if cruise is not None: + can_sends.append(hondacan.create_buttons_command(self.packer, self.CAN, cruise, setting, CS.scm_buttons, self.CP.carFingerprint)) else: # Send gas and brake commands. diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py index c818ab8c372f9b..46bcde96fbcc82 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -219,6 +219,7 @@ def update(self, cp, cp_cam, cp_body): ret.cruiseState.nonAdaptive = cp_cam.vl["ACC_HUD"]["CRUISE_CONTROL_LABEL"] != 0 if not self.CP.openpilotLongitudinalControl: + self.scm_buttons = cp.vl["SCM_BUTTONS"] if self.CP.carFingerprint in HONDA_BOSCH_RADARLESS else {} # ACC_HUD is on camera bus on radarless cars acc_hud = cp_cam.vl["ACC_HUD"] if self.CP.carFingerprint in HONDA_BOSCH_RADARLESS else cp.vl["ACC_HUD"] ret.cruiseState.nonAdaptive = acc_hud["CRUISE_CONTROL_LABEL"] != 0 diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 1be496d9511612..1b7fdf535eb433 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -167,7 +167,8 @@ def create_ui_commands(packer, CAN, CP, enabled, pcm_speed, hud, is_metric, acc_ commands.append(packer.make_can_msg("ACC_HUD", CAN.pt, acc_hud_values)) lkas_hud_values = { - 'SET_ME_X41': 0x41, + 'ENABLED': 1, + 'SET_ME_X20': 0x20, 'STEERING_REQUIRED': hud.steer_required, 'SOLID_LANES': hud.lanes_visible, 'BEEP': 0, @@ -201,11 +202,17 @@ def create_ui_commands(packer, CAN, CP, enabled, pcm_speed, hud, is_metric, acc_ return commands -def spam_buttons_command(packer, CAN, button_val, car_fingerprint): +def create_buttons_command(packer, CAN, button_val, setting_val, stock_scm_buttons, car_fingerprint): values = { - 'CRUISE_BUTTONS': button_val, - 'CRUISE_SETTING': 0, + 'CRUISE_BUTTONS': button_val } + # Radarless: set CRUISE_SETTING & forward unmodified data bits + if len(stock_scm_buttons): + values.update({ + 'CRUISE_SETTING': setting_val, + 'BOH_1': stock_scm_buttons['BOH_1'], + 'BOH_2': stock_scm_buttons['BOH_2'], + }) # send buttons to camera on radarless cars bus = CAN.camera if car_fingerprint in HONDA_BOSCH_RADARLESS else CAN.pt return packer.make_can_msg("SCM_BUTTONS", bus, values) diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index de77d4c3c9656c..bf7e19191360e9 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -67,6 +67,11 @@ class CruiseButtons: DECEL_SET = 3 CANCEL = 2 MAIN = 1 + NONE = 0 + +# CRUISE_SETTINGS + DISTANCE = 3 + LKAS = 1 class CruiseSettings: From 655da721f8073d10d34331514bd13b876cbce2ab Mon Sep 17 00:00:00 2001 From: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com> Date: Sun, 21 Apr 2024 17:13:23 -0700 Subject: [PATCH 26/26] integra test route --- selfdrive/car/tests/routes.py | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/car/tests/routes.py b/selfdrive/car/tests/routes.py index 036f39c1f35df3..5339095991987e 100755 --- a/selfdrive/car/tests/routes.py +++ b/selfdrive/car/tests/routes.py @@ -96,6 +96,7 @@ class CarTestRoute(NamedTuple): CarTestRoute("54fd8451b3974762|2021-04-01--14-50-10", HONDA.HONDA_RIDGELINE), CarTestRoute("2d5808fae0b38ac6|2021-09-01--17-14-11", HONDA.HONDA_E), CarTestRoute("f44aa96ace22f34a|2021-12-22--06-22-31", HONDA.HONDA_CIVIC_2022), + CarTestRoute("3f8ae015ce70365f/0000002b--d07abeff02", HONDA.ACURA_INTEGRA), CarTestRoute("87d7f06ade479c2e|2023-09-11--23-30-11", HYUNDAI.HYUNDAI_AZERA_6TH_GEN), CarTestRoute("66189dd8ec7b50e6|2023-09-20--07-02-12", HYUNDAI.HYUNDAI_AZERA_HEV_6TH_GEN),