From e32bfa80ad435b1b608d18be2ad76ed41ce537cc Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Fri, 26 Jan 2024 21:46:00 +0000 Subject: [PATCH 01/12] Honda Radarless: Send buttons to camera when engaged vs forwarding or spamming. Co-authored-by: Jason Wen <47793918+sunnyhaibin@users.noreply.github.com> --- selfdrive/car/honda/carcontroller.py | 24 +++++++++++++++---- selfdrive/car/honda/carstate.py | 1 + selfdrive/car/honda/hondacan.py | 15 ++++++++---- selfdrive/car/honda/interface.py | 9 +++---- selfdrive/car/honda/values.py | 5 ++++ selfdrive/car/tests/routes.py | 2 +- .../test/process_replay/test_processes.py | 2 ++ 7 files changed, 45 insertions(+), 13 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 056b47c4b3ba9a..97edf9151e3792 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -202,11 +202,27 @@ 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.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, CruiseButtons.CANCEL, self.CP.carFingerprint)) - elif CC.cruiseControl.resume: - can_sends.append(hondacan.spam_buttons_command(self.packer, 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: + # Intercept buttons when engaged. panda will forward when disengaged. Block the LKAS button coming from the car. + # Keep stock LKAS disabled so it can't disengage cruise when the wheel touch timeout expires. + cruise = CruiseButtons.NONE + if CS.cruise_buttons: + cruise = CS.cruise_buttons + elif CS.cruise_setting and CS.cruise_setting is not CruiseButtons.LKAS: + setting = CS.cruise_setting + elif 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, 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 03aedb31d2afa6..79e5250c4ba077 100644 --- a/selfdrive/car/honda/carstate.py +++ b/selfdrive/car/honda/carstate.py @@ -205,6 +205,7 @@ def update(self, cp, cp_cam, cp_body): if self.CP.carFingerprint in HONDA_BOSCH: 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 a8cbad78cecbf5..21b259ef4dbbf0 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -147,7 +147,8 @@ def create_ui_commands(packer, CP, enabled, pcm_speed, hud, is_metric, acc_hud, commands.append(packer.make_can_msg("ACC_HUD", bus_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, @@ -181,11 +182,17 @@ def create_ui_commands(packer, CP, enabled, pcm_speed, hud, is_metric, acc_hud, return commands -def spam_buttons_command(packer, button_val, car_fingerprint): +def create_buttons_command(packer, button_val, setting_val, stock_scm_buttons, car_fingerprint): values = { - 'CRUISE_BUTTONS': button_val, - 'CRUISE_SETTING': 0, + 'CRUISE_BUTTONS': button_val } + # Radarless: forward unmodified signals + 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 = 2 if car_fingerprint in HONDA_BOSCH_RADARLESS else get_pt_bus(car_fingerprint) return packer.make_can_msg("SCM_BUTTONS", bus, values) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 9f228cd8fb6e90..326833a9e78099 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -13,8 +13,9 @@ ButtonType = car.CarState.ButtonEvent.Type EventName = car.CarEvent.EventName TransmissionType = car.CarParams.TransmissionType -BUTTONS_DICT = {CruiseButtons.RES_ACCEL: ButtonType.accelCruise, CruiseButtons.DECEL_SET: ButtonType.decelCruise, - CruiseButtons.MAIN: ButtonType.altButton3, CruiseButtons.CANCEL: ButtonType.cancel} +CRUISE_BUTTONS_DICT = {CruiseButtons.RES_ACCEL: ButtonType.accelCruise, CruiseButtons.DECEL_SET: ButtonType.decelCruise, + CruiseButtons.MAIN: ButtonType.altButton3, CruiseButtons.CANCEL: ButtonType.cancel} +SETTINGS_BUTTONS_DICT = {CruiseButtons.DISTANCE: ButtonType.gapAdjustCruise, CruiseButtons.LKAS: ButtonType.altButton1} class CarInterface(CarInterfaceBase): @@ -312,8 +313,8 @@ def _update(self, c): ret = self.CS.update(self.cp, self.cp_cam, self.cp_body) ret.buttonEvents = [ - *create_button_events(self.CS.cruise_buttons, self.CS.prev_cruise_buttons, BUTTONS_DICT), - *create_button_events(self.CS.cruise_setting, self.CS.prev_cruise_setting, {1: ButtonType.altButton1}), + *create_button_events(self.CS.cruise_buttons, self.CS.prev_cruise_buttons, CRUISE_BUTTONS_DICT), + *create_button_events(self.CS.cruise_setting, self.CS.prev_cruise_setting, SETTINGS_BUTTONS_DICT), ] # events diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index fefce7ff9ca9d4..deb773d4bea71e 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -57,6 +57,11 @@ class CruiseButtons: DECEL_SET = 3 CANCEL = 2 MAIN = 1 + NONE = 0 + +# CRUISE_SETTINGS + DISTANCE = 3 + LKAS = 1 # See dbc files for info on values diff --git a/selfdrive/car/tests/routes.py b/selfdrive/car/tests/routes.py index 69b39b3b2e8e4b..5b22a71947a4ee 100755 --- a/selfdrive/car/tests/routes.py +++ b/selfdrive/car/tests/routes.py @@ -93,7 +93,7 @@ class CarTestRoute(NamedTuple): CarTestRoute("f34a60d68d83b1e5|2020-10-06--14-35-55", HONDA.ACURA_RDX), CarTestRoute("54fd8451b3974762|2021-04-01--14-50-10", HONDA.RIDGELINE), CarTestRoute("2d5808fae0b38ac6|2021-09-01--17-14-11", HONDA.HONDA_E), - CarTestRoute("f44aa96ace22f34a|2021-12-22--06-22-31", HONDA.CIVIC_2022), + CarTestRoute("f44aa96ace22f34a|2021-12-22--06-22-31", HONDA.CIVIC_2022), # TODO: Replace with route where OP sends buttons to the cam when engaged CarTestRoute("87d7f06ade479c2e|2023-09-11--23-30-11", HYUNDAI.AZERA_6TH_GEN), CarTestRoute("66189dd8ec7b50e6|2023-09-20--07-02-12", HYUNDAI.AZERA_HEV_6TH_GEN), diff --git a/selfdrive/test/process_replay/test_processes.py b/selfdrive/test/process_replay/test_processes.py index 46fa93ba4dd939..e05d155d49d565 100755 --- a/selfdrive/test/process_replay/test_processes.py +++ b/selfdrive/test/process_replay/test_processes.py @@ -25,6 +25,7 @@ ("TOYOTA3", "f7d7e3538cda1a2a|2021-08-16--08-55-34--6"), # TOYOTA.COROLLA_TSS2 ("HONDA", "eb140f119469d9ab|2021-06-12--10-46-24--27"), # HONDA.CIVIC (NIDEC) ("HONDA2", "7d2244f34d1bbcda|2021-06-25--12-25-37--26"), # HONDA.ACCORD (BOSCH) + # TODO: Add 'HONDA3' for radarless cars with OP sending buttons to camera when engaged ("CHRYSLER", "4deb27de11bee626|2021-02-20--11-28-55--8"), # CHRYSLER.PACIFICA_2018_HYBRID ("RAM", "17fc16d840fe9d21|2023-04-26--13-28-44--5"), # CHRYSLER.RAM_1500 ("SUBARU", "341dccd5359e3c97|2022-09-12--10-35-33--3"), # SUBARU.OUTBACK @@ -49,6 +50,7 @@ ("TOYOTA3", "regen7204CA3A498|2023-10-30--23-15-55--0"), ("HONDA", "regen048F8FA0B24|2023-10-30--23-15-53--0"), ("HONDA2", "regen7D2D3F82D5B|2023-10-30--23-15-55--0"), + # TODO: Add 'HONDA3' for radarless cars with OP sending buttons to camera when engaged ("CHRYSLER", "regen7125C42780C|2023-10-30--23-16-21--0"), ("RAM", "regen2731F3213D2|2023-10-30--23-18-11--0"), ("SUBARU", "regen86E4C1B4DDD|2023-10-30--23-18-14--0"), From 4d0256b9b67730e9c94aac336b380c09b4c353cf Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Fri, 26 Jan 2024 23:34:37 +0000 Subject: [PATCH 02/12] fix that --- selfdrive/car/honda/carcontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 97edf9151e3792..1f33a0966d23c9 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -215,7 +215,7 @@ def update(self, CC, CS, now_nanos): cruise = CruiseButtons.NONE if CS.cruise_buttons: cruise = CS.cruise_buttons - elif CS.cruise_setting and CS.cruise_setting is not CruiseButtons.LKAS: + elif CS.cruise_setting and CS.cruise_setting != CruiseButtons.LKAS: setting = CS.cruise_setting elif CC.cruiseControl.resume: cruise = CruiseButtons.RES_ACCEL From 803affb65d996e03c8cf1254eca6b6fc9ab4a570 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 22 Feb 2024 01:46:47 +0000 Subject: [PATCH 03/12] revert. don't think it's needed --- selfdrive/test/process_replay/test_processes.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/selfdrive/test/process_replay/test_processes.py b/selfdrive/test/process_replay/test_processes.py index 2637249ed35efd..5323a5280f10e4 100755 --- a/selfdrive/test/process_replay/test_processes.py +++ b/selfdrive/test/process_replay/test_processes.py @@ -25,7 +25,6 @@ ("TOYOTA3", "f7d7e3538cda1a2a|2021-08-16--08-55-34--6"), # TOYOTA.COROLLA_TSS2 ("HONDA", "eb140f119469d9ab|2021-06-12--10-46-24--27"), # HONDA.CIVIC (NIDEC) ("HONDA2", "7d2244f34d1bbcda|2021-06-25--12-25-37--26"), # HONDA.ACCORD (BOSCH) - # TODO: Add 'HONDA3' for radarless cars with OP sending buttons to camera when engaged ("CHRYSLER", "4deb27de11bee626|2021-02-20--11-28-55--8"), # CHRYSLER.PACIFICA_2018_HYBRID ("RAM", "17fc16d840fe9d21|2023-04-26--13-28-44--5"), # CHRYSLER.RAM_1500 ("SUBARU", "341dccd5359e3c97|2022-09-12--10-35-33--3"), # SUBARU.OUTBACK @@ -50,7 +49,6 @@ ("TOYOTA3", "regen7204CA3A498|2023-10-30--23-15-55--0"), ("HONDA", "regen048F8FA0B24|2023-10-30--23-15-53--0"), ("HONDA2", "regen7D2D3F82D5B|2023-10-30--23-15-55--0"), - # TODO: Add 'HONDA3' for radarless cars with OP sending buttons to camera when engaged ("CHRYSLER", "regen7125C42780C|2023-10-30--23-16-21--0"), ("RAM", "regen2731F3213D2|2023-10-30--23-18-11--0"), ("SUBARU", "regen86E4C1B4DDD|2023-10-30--23-18-14--0"), From 797c879f535c7c9ca6811f2bbd693a9ef368ce1f Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 22 Feb 2024 17:57:27 +0000 Subject: [PATCH 04/12] name --- selfdrive/car/honda/interface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py index 5c14e09bfcad78..4fcb91223f99c7 100755 --- a/selfdrive/car/honda/interface.py +++ b/selfdrive/car/honda/interface.py @@ -16,7 +16,7 @@ TransmissionType = car.CarParams.TransmissionType CRUISE_BUTTONS_DICT = {CruiseButtons.RES_ACCEL: ButtonType.accelCruise, CruiseButtons.DECEL_SET: ButtonType.decelCruise, CruiseButtons.MAIN: ButtonType.altButton3, CruiseButtons.CANCEL: ButtonType.cancel} -SETTINGS_BUTTONS_DICT = {CruiseButtons.DISTANCE: ButtonType.gapAdjustCruise, CruiseButtons.LKAS: ButtonType.altButton1} +SETTING_BUTTONS_DICT = {CruiseButtons.DISTANCE: ButtonType.gapAdjustCruise, CruiseButtons.LKAS: ButtonType.altButton1} class CarInterface(CarInterfaceBase): @@ -316,7 +316,7 @@ def _update(self, c): ret.buttonEvents = [ *create_button_events(self.CS.cruise_buttons, self.CS.prev_cruise_buttons, CRUISE_BUTTONS_DICT), - *create_button_events(self.CS.cruise_setting, self.CS.prev_cruise_setting, SETTINGS_BUTTONS_DICT), + *create_button_events(self.CS.cruise_setting, self.CS.prev_cruise_setting, SETTING_BUTTONS_DICT), ] # events From 995a050f9526937f8f5b4f2a395b4f02c57dcd3a Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 22 Feb 2024 18:09:09 +0000 Subject: [PATCH 05/12] comment --- selfdrive/car/honda/hondacan.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 21b259ef4dbbf0..4a43da974522ec 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -186,7 +186,7 @@ def create_buttons_command(packer, button_val, setting_val, stock_scm_buttons, c values = { 'CRUISE_BUTTONS': button_val } - # Radarless: forward unmodified signals + # Radarless: set CRUISE_SETTING & forward unmodified data bits if len(stock_scm_buttons): values.update({ 'CRUISE_SETTING': setting_val, From 20e0ebd2ccb5829bdf87a0c2992164fe838bab30 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 22 Feb 2024 18:48:11 +0000 Subject: [PATCH 06/12] less. momentary press for auto resume and lkas button --- selfdrive/car/honda/carcontroller.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 1f33a0966d23c9..5a6de16d8e2a3c 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -202,7 +202,7 @@ 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.CP.carFingerprint)) - # Buttons: spam the cancel or resume buttons + # Buttons: spam the cancel or resume buttons. cruise = None setting = CruiseButtons.NONE if pcm_cancel_cmd: @@ -210,17 +210,18 @@ def update(self, CC, CS, now_nanos): 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: - # Intercept buttons when engaged. panda will forward when disengaged. Block the LKAS button coming from the car. - # Keep stock LKAS disabled so it can't disengage cruise when the wheel touch timeout expires. + # Send buttons to the camera when engaged and block the LKAS button. Keep 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: + if CS.cruise_buttons or (CS.cruise_setting and CS.cruise_setting != CruiseButtons.LKAS): cruise = CS.cruise_buttons - elif CS.cruise_setting and CS.cruise_setting != CruiseButtons.LKAS: setting = CS.cruise_setting - elif CC.cruiseControl.resume: - cruise = CruiseButtons.RES_ACCEL - elif CS.lkas_hud['ENABLED']: - setting = CruiseButtons.LKAS + # simulate a momentary press + elif self.frame % 100 <= 50: + 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, cruise, setting, CS.scm_buttons, self.CP.carFingerprint)) From f4053b0874e8661b11b1ff2f2784a2adc4eeb1d2 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 22 Feb 2024 21:00:55 +0000 Subject: [PATCH 07/12] comment --- selfdrive/car/honda/carcontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 5a6de16d8e2a3c..4f893145a82d1b 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -210,7 +210,7 @@ def update(self, CC, CS, now_nanos): 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 and block the LKAS button. Keep stock LKAS off so it can't disengage cruise. + # 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): From 4d50ccf9266b0dd9a29ed5e051dc7a914bd46e86 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Thu, 22 Feb 2024 21:01:04 +0000 Subject: [PATCH 08/12] shorter --- selfdrive/car/honda/carcontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 4f893145a82d1b..8b9520d13ffb52 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -217,7 +217,7 @@ def update(self, CC, CS, now_nanos): cruise = CS.cruise_buttons setting = CS.cruise_setting # simulate a momentary press - elif self.frame % 100 <= 50: + elif self.frame % 100 <= 25: if CC.cruiseControl.resume: cruise = CruiseButtons.RES_ACCEL elif CS.lkas_hud['ENABLED']: From e62c43cb87cf7fac990c140da91e9fdc088e0f44 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Tue, 30 Apr 2024 04:25:56 +0000 Subject: [PATCH 09/12] update these --- selfdrive/car/honda/carcontroller.py | 9 +++++---- selfdrive/car/honda/values.py | 5 +---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 21a614caebf2c1..1ffd8e3c205ee7 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -5,7 +5,8 @@ from openpilot.common.realtime import DT_CTRL from opendbc.can.packer import CANPacker from openpilot.selfdrive.car.honda import hondacan -from openpilot.selfdrive.car.honda.values import CruiseButtons, VISUAL_HUD, HONDA_BOSCH, HONDA_BOSCH_RADARLESS, HONDA_NIDEC_ALT_PCM_ACCEL, CarControllerParams +from openpilot.selfdrive.car.honda.values import CruiseButtons, CruiseSettings, VISUAL_HUD, HONDA_BOSCH, HONDA_BOSCH_RADARLESS, HONDA_NIDEC_ALT_PCM_ACCEL, \ + CarControllerParams from openpilot.selfdrive.car.interfaces import CarControllerBase from openpilot.selfdrive.controls.lib.drive_helpers import rate_limit @@ -205,7 +206,7 @@ def update(self, CC, CS, now_nanos): can_sends.append(hondacan.create_bosch_supplemental_1(self.packer, self.CAN, self.CP.carFingerprint)) # Buttons: spam the cancel or resume buttons. cruise = None - setting = CruiseButtons.NONE + setting = CruiseSettings.NONE if pcm_cancel_cmd: cruise = CruiseButtons.CANCEL elif self.CP.carFingerprint not in HONDA_BOSCH_RADARLESS and CC.cruiseControl.resume: @@ -214,7 +215,7 @@ def update(self, CC, CS, now_nanos): # 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): + if CS.cruise_buttons or (CS.cruise_setting and CS.cruise_setting != CruiseSettings.LKAS): cruise = CS.cruise_buttons setting = CS.cruise_setting # simulate a momentary press @@ -222,7 +223,7 @@ def update(self, CC, CS, now_nanos): if CC.cruiseControl.resume: cruise = CruiseButtons.RES_ACCEL elif CS.lkas_hud['ENABLED']: - setting = CruiseButtons.LKAS + setting = CruiseSettings.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)) diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py index 8f4ab848696dfc..235e212820f720 100644 --- a/selfdrive/car/honda/values.py +++ b/selfdrive/car/honda/values.py @@ -68,14 +68,11 @@ class CruiseButtons: MAIN = 1 NONE = 0 -# CRUISE_SETTINGS - DISTANCE = 3 - LKAS = 1 - class CruiseSettings: DISTANCE = 3 LKAS = 1 + NONE = 0 # See dbc files for info on values From 9bc79f23f9ec902b45cd1b4470651291049364d5 Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Tue, 11 Jun 2024 23:15:51 +0000 Subject: [PATCH 10/12] rename --- selfdrive/car/honda/carcontroller.py | 2 +- selfdrive/car/honda/hondacan.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 42dddeb65fa292..90d75f23dc8e80 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -222,7 +222,7 @@ def update(self, CC, CS, now_nanos): elif self.frame % 100 <= 25: if CC.cruiseControl.resume: cruise = CruiseButtons.RES_ACCEL - elif CS.lkas_hud['ENABLED']: + elif CS.lkas_hud['LKAS_ON']: setting = CruiseSettings.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)) diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py index 1b7fdf535eb433..ceb5026a24b6a6 100644 --- a/selfdrive/car/honda/hondacan.py +++ b/selfdrive/car/honda/hondacan.py @@ -167,7 +167,7 @@ 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 = { - 'ENABLED': 1, + 'LKAS_ON': 1, 'SET_ME_X20': 0x20, 'STEERING_REQUIRED': hud.steer_required, 'SOLID_LANES': hud.lanes_visible, From a21935f00f0a631f07a38c259376506df746adce Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Tue, 11 Jun 2024 23:18:20 +0000 Subject: [PATCH 11/12] remove LKAS button from CC --- selfdrive/car/honda/carcontroller.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index 90d75f23dc8e80..dfa98b3f78eadc 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -219,11 +219,8 @@ def update(self, CC, CS, now_nanos): 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['LKAS_ON']: - setting = CruiseSettings.LKAS + elif self.frame % 100 <= 25 and CC.cruiseControl.resume: + cruise = CruiseButtons.RES_ACCEL if cruise is not None: can_sends.append(hondacan.create_buttons_command(self.packer, self.CAN, cruise, setting, CS.scm_buttons, self.CP.carFingerprint)) From 2773f80b5d2aae5addd0298044aebfd1ea157b9e Mon Sep 17 00:00:00 2001 From: Chris Souers Date: Tue, 11 Jun 2024 23:26:28 +0000 Subject: [PATCH 12/12] rm the rest --- selfdrive/car/honda/carcontroller.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py index dfa98b3f78eadc..b0716ca84e42fd 100644 --- a/selfdrive/car/honda/carcontroller.py +++ b/selfdrive/car/honda/carcontroller.py @@ -212,10 +212,9 @@ def update(self, CC, CS, now_nanos): 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 + # Send buttons to the camera when engaged. Priority: pcm_cancel > user > auto resume > none/idle cruise = CruiseButtons.NONE - if CS.cruise_buttons or (CS.cruise_setting and CS.cruise_setting != CruiseSettings.LKAS): + if CS.cruise_buttons or CS.cruise_setting: cruise = CS.cruise_buttons setting = CS.cruise_setting # simulate a momentary press