From 2b73c27bf6c038e7340db1312aee641b6c50281b Mon Sep 17 00:00:00 2001 From: Jason Shuler Date: Mon, 20 Jun 2022 00:30:51 -0400 Subject: [PATCH 01/14] Interface radarOffCan set, comments --- selfdrive/car/gm/interface.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index 9c1744dfb4c60c..4c7ba5656feb5d 100755 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -45,7 +45,8 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa ret = CarInterfaceBase.get_std_params(candidate, fingerprint) ret.carName = "gm" ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.gm)] - ret.pcmCruise = False # stock cruise control is kept off + ret.pcmCruise = False # For ASCM, stock cruise control is kept off (but not ACC) + ret.radarOffCan = False # For ASCM, radar is expected # These cars have been put into dashcam only due to both a lack of users and test coverage. # These cars likely still work fine. Once a user confirms each car works and a test route is @@ -55,7 +56,7 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa # Presence of a camera on the object bus is ok. # Have to go to read_only if ASCM is online (ACC-enabled cars), # or camera is on powertrain bus (LKA cars without ACC). - ret.openpilotLongitudinalControl = True + ret.openpilotLongitudinalControl = True # For ASCM, OP performs long tire_stiffness_factor = 0.444 # not optimized yet # Start with a baseline tuning for all GM vehicles. Override tuning as needed in each model section below. From f707619b8564fc2307a68c6f99dc2feb59f3136b Mon Sep 17 00:00:00 2001 From: Jason Shuler Date: Mon, 20 Jun 2022 00:31:59 -0400 Subject: [PATCH 02/14] pass pcmCruise value to common events --- selfdrive/car/gm/interface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index 4c7ba5656feb5d..8eb8f53cc4cdc6 100755 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -161,7 +161,7 @@ def _update(self, c): ret.buttonEvents = [be] - events = self.create_common_events(ret, pcm_enable=False) + events = self.create_common_events(ret, pcm_enable=self.CP.pcmCruise) if ret.vEgo < self.CP.minEnableSpeed: events.add(EventName.belowEngageSpeed) @@ -171,7 +171,7 @@ def _update(self, c): events.add(car.CarEvent.EventName.belowSteerSpeed) # handle button presses - events.events.extend(create_button_enable_events(ret.buttonEvents)) + events.events.extend(create_button_enable_events(ret.buttonEvents, pcm_cruise=self.CP.pcmCruise)) ret.events = events.to_msg() From da453da7cd1926dde8c95b8056a3b6b59ad7f141 Mon Sep 17 00:00:00 2001 From: Jason Shuler Date: Mon, 20 Jun 2022 00:33:19 -0400 Subject: [PATCH 03/14] add transType and networkLoc to iface --- selfdrive/car/gm/interface.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index 8eb8f53cc4cdc6..6dd5882dc22023 100755 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -9,6 +9,8 @@ ButtonType = car.CarState.ButtonEvent.Type EventName = car.CarEvent.EventName +TransmissionType = car.CarParams.TransmissionType +NetworkLocation = car.CarParams.NetworkLocation BUTTONS_DICT = {CruiseButtons.RES_ACCEL: ButtonType.accelCruise, CruiseButtons.DECEL_SET: ButtonType.decelCruise, CruiseButtons.MAIN: ButtonType.altButton3, CruiseButtons.CANCEL: ButtonType.cancel} @@ -47,6 +49,8 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.gm)] ret.pcmCruise = False # For ASCM, stock cruise control is kept off (but not ACC) ret.radarOffCan = False # For ASCM, radar is expected + ret.transmissionType = TransmissionType.automatic + ret.networkLocation = NetworkLocation.gateway # These cars have been put into dashcam only due to both a lack of users and test coverage. # These cars likely still work fine. Once a user confirms each car works and a test route is @@ -78,6 +82,7 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa ret.minEnableSpeed = 18 * CV.MPH_TO_MS if candidate == CAR.VOLT: + ret.transmissionType = TransmissionType.direct # EV (or hybrid) ret.mass = 1607. + STD_CARGO_KG ret.wheelbase = 2.69 ret.steerRatio = 17.7 # Stock 15.7, LiveParameters From 2143893062aa97478e21cbaafebf9d5cbacaef27 Mon Sep 17 00:00:00 2001 From: Jason Shuler Date: Mon, 20 Jun 2022 00:34:15 -0400 Subject: [PATCH 04/14] carstate use transtype to detect EV --- selfdrive/car/gm/carstate.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/gm/carstate.py b/selfdrive/car/gm/carstate.py index 48b9f25444189f..6179d1b68c821e 100644 --- a/selfdrive/car/gm/carstate.py +++ b/selfdrive/car/gm/carstate.py @@ -3,7 +3,9 @@ from opendbc.can.can_define import CANDefine from opendbc.can.parser import CANParser from selfdrive.car.interfaces import CarStateBase -from selfdrive.car.gm.values import DBC, CAR, AccState, CanBus, STEER_THRESHOLD +from selfdrive.car.gm.values import DBC, AccState, CanBus, STEER_THRESHOLD + +TransmissionType = car.CarParams.TransmissionType class CarState(CarStateBase): @@ -35,7 +37,7 @@ def update(self, pt_cp, loopback_cp): ret.brakePressed = pt_cp.vl["EBCMBrakePedalPosition"]["BrakePedalPosition"] >= 10 # Regen braking is braking - if self.car_fingerprint == CAR.VOLT: + if self.CP.transmissionType == TransmissionType.direct: ret.brakePressed = ret.brakePressed or pt_cp.vl["EBCMRegenPaddle"]["RegenPaddle"] != 0 ret.gas = pt_cp.vl["AcceleratorPedal2"]["AcceleratorPedal2"] / 254. @@ -120,7 +122,7 @@ def get_can_parser(CP): ("EBCMBrakePedalPosition", 100), ] - if CP.carFingerprint == CAR.VOLT: + if CP.transmissionType == TransmissionType.direct: signals.append(("RegenPaddle", "EBCMRegenPaddle")) checks.append(("EBCMRegenPaddle", 50)) From 73a439d9db6678a06ad4aa3f0cbd114f1fa6ae18 Mon Sep 17 00:00:00 2001 From: Jason Shuler Date: Mon, 20 Jun 2022 00:36:37 -0400 Subject: [PATCH 05/14] ctrl: limit sends by config --- selfdrive/car/gm/carcontroller.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index ae2a188e3f6787..bbd1773e42f61e 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -8,6 +8,7 @@ from selfdrive.car.gm.values import DBC, CanBus, CarControllerParams VisualAlert = car.CarControl.HUDControl.VisualAlert +NetworkLocation = car.CarParams.NetworkLocation class CarController: @@ -61,7 +62,7 @@ def update(self, CC, CS): can_sends.append(gmcan.create_steering_control(self.packer_pt, CanBus.POWERTRAIN, apply_steer, idx, lkas_enabled)) # Gas/regen and brakes - all at 25Hz - if (self.frame % 4) == 0: + if CS.CP.openpilotLongitudinalControl and ((self.frame % 4) == 0): if not CC.longActive: # Stock ECU sends max regen when not enabled self.apply_gas = self.params.MAX_ACC_REGEN @@ -79,7 +80,7 @@ def update(self, CC, CS): can_sends.append(gmcan.create_friction_brake_command(self.packer_ch, CanBus.CHASSIS, self.apply_brake, idx, near_stop, at_full_stop)) # Send dashboard UI commands (ACC status), 25hz - if (self.frame % 4) == 0: + if CS.CP.openpilotLongitudinalControl and ((self.frame % 4) == 0): send_fcw = hud_alert == VisualAlert.fcw can_sends.append(gmcan.create_acc_dashboard_command(self.packer_pt, CanBus.POWERTRAIN, CC.enabled, hud_v_cruise * CV.MS_TO_KPH, hud_control.leadVisible, send_fcw)) @@ -89,18 +90,18 @@ def update(self, CC, CS): time_and_headlights_step = 10 tt = self.frame * DT_CTRL - if self.frame % time_and_headlights_step == 0: + if CS.CP.openpilotLongitudinalControl and (not CS.CP.radarOffCan) and ((self.frame % time_and_headlights_step) == 0): idx = (self.frame // time_and_headlights_step) % 4 can_sends.append(gmcan.create_adas_time_status(CanBus.OBSTACLE, int((tt - self.start_time) * 60), idx)) can_sends.append(gmcan.create_adas_headlights_status(self.packer_obj, CanBus.OBSTACLE)) speed_and_accelerometer_step = 2 - if self.frame % speed_and_accelerometer_step == 0: + if CS.CP.openpilotLongitudinalControl and (not CS.CP.radarOffCan) and ((self.frame % speed_and_accelerometer_step) == 0): idx = (self.frame // speed_and_accelerometer_step) % 4 can_sends.append(gmcan.create_adas_steering_status(CanBus.OBSTACLE, idx)) can_sends.append(gmcan.create_adas_accelerometer_speed_status(CanBus.OBSTACLE, CS.out.vEgo, idx)) - if self.frame % self.params.ADAS_KEEPALIVE_STEP == 0: + if CS.CP.openpilotLongitudinalControl and CS.CP.networkLocation == NetworkLocation.gateway and ((self.frame % self.params.ADAS_KEEPALIVE_STEP) == 0): can_sends += gmcan.create_adas_keepalive(CanBus.POWERTRAIN) # Show green icon when LKA torque is applied, and @@ -110,7 +111,7 @@ def update(self, CC, CS): lka_active = CS.lkas_status == 1 lka_critical = lka_active and abs(actuators.steer) > 0.9 lka_icon_status = (lka_active, lka_critical) - if self.frame % self.params.CAMERA_KEEPALIVE_STEP == 0 or lka_icon_status != self.lka_icon_status_last: + if CS.CP.networkLocation != NetworkLocation.fwdCamera and ((self.frame % self.params.CAMERA_KEEPALIVE_STEP) == 0 or lka_icon_status != self.lka_icon_status_last): steer_alert = hud_alert in (VisualAlert.steerRequired, VisualAlert.ldw) can_sends.append(gmcan.create_lka_icon_command(CanBus.SW_GMLAN, lka_active, lka_critical, steer_alert)) self.lka_icon_status_last = lka_icon_status From 77f38afd564e4889ee073ffe3ce1ccf8c8da6681 Mon Sep 17 00:00:00 2001 From: Jason Shuler Date: Mon, 20 Jun 2022 01:09:03 -0400 Subject: [PATCH 06/14] Add clarifying comments for new vals --- selfdrive/car/gm/interface.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index 6dd5882dc22023..7e104233a19bcd 100755 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -49,7 +49,11 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.gm)] ret.pcmCruise = False # For ASCM, stock cruise control is kept off (but not ACC) ret.radarOffCan = False # For ASCM, radar is expected + # TransmissionType.automatic = Traditional Gas / Automatic Transmission + # TransmissionType.direct = EV / Hybrid ret.transmissionType = TransmissionType.automatic + # NetworkLocation.gateway = OBD-II harness (Typically ASCM) + # NetworkLocation.fwdCamera = Camera Harness (Non-ASCM) ret.networkLocation = NetworkLocation.gateway # These cars have been put into dashcam only due to both a lack of users and test coverage. From 6ad6c11ca5bd817154cd3f416fc2eec33244fbd1 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 30 Jun 2022 13:20:24 -0700 Subject: [PATCH 07/14] clean up --- selfdrive/car/gm/carcontroller.py | 95 ++++++++++++++++--------------- selfdrive/car/gm/interface.py | 20 +++---- 2 files changed, 57 insertions(+), 58 deletions(-) diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index bbd1773e42f61e..0ccd1f0bcd17aa 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -13,6 +13,7 @@ class CarController: def __init__(self, dbc_name, CP, VM): + self.CP = CP self.start_time = 0. self.apply_steer_last = 0 self.apply_gas = 0 @@ -25,9 +26,9 @@ def __init__(self, dbc_name, CP, VM): self.params = CarControllerParams() - self.packer_pt = CANPacker(DBC[CP.carFingerprint]['pt']) - self.packer_obj = CANPacker(DBC[CP.carFingerprint]['radar']) - self.packer_ch = CANPacker(DBC[CP.carFingerprint]['chassis']) + self.packer_pt = CANPacker(DBC[self.CP.carFingerprint]['pt']) + self.packer_obj = CANPacker(DBC[self.CP.carFingerprint]['radar']) + self.packer_ch = CANPacker(DBC[self.CP.carFingerprint]['chassis']) def update(self, CC, CS): actuators = CC.actuators @@ -61,48 +62,50 @@ def update(self, CC, CS): can_sends.append(gmcan.create_steering_control(self.packer_pt, CanBus.POWERTRAIN, apply_steer, idx, lkas_enabled)) - # Gas/regen and brakes - all at 25Hz - if CS.CP.openpilotLongitudinalControl and ((self.frame % 4) == 0): - if not CC.longActive: - # Stock ECU sends max regen when not enabled - self.apply_gas = self.params.MAX_ACC_REGEN - self.apply_brake = 0 - else: - self.apply_gas = int(round(interp(actuators.accel, self.params.GAS_LOOKUP_BP, self.params.GAS_LOOKUP_V))) - self.apply_brake = int(round(interp(actuators.accel, self.params.BRAKE_LOOKUP_BP, self.params.BRAKE_LOOKUP_V))) - - idx = (self.frame // 4) % 4 - - at_full_stop = CC.longActive and CS.out.standstill - near_stop = CC.longActive and (CS.out.vEgo < self.params.NEAR_STOP_BRAKE_PHASE) - # GasRegenCmdActive needs to be 1 to avoid cruise faults. It describes the ACC state, not actuation - can_sends.append(gmcan.create_gas_regen_command(self.packer_pt, CanBus.POWERTRAIN, self.apply_gas, idx, CC.enabled, at_full_stop)) - can_sends.append(gmcan.create_friction_brake_command(self.packer_ch, CanBus.CHASSIS, self.apply_brake, idx, near_stop, at_full_stop)) - - # Send dashboard UI commands (ACC status), 25hz - if CS.CP.openpilotLongitudinalControl and ((self.frame % 4) == 0): - send_fcw = hud_alert == VisualAlert.fcw - can_sends.append(gmcan.create_acc_dashboard_command(self.packer_pt, CanBus.POWERTRAIN, CC.enabled, - hud_v_cruise * CV.MS_TO_KPH, hud_control.leadVisible, send_fcw)) - - # Radar needs to know current speed and yaw rate (50hz), - # and that ADAS is alive (10hz) - time_and_headlights_step = 10 - tt = self.frame * DT_CTRL - - if CS.CP.openpilotLongitudinalControl and (not CS.CP.radarOffCan) and ((self.frame % time_and_headlights_step) == 0): - idx = (self.frame // time_and_headlights_step) % 4 - can_sends.append(gmcan.create_adas_time_status(CanBus.OBSTACLE, int((tt - self.start_time) * 60), idx)) - can_sends.append(gmcan.create_adas_headlights_status(self.packer_obj, CanBus.OBSTACLE)) - - speed_and_accelerometer_step = 2 - if CS.CP.openpilotLongitudinalControl and (not CS.CP.radarOffCan) and ((self.frame % speed_and_accelerometer_step) == 0): - idx = (self.frame // speed_and_accelerometer_step) % 4 - can_sends.append(gmcan.create_adas_steering_status(CanBus.OBSTACLE, idx)) - can_sends.append(gmcan.create_adas_accelerometer_speed_status(CanBus.OBSTACLE, CS.out.vEgo, idx)) - - if CS.CP.openpilotLongitudinalControl and CS.CP.networkLocation == NetworkLocation.gateway and ((self.frame % self.params.ADAS_KEEPALIVE_STEP) == 0): - can_sends += gmcan.create_adas_keepalive(CanBus.POWERTRAIN) + if self.CP.openpilotLongitudinalControl: + # Gas/regen and brakes - all at 25Hz + if self.frame % 4 == 0: + if not CC.longActive: + # Stock ECU sends max regen when not enabled + self.apply_gas = self.params.MAX_ACC_REGEN + self.apply_brake = 0 + else: + self.apply_gas = int(round(interp(actuators.accel, self.params.GAS_LOOKUP_BP, self.params.GAS_LOOKUP_V))) + self.apply_brake = int(round(interp(actuators.accel, self.params.BRAKE_LOOKUP_BP, self.params.BRAKE_LOOKUP_V))) + + idx = (self.frame // 4) % 4 + + at_full_stop = CC.longActive and CS.out.standstill + near_stop = CC.longActive and (CS.out.vEgo < self.params.NEAR_STOP_BRAKE_PHASE) + # GasRegenCmdActive needs to be 1 to avoid cruise faults. It describes the ACC state, not actuation + can_sends.append(gmcan.create_gas_regen_command(self.packer_pt, CanBus.POWERTRAIN, self.apply_gas, idx, CC.enabled, at_full_stop)) + can_sends.append(gmcan.create_friction_brake_command(self.packer_ch, CanBus.CHASSIS, self.apply_brake, idx, near_stop, at_full_stop)) + + # Send dashboard UI commands (ACC status), 25hz + if self.frame % 4 == 0: + send_fcw = hud_alert == VisualAlert.fcw + can_sends.append(gmcan.create_acc_dashboard_command(self.packer_pt, CanBus.POWERTRAIN, CC.enabled, + hud_v_cruise * CV.MS_TO_KPH, hud_control.leadVisible, send_fcw)) + + # Radar needs to know current speed and yaw rate (50hz), + # and that ADAS is alive (10hz) + time_and_headlights_step = 10 + tt = self.frame * DT_CTRL + + if not self.CP.radarOffCan: + if self.frame % time_and_headlights_step == 0: + idx = (self.frame // time_and_headlights_step) % 4 + can_sends.append(gmcan.create_adas_time_status(CanBus.OBSTACLE, int((tt - self.start_time) * 60), idx)) + can_sends.append(gmcan.create_adas_headlights_status(self.packer_obj, CanBus.OBSTACLE)) + + speed_and_accelerometer_step = 2 + if self.frame % speed_and_accelerometer_step == 0: + idx = (self.frame // speed_and_accelerometer_step) % 4 + can_sends.append(gmcan.create_adas_steering_status(CanBus.OBSTACLE, idx)) + can_sends.append(gmcan.create_adas_accelerometer_speed_status(CanBus.OBSTACLE, CS.out.vEgo, idx)) + + if self.CP.networkLocation == NetworkLocation.gateway and self.frame % self.params.ADAS_KEEPALIVE_STEP == 0: + can_sends += gmcan.create_adas_keepalive(CanBus.POWERTRAIN) # Show green icon when LKA torque is applied, and # alarming orange icon when approaching torque limit. @@ -111,7 +114,7 @@ def update(self, CC, CS): lka_active = CS.lkas_status == 1 lka_critical = lka_active and abs(actuators.steer) > 0.9 lka_icon_status = (lka_active, lka_critical) - if CS.CP.networkLocation != NetworkLocation.fwdCamera and ((self.frame % self.params.CAMERA_KEEPALIVE_STEP) == 0 or lka_icon_status != self.lka_icon_status_last): + if self.CP.networkLocation != NetworkLocation.fwdCamera and (self.frame % self.params.CAMERA_KEEPALIVE_STEP == 0 or lka_icon_status != self.lka_icon_status_last): steer_alert = hud_alert in (VisualAlert.steerRequired, VisualAlert.ldw) can_sends.append(gmcan.create_lka_icon_command(CanBus.SW_GMLAN, lka_active, lka_critical, steer_alert)) self.lka_icon_status_last = lka_icon_status diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index 7e104233a19bcd..cd1590d54fa3ae 100755 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -47,14 +47,10 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa ret = CarInterfaceBase.get_std_params(candidate, fingerprint) ret.carName = "gm" ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.gm)] - ret.pcmCruise = False # For ASCM, stock cruise control is kept off (but not ACC) - ret.radarOffCan = False # For ASCM, radar is expected - # TransmissionType.automatic = Traditional Gas / Automatic Transmission - # TransmissionType.direct = EV / Hybrid + ret.pcmCruise = False # For ASCM, stock non-adaptive cruise control is kept off + ret.radarOffCan = False # For ASCM, radar exists ret.transmissionType = TransmissionType.automatic - # NetworkLocation.gateway = OBD-II harness (Typically ASCM) - # NetworkLocation.fwdCamera = Camera Harness (Non-ASCM) - ret.networkLocation = NetworkLocation.gateway + ret.networkLocation = NetworkLocation.gateway # gateway: OBD-II harness (typically ASCM), fwdCamera: non-ASCM # These cars have been put into dashcam only due to both a lack of users and test coverage. # These cars likely still work fine. Once a user confirms each car works and a test route is @@ -64,7 +60,7 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa # Presence of a camera on the object bus is ok. # Have to go to read_only if ASCM is online (ACC-enabled cars), # or camera is on powertrain bus (LKA cars without ACC). - ret.openpilotLongitudinalControl = True # For ASCM, OP performs long + ret.openpilotLongitudinalControl = True tire_stiffness_factor = 0.444 # not optimized yet # Start with a baseline tuning for all GM vehicles. Override tuning as needed in each model section below. @@ -86,18 +82,18 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa ret.minEnableSpeed = 18 * CV.MPH_TO_MS if candidate == CAR.VOLT: - ret.transmissionType = TransmissionType.direct # EV (or hybrid) + ret.transmissionType = TransmissionType.direct ret.mass = 1607. + STD_CARGO_KG ret.wheelbase = 2.69 ret.steerRatio = 17.7 # Stock 15.7, LiveParameters - tire_stiffness_factor = 0.469 # Stock Michelin Energy Saver A/S, LiveParameters - ret.centerToFront = ret.wheelbase * 0.45 # Volt Gen 1, TODO corner weigh + tire_stiffness_factor = 0.469 # Stock Michelin Energy Saver A/S, LiveParameters + ret.centerToFront = ret.wheelbase * 0.45 # Volt Gen 1, TODO corner weigh ret.lateralTuning.pid.kpBP = [0., 40.] ret.lateralTuning.pid.kpV = [0., 0.17] ret.lateralTuning.pid.kiBP = [0.] ret.lateralTuning.pid.kiV = [0.] - ret.lateralTuning.pid.kf = 1. # get_steer_feedforward_volt() + ret.lateralTuning.pid.kf = 1. # get_steer_feedforward_volt() ret.steerActuatorDelay = 0.2 elif candidate == CAR.MALIBU: From eb65096849395b13b0c58b5d10bd04b26b0cd40e Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 30 Jun 2022 13:23:45 -0700 Subject: [PATCH 08/14] comment on new line --- selfdrive/car/gm/interface.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py index cd1590d54fa3ae..282844d095854c 100755 --- a/selfdrive/car/gm/interface.py +++ b/selfdrive/car/gm/interface.py @@ -50,7 +50,8 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa ret.pcmCruise = False # For ASCM, stock non-adaptive cruise control is kept off ret.radarOffCan = False # For ASCM, radar exists ret.transmissionType = TransmissionType.automatic - ret.networkLocation = NetworkLocation.gateway # gateway: OBD-II harness (typically ASCM), fwdCamera: non-ASCM + # NetworkLocation.gateway: OBD-II harness (typically ASCM), NetworkLocation.fwdCamera: non-ASCM + ret.networkLocation = NetworkLocation.gateway # These cars have been put into dashcam only due to both a lack of users and test coverage. # These cars likely still work fine. Once a user confirms each car works and a test route is From e6faab035af174b41de4a0374b15a8305c919657 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 30 Jun 2022 13:24:49 -0700 Subject: [PATCH 09/14] these have the same frequency --- selfdrive/car/gm/carcontroller.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index 0ccd1f0bcd17aa..b8fb81d0359ac5 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -81,8 +81,7 @@ def update(self, CC, CS): can_sends.append(gmcan.create_gas_regen_command(self.packer_pt, CanBus.POWERTRAIN, self.apply_gas, idx, CC.enabled, at_full_stop)) can_sends.append(gmcan.create_friction_brake_command(self.packer_ch, CanBus.CHASSIS, self.apply_brake, idx, near_stop, at_full_stop)) - # Send dashboard UI commands (ACC status), 25hz - if self.frame % 4 == 0: + # Send dashboard UI commands (ACC status), 25hz send_fcw = hud_alert == VisualAlert.fcw can_sends.append(gmcan.create_acc_dashboard_command(self.packer_pt, CanBus.POWERTRAIN, CC.enabled, hud_v_cruise * CV.MS_TO_KPH, hud_control.leadVisible, send_fcw)) From c4201baeb62cabdcc695295207aba40de62bfdad Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 30 Jun 2022 13:25:44 -0700 Subject: [PATCH 10/14] remove 25hz --- selfdrive/car/gm/carcontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index b8fb81d0359ac5..a320ed775a9b82 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -81,7 +81,7 @@ def update(self, CC, CS): can_sends.append(gmcan.create_gas_regen_command(self.packer_pt, CanBus.POWERTRAIN, self.apply_gas, idx, CC.enabled, at_full_stop)) can_sends.append(gmcan.create_friction_brake_command(self.packer_ch, CanBus.CHASSIS, self.apply_brake, idx, near_stop, at_full_stop)) - # Send dashboard UI commands (ACC status), 25hz + # Send dashboard UI commands (ACC status) send_fcw = hud_alert == VisualAlert.fcw can_sends.append(gmcan.create_acc_dashboard_command(self.packer_pt, CanBus.POWERTRAIN, CC.enabled, hud_v_cruise * CV.MS_TO_KPH, hud_control.leadVisible, send_fcw)) From fe2d00ba85e09f4f3ed04a58278a98c242950c45 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 30 Jun 2022 13:28:18 -0700 Subject: [PATCH 11/14] add to upper comment --- selfdrive/car/gm/carcontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index a320ed775a9b82..6849c6763ab112 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -63,7 +63,7 @@ def update(self, CC, CS): can_sends.append(gmcan.create_steering_control(self.packer_pt, CanBus.POWERTRAIN, apply_steer, idx, lkas_enabled)) if self.CP.openpilotLongitudinalControl: - # Gas/regen and brakes - all at 25Hz + # Gas/regen, brakes, and UI commands - all at 25Hz if self.frame % 4 == 0: if not CC.longActive: # Stock ECU sends max regen when not enabled From c5035a58fe17f640b17acf7493f1722798f13c08 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 30 Jun 2022 13:46:17 -0700 Subject: [PATCH 12/14] update refs --- selfdrive/test/process_replay/ref_commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index c3e8eca42d08c2..4a7d669ad74373 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -a9adebff7ce27d6233d443217a30337b761898ee \ No newline at end of file +fe2d00ba85e09f4f3ed04a58278a98c242950c45 \ No newline at end of file From b6f82e032ae71c154cf285ae266edd24d70c0ac5 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 30 Jun 2022 15:35:27 -0700 Subject: [PATCH 13/14] update refs --- selfdrive/test/process_replay/ref_commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/test/process_replay/ref_commit b/selfdrive/test/process_replay/ref_commit index 571861cdb8ab80..a1cb2bf36269f2 100644 --- a/selfdrive/test/process_replay/ref_commit +++ b/selfdrive/test/process_replay/ref_commit @@ -1 +1 @@ -a98dfc72bb4c5624c2223ca65d52b151f419460c +d7c610172f3ff10b68403abc19b260c91c848ebb \ No newline at end of file From 8eadd78f24e48b2f53d03a7948600f6c9bdf0e5a Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 30 Jun 2022 15:39:50 -0700 Subject: [PATCH 14/14] move into same block move into same block --- selfdrive/car/gm/carcontroller.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py index 6849c6763ab112..8ad5049e3210a5 100644 --- a/selfdrive/car/gm/carcontroller.py +++ b/selfdrive/car/gm/carcontroller.py @@ -88,10 +88,9 @@ def update(self, CC, CS): # Radar needs to know current speed and yaw rate (50hz), # and that ADAS is alive (10hz) - time_and_headlights_step = 10 - tt = self.frame * DT_CTRL - if not self.CP.radarOffCan: + tt = self.frame * DT_CTRL + time_and_headlights_step = 10 if self.frame % time_and_headlights_step == 0: idx = (self.frame // time_and_headlights_step) % 4 can_sends.append(gmcan.create_adas_time_status(CanBus.OBSTACLE, int((tt - self.start_time) * 60), idx))