From 7cb11eb70fef6c4d24444a12aebf13a220402149 Mon Sep 17 00:00:00 2001 From: garrettpall <76917194+garrettpall@users.noreply.github.com> Date: Tue, 31 Oct 2023 15:52:22 -0400 Subject: [PATCH] Revert "Merge branch 'xt4'" This reverts commit 0eb15e807eca0b0d7304fdc4a3bf9335c96c3b71, reversing changes made to bf5a45ed9826af7dbf9e1db82413e1340bbfa074. --- .gitmodules | 6 +- panda | 2 +- selfdrive/car/gm/carcontroller.py | 8 +- selfdrive/car/gm/carstate.py | 91 +++++++---------------- selfdrive/car/gm/interface.py | 19 +---- selfdrive/car/gm/values.py | 16 ---- selfdrive/car/torque_data/substitute.yaml | 1 - 7 files changed, 33 insertions(+), 110 deletions(-) diff --git a/.gitmodules b/.gitmodules index 01b755dc35f4df..26f93ef164e782 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ +[submodule "panda"] + path = panda + url = ../../commaai/panda.git [submodule "opendbc"] path = opendbc url = ../../commaai/opendbc.git @@ -16,6 +19,3 @@ [submodule "tinygrad"] path = tinygrad_repo url = https://github.com/geohot/tinygrad.git -[submodule "panda"] - path = panda - url = https://github.com/garrettpall/panda.git diff --git a/panda b/panda index d29fde1329af7d..f3bdfdd4354ccc 160000 --- a/panda +++ b/panda @@ -1 +1 @@ -Subproject commit d29fde1329af7d9d8e9e65348a8db1c57c577115 +Subproject commit f3bdfdd4354ccc3a512dc289dc038d5b30d1fec2 diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index 8d01498b687bbd..f51cb753727737 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -5,7 +5,7 @@ from opendbc.can.packer import CANPacker from openpilot.selfdrive.car import apply_driver_steer_torque_limits from openpilot.selfdrive.car.gm import gmcan -from openpilot.selfdrive.car.gm.values import DBC, CanBus, CarControllerParams, CruiseButtons, SDGM_CAR +from openpilot.selfdrive.car.gm.values import DBC, CanBus, CarControllerParams, CruiseButtons VisualAlert = car.CarControl.HUDControl.VisualAlert NetworkLocation = car.CarParams.NetworkLocation @@ -147,11 +147,7 @@ def update(self, CC, CS, now_nanos): if (self.frame - self.last_button_frame) * DT_CTRL > 0.04: if self.cancel_counter > CAMERA_CANCEL_DELAY_FRAMES: self.last_button_frame = self.frame - if self.CP.carFingerprint in SDGM_CAR: - can_sends.append(gmcan.create_buttons(self.packer_pt, CanBus.POWERTRAIN, CS.buttons_counter, CruiseButtons.CANCEL)) - else: - can_sends.append(gmcan.create_buttons(self.packer_pt, CanBus.CAMERA, CS.buttons_counter, CruiseButtons.CANCEL)) - + can_sends.append(gmcan.create_buttons(self.packer_pt, CanBus.CAMERA, CS.buttons_counter, CruiseButtons.CANCEL)) if self.CP.networkLocation == NetworkLocation.fwdCamera: # Silence "Take Steering" alert sent by camera, forward PSCMStatus with HandsOffSWlDetectionStatus=1 diff --git a/selfdrive/car/gm/carstate.py b/selfdrive/car/gm/carstate.py index c0b2bfbfcde980..89c1a3596ac159 100644 --- a/selfdrive/car/gm/carstate.py +++ b/selfdrive/car/gm/carstate.py @@ -5,7 +5,7 @@ from opendbc.can.can_define import CANDefine from opendbc.can.parser import CANParser from openpilot.selfdrive.car.interfaces import CarStateBase -from openpilot.selfdrive.car.gm.values import DBC, AccState, CanBus, STEER_THRESHOLD, SDGM_CAR +from openpilot.selfdrive.car.gm.values import DBC, AccState, CanBus, STEER_THRESHOLD TransmissionType = car.CarParams.TransmissionType NetworkLocation = car.CarParams.NetworkLocation @@ -30,12 +30,8 @@ def update(self, pt_cp, cam_cp, loopback_cp): ret = car.CarState.new_message() self.prev_cruise_buttons = self.cruise_buttons - if self.CP.carFingerprint not in SDGM_CAR: - self.cruise_buttons = pt_cp.vl["ASCMSteeringButton"]["ACCButtons"] - self.buttons_counter = pt_cp.vl["ASCMSteeringButton"]["RollingCounter"] - else: - self.cruise_buttons = cam_cp.vl["ASCMSteeringButton"]["ACCButtons"] - self.buttons_counter = cam_cp.vl["ASCMSteeringButton"]["RollingCounter"] + 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"]) self.moving_backward = pt_cp.vl["EBCMWheelSpdRear"]["MovingBackward"] != 0 @@ -91,32 +87,18 @@ def update(self, pt_cp, cam_cp, loopback_cp): ret.steerFaultTemporary = self.lkas_status == 2 ret.steerFaultPermanent = self.lkas_status == 3 - if self.CP.carFingerprint not in SDGM_CAR: - # 1 - open, 0 - closed - ret.doorOpen = (pt_cp.vl["BCMDoorBeltStatus"]["FrontLeftDoor"] == 1 or - pt_cp.vl["BCMDoorBeltStatus"]["FrontRightDoor"] == 1 or - pt_cp.vl["BCMDoorBeltStatus"]["RearLeftDoor"] == 1 or - pt_cp.vl["BCMDoorBeltStatus"]["RearRightDoor"] == 1) + # 1 - open, 0 - closed + ret.doorOpen = (pt_cp.vl["BCMDoorBeltStatus"]["FrontLeftDoor"] == 1 or + pt_cp.vl["BCMDoorBeltStatus"]["FrontRightDoor"] == 1 or + pt_cp.vl["BCMDoorBeltStatus"]["RearLeftDoor"] == 1 or + pt_cp.vl["BCMDoorBeltStatus"]["RearRightDoor"] == 1) - # 1 - latched - ret.seatbeltUnlatched = pt_cp.vl["BCMDoorBeltStatus"]["LeftSeatBelt"] == 0 - ret.leftBlinker = pt_cp.vl["BCMTurnSignals"]["TurnSignals"] == 1 - ret.rightBlinker = pt_cp.vl["BCMTurnSignals"]["TurnSignals"] == 2 + # 1 - latched + ret.seatbeltUnlatched = pt_cp.vl["BCMDoorBeltStatus"]["LeftSeatBelt"] == 0 + ret.leftBlinker = pt_cp.vl["BCMTurnSignals"]["TurnSignals"] == 1 + ret.rightBlinker = pt_cp.vl["BCMTurnSignals"]["TurnSignals"] == 2 - ret.parkingBrake = pt_cp.vl["BCMGeneralPlatformStatus"]["ParkBrakeSwActive"] == 1 - else: - # 1 - open, 0 - closed - ret.doorOpen = (cam_cp.vl["BCMDoorBeltStatus"]["FrontLeftDoor"] == 1 or - cam_cp.vl["BCMDoorBeltStatus"]["FrontRightDoor"] == 1 or - cam_cp.vl["BCMDoorBeltStatus"]["RearLeftDoor"] == 1 or - cam_cp.vl["BCMDoorBeltStatus"]["RearRightDoor"] == 1) - - # 1 - latched - ret.seatbeltUnlatched = cam_cp.vl["BCMDoorBeltStatus"]["LeftSeatBelt"] == 0 - ret.leftBlinker = cam_cp.vl["BCMTurnSignals"]["TurnSignals"] == 1 - ret.rightBlinker = cam_cp.vl["BCMTurnSignals"]["TurnSignals"] == 2 - - ret.parkingBrake = cam_cp.vl["BCMGeneralPlatformStatus"]["ParkBrakeSwActive"] == 1 + ret.parkingBrake = pt_cp.vl["BCMGeneralPlatformStatus"]["ParkBrakeSwActive"] == 1 ret.cruiseState.available = pt_cp.vl["ECMEngineStatus"]["CruiseMainOn"] != 0 ret.espDisabled = pt_cp.vl["ESPStatus"]["TractionControlOn"] != 1 ret.accFaulted = (pt_cp.vl["AcceleratorPedal2"]["CruiseState"] == AccState.FAULTED or @@ -126,10 +108,7 @@ def update(self, pt_cp, cam_cp, loopback_cp): ret.cruiseState.standstill = pt_cp.vl["AcceleratorPedal2"]["CruiseState"] == AccState.STANDSTILL if self.CP.networkLocation == NetworkLocation.fwdCamera: ret.cruiseState.speed = cam_cp.vl["ASCMActiveCruiseControlStatus"]["ACCSpeedSetpoint"] * CV.KPH_TO_MS - if self.CP.carFingerprint not in SDGM_CAR: - ret.stockAeb = cam_cp.vl["AEBCmd"]["AEBCmdActive"] != 0 - else: - ret.stockAeb = False + ret.stockAeb = cam_cp.vl["AEBCmd"]["AEBCmdActive"] != 0 # openpilot controls nonAdaptive when not pcmCruise if self.CP.pcmCruise: ret.cruiseState.nonAdaptive = cam_cp.vl["ASCMActiveCruiseControlStatus"]["ACCCruiseState"] not in (2, 3) @@ -141,52 +120,32 @@ def get_cam_can_parser(CP): messages = [] if CP.networkLocation == NetworkLocation.fwdCamera: messages += [ - ("ASCMLKASteeringCmd", 10), - ("ASCMActiveCruiseControlStatus", 25), - ] - if CP.carFingerprint in SDGM_CAR: - messages += [ - ("BCMTurnSignals", 1), - ("BCMDoorBeltStatus", 10), - ("BCMGeneralPlatformStatus", 10), - ("ASCMSteeringButton", 33), - ] - else: - messages += [ - ("AEBCmd", 10), - ] + ("AEBCmd", 10), + ("ASCMLKASteeringCmd", 10), + ("ASCMActiveCruiseControlStatus", 25), + ] return CANParser(DBC[CP.carFingerprint]["pt"], messages, CanBus.CAMERA) @staticmethod def get_can_parser(CP): messages = [ + ("BCMTurnSignals", 1), + ("ECMPRDNL2", 10), ("PSCMStatus", 10), ("ESPStatus", 10), + ("BCMDoorBeltStatus", 10), + ("BCMGeneralPlatformStatus", 10), ("EBCMWheelSpdFront", 20), ("EBCMWheelSpdRear", 20), ("EBCMFrictionBrakeStatus", 20), + ("AcceleratorPedal2", 33), + ("ASCMSteeringButton", 33), + ("ECMEngineStatus", 100), ("PSCMSteeringAngle", 100), ("ECMAcceleratorPos", 80), ] - if CP.carFingerprint in SDGM_CAR: - messages += [ - ("ECMPRDNL2", 40), - ("AcceleratorPedal2", 40), - ("ECMEngineStatus", 80), - ] - else: - messages += [ - ("ECMPRDNL2", 10), - ("AcceleratorPedal2", 33), - ("ECMEngineStatus", 100), - ("BCMTurnSignals", 1), - ("BCMDoorBeltStatus", 10), - ("BCMGeneralPlatformStatus", 10), - ("ASCMSteeringButton", 33), - ] - # Used to read back last counter sent to PT by camera if CP.networkLocation == NetworkLocation.fwdCamera: messages += [ diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index c45a8dd0c91cf0..a0defb7cfbe149 100755 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -6,7 +6,7 @@ from openpilot.common.conversions import Conversions as CV from openpilot.selfdrive.car import create_button_events, get_safety_config from openpilot.selfdrive.car.gm.radar_interface import RADAR_HEADER_MSG -from openpilot.selfdrive.car.gm.values import CAR, CruiseButtons, CarControllerParams, EV_CAR, CAMERA_ACC_CAR, SDGM_CAR, CanBus +from openpilot.selfdrive.car.gm.values import CAR, CruiseButtons, CarControllerParams, EV_CAR, CAMERA_ACC_CAR, CanBus from openpilot.selfdrive.car.interfaces import CarInterfaceBase, TorqueFromLateralAccelCallbackType, FRICTION_THRESHOLD from openpilot.selfdrive.controls.lib.drive_helpers import get_friction @@ -105,15 +105,6 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): ret.openpilotLongitudinalControl = True ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_HW_CAM_LONG - elif candidate in SDGM_CAR: - ret.experimentalLongitudinalAvailable = False - ret.networkLocation = NetworkLocation.fwdCamera - ret.pcmCruise = True - ret.radarUnavailable = True - ret.minEnableSpeed = 31 * CV.MPH_TO_MS - ret.minSteerSpeed = 29 * CV.MPH_TO_MS - ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_HW_SDGM - else: # ASCM, OBD-II harness ret.openpilotLongitudinalControl = True ret.networkLocation = NetworkLocation.gateway @@ -261,12 +252,6 @@ def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): ret.steerActuatorDelay = 0.2 CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) - elif candidate == CAR.XT4: - ret.mass = 3660. * CV.LB_TO_KG - ret.wheelbase = 2.78 - ret.steerRatio = 14.4 - ret.centerToFront = ret.wheelbase * 0.4 - return ret # returns a car.CarState @@ -290,7 +275,7 @@ def _update(self, c): # TODO: verify 17 Volt can enable for the first time at a stop and allow for all GMs below_min_enable_speed = ret.vEgo < self.CP.minEnableSpeed or self.CS.moving_backward if below_min_enable_speed and not (ret.standstill and ret.brake >= 20 and - (self.CP.networkLocation == NetworkLocation.fwdCamera and not self.CP.carFingerprint in SDGM_CAR)): + self.CP.networkLocation == NetworkLocation.fwdCamera): events.add(EventName.belowEngageSpeed) if ret.cruiseState.standstill: events.add(EventName.resumeRequired) diff --git a/selfdrive/car/gm/values.py b/selfdrive/car/gm/values.py index 0fca942f5a2385..e9ec8de9c5f470 100644 --- a/selfdrive/car/gm/values.py +++ b/selfdrive/car/gm/values.py @@ -46,12 +46,6 @@ def __init__(self, CP): # Camera transitions to MAX_ACC_REGEN from ZERO_GAS and uses friction brakes instantly max_regen_acceleration = 0. - elif CP.carFingerprint in SDGM_CAR: - self.MAX_GAS = 3400 - self.MAX_ACC_REGEN = 1514 - self.INACTIVE_REGEN = 1554 - max_regen_acceleration = 0. - else: self.MAX_GAS = 3072 # Safety limit, not ACC max. Stock ACC >4096 from standstill. self.MAX_ACC_REGEN = 1404 # Max ACC regen is slightly less than max paddle regen @@ -82,7 +76,6 @@ class CAR(StrEnum): SILVERADO = "CHEVROLET SILVERADO 1500 2020" EQUINOX = "CHEVROLET EQUINOX 2019" TRAILBLAZER = "CHEVROLET TRAILBLAZER 2021" - XT4 = "CADILLAC XT4 2023" class Footnote(Enum): @@ -125,7 +118,6 @@ def init_make(self, CP: car.CarParams): ], CAR.EQUINOX: GMCarInfo("Chevrolet Equinox 2019-22"), CAR.TRAILBLAZER: GMCarInfo("Chevrolet Trailblazer 2021-22"), - CAR.XT4: GMCarInfo("Cadillac XT4 2023", "Driver Assist Package"), } @@ -230,11 +222,6 @@ class CanBus: # { # 190: 6, 193: 8, 197: 8, 201: 8, 209: 7, 211: 2, 241: 6, 249: 8, 288: 5, 289: 8, 298: 8, 304: 3, 309: 8, 311: 8, 313: 8, 320: 4, 328: 1, 352: 5, 381: 8, 384: 4, 386: 8, 388: 8, 413: 8, 451: 8, 452: 8, 453: 6, 455: 7, 479: 3, 481: 7, 485: 8, 489: 8, 497: 8, 500: 6, 501: 8, 532: 6, 560: 8, 562: 8, 563: 5, 565: 5, 587: 8, 707: 8, 715: 8, 717: 5, 761: 7, 789: 5, 800: 6, 810: 8, 840: 5, 842: 5, 844: 8, 869: 4, 880: 6, 977: 8, 1001: 8, 1011: 6, 1017: 8, 1020: 8, 1217: 8, 1221: 5, 1233: 8, 1249: 8, 1259: 8, 1261: 7, 1263: 4, 1265: 8, 1267: 1, 1271: 8, 1280: 4, 1296: 4, 1300: 8, 1609: 8, 1611: 8, 1613: 8, 1649: 8, 1792: 8, 1798: 8, 1824: 8, 1825: 8, 1840: 8, 1842: 8, 1858: 8, 1860: 8, 1863: 8, 1872: 8, 1875: 8, 1882: 8, 1888: 8, 1889: 8, 1892: 8, 1930: 7, 1937: 8, 1953: 8, 1968: 8, 2001: 8, 2017: 8, 2018: 8, 2020: 8 # }], - CAR.XT4: [ - # Cadillac XT4 w/ ACC 2023 - { - 190: 6, 193: 8, 197: 8, 199: 4, 201: 8, 209: 7, 211: 2, 241: 6, 249: 8, 288: 5, 289: 8, 292: 2, 298: 8, 304: 3, 309: 8, 313: 8, 320: 4, 322: 7, 328: 1, 331: 3, 352: 5, 353: 3, 368: 3, 381: 8, 384: 4, 386: 8, 388: 8, 393: 7, 398: 8, 401: 8, 407: 7, 413: 8, 417: 7, 419: 1, 422: 4, 426: 7, 431: 8, 442: 8, 451: 8, 452: 8, 453: 6, 455: 7, 479: 3, 481: 7, 485: 8, 489: 8, 497: 8, 499: 3, 500: 6, 501: 8, 503: 2, 508: 8, 532: 6, 554: 3, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 567: 5, 573: 1, 577: 8, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 647: 6, 707: 8, 715: 8, 717: 5, 719: 5, 761: 7, 806: 1, 840: 5, 842: 5, 844: 8, 866: 4, 869: 4, 872: 1, 880: 6, 961: 8, 969: 8, 975: 2, 977: 8, 979: 8, 985: 5, 1001: 8, 1005: 6, 1009: 8, 1011: 6, 1013: 5, 1017: 8, 1020: 8, 1033: 7, 1034: 7, 1037: 5, 1105: 5, 1187: 5, 1195: 3, 1217: 8, 1221: 5, 1223: 2, 1225: 7, 1233: 8, 1236: 8, 1249: 8, 1257: 6, 1259: 8, 1261: 7, 1263: 4, 1265: 8, 1267: 1, 1268: 2, 1271: 8, 1273: 3, 1276: 2, 1277: 7, 1278: 4, 1279: 4, 1280: 4, 1296: 4, 1300: 8, 1322: 6, 1323: 4, 1328: 4, 1417: 8, 1601: 8, 1609: 8, 1613: 8, 1649: 8, 1792: 8, 1793: 8, 1798: 8, 1824: 8, 1825: 8, 1840: 8, 1842: 8, 1858: 8, 1860: 8, 1863: 8, 1872: 8, 1875: 8, 1882: 8, 1888: 8, 1889: 8, 1892: 8, 1906: 7, 1907: 7, 1912: 7, 1919: 7, 1920: 8, 1924: 8, 1930: 7, 1937: 8, 1953: 8, 1968: 8, 1969: 8, 1971: 8, 1975: 8, 1984: 8, 1988: 8, 2000: 8, 2001: 8, 2002: 8, 2017: 8, 2018: 8, 2020: 8, 2026: 8 - }], } GM_RX_OFFSET = 0x400 @@ -246,7 +233,4 @@ class CanBus: # We're integrated at the camera with VOACC on these cars (instead of ASCM w/ OBD-II harness) CAMERA_ACC_CAR = {CAR.BOLT_EUV, CAR.SILVERADO, CAR.EQUINOX, CAR.TRAILBLAZER} -# We're integrated at the Saftey Data Gateway Module on these cars -SDGM_CAR = {CAR.XT4} - STEER_THRESHOLD = 1.0 diff --git a/selfdrive/car/torque_data/substitute.yaml b/selfdrive/car/torque_data/substitute.yaml index f411b291b58d6c..c7a1566b327c77 100644 --- a/selfdrive/car/torque_data/substitute.yaml +++ b/selfdrive/car/torque_data/substitute.yaml @@ -52,7 +52,6 @@ CADILLAC ESCALADE ESV 2016: CHEVROLET VOLT PREMIER 2017 CADILLAC ATS Premium Performance 2018: CHEVROLET VOLT PREMIER 2017 CHEVROLET MALIBU PREMIER 2017: CHEVROLET VOLT PREMIER 2017 HOLDEN ASTRA RS-V BK 2017: CHEVROLET VOLT PREMIER 2017 -CADILLAC XT4 2023: CHEVROLET VOLT PREMIER 2017 SKODA FABIA 4TH GEN: VOLKSWAGEN GOLF 7TH GEN SKODA OCTAVIA 3RD GEN: SKODA SUPERB 3RD GEN