From b65f516cb8bf0111dc3d9ca93e8e407c234fd4fd Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 19 Oct 2022 23:41:54 -0700 Subject: [PATCH] GM camera ACC: hide take steering alert (#26010) * add all signals * try to forward this PSCMStatus * fixes * see if this works * modify checksum when bit flipped * bump opendbc * so i can test without restarting * bump * bump panda * clean up * comment * also fix this * bump * bump * every 5 seconds * only send our values * fix * try sending everything again (+1 counter) * revert * revert, forward msg * forward * fix that * bump panda * bump panda * fine to not copy * after cancel, pass bus * fix * Revert "fine to not copy" This reverts commit 654ac1a7dad4f7b9b0a3de52768522fb60cc55bd. old-commit-hash: 63d552cafc6e4728cfe097e7a3f8e3f5cd98a566 --- panda | 2 +- selfdrive/car/gm/carcontroller.py | 4 ++++ selfdrive/car/gm/carstate.py | 7 +++++++ selfdrive/car/gm/gmcan.py | 6 ++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/panda b/panda index 723e60cb43..54f9390ff5 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit 723e60cb435ad5d3b6a8e99080be46a6590259cd +Subproject commit 54f9390ff51b4fb0c2b3a81b9cde8727acdd1977 diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index 7c883dacc0..dbad355c46 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -117,6 +117,10 @@ class CarController: self.last_button_frame = self.frame can_sends.append(gmcan.create_buttons(self.packer_pt, CanBus.CAMERA, CS.buttons_counter, CruiseButtons.CANCEL)) + # Silence "Take Steering" alert sent by camera, forward PSCMStatus with HandsOffSWlDetectionStatus=1 + if self.frame % 10 == 0: + can_sends.append(gmcan.create_pscm_status(self.packer_pt, CanBus.CAMERA, CS.pscm_status)) + # Show green icon when LKA torque is applied, and # alarming orange icon when approaching torque limit. # If not sent again, LKA icon disappears in about 5 seconds. diff --git a/selfdrive/car/gm/carstate.py b/selfdrive/car/gm/carstate.py index b651606b79..de63f56eab 100644 --- a/selfdrive/car/gm/carstate.py +++ b/selfdrive/car/gm/carstate.py @@ -1,3 +1,4 @@ +import copy from cereal import car from common.conversions import Conversions as CV from common.numpy_fast import mean @@ -26,6 +27,7 @@ class CarState(CarStateBase): self.prev_cruise_buttons = self.cruise_buttons self.cruise_buttons = pt_cp.vl["ASCMSteeringButton"]["ACCButtons"] self.buttons_counter = pt_cp.vl["ASCMSteeringButton"]["RollingCounter"] + self.pscm_status = copy.copy(pt_cp.vl["PSCMStatus"]) # Variables used for avoiding LKAS faults self.loopback_lka_steering_cmd_updated = len(loopback_cp.vl_all["ASCMLKASteeringCmd"]["RollingCounter"]) > 0 @@ -147,6 +149,11 @@ class CarState(CarStateBase): ("LKADriverAppldTrq", "PSCMStatus"), ("LKATorqueDelivered", "PSCMStatus"), ("LKATorqueDeliveredStatus", "PSCMStatus"), + ("HandsOffSWlDetectionStatus", "PSCMStatus"), + ("HandsOffSWDetectionMode", "PSCMStatus"), + ("LKATotalTorqueDelivered", "PSCMStatus"), + ("PSCMStatusChecksum", "PSCMStatus"), + ("RollingCounter", "PSCMStatus"), ("TractionControlOn", "ESPStatus"), ("ParkBrake", "VehicleIgnitionAlt"), ("CruiseMainOn", "ECMEngineStatus"), diff --git a/selfdrive/car/gm/gmcan.py b/selfdrive/car/gm/gmcan.py index 20e4c4ab6e..ec046dc3c2 100644 --- a/selfdrive/car/gm/gmcan.py +++ b/selfdrive/car/gm/gmcan.py @@ -7,6 +7,12 @@ def create_buttons(packer, bus, idx, button): } return packer.make_can_msg("ASCMSteeringButton", bus, values) +def create_pscm_status(packer, bus, pscm_status): + checksum_mod = int(1 - pscm_status["HandsOffSWlDetectionStatus"]) << 5 + pscm_status["HandsOffSWlDetectionStatus"] = 1 + pscm_status["PSCMStatusChecksum"] += checksum_mod + return packer.make_can_msg("PSCMStatus", bus, pscm_status) + def create_steering_control(packer, bus, apply_steer, idx, lkas_active): values = {