From 3232d4d01ed4830b6e9ba1ebe195fbbd51d8084f Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Sat, 20 Jul 2024 15:14:50 -0400 Subject: [PATCH] Revert "more, and comfort band" This reverts commit 91dadaafd1071575ed5cf084a917d0bcafbcd666. --- selfdrive/car/hyundai/carcontroller.py | 13 ++++--------- selfdrive/car/hyundai/hyundaican.py | 6 +++--- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py index 290d32852c..a2d240ffcd 100644 --- a/selfdrive/car/hyundai/carcontroller.py +++ b/selfdrive/car/hyundai/carcontroller.py @@ -109,9 +109,6 @@ class CarController(CarControllerBase): self.jerk_l = 0.0 self.jerk_u = 0.0 self.jerkStartLimit = 2.0 - self.cb_upper = 0.0 - self.cb_lower = 0.0 - self.jerk_count = 0.0 def calculate_lead_distance(self, hud_control: car.CarControl.HUDControl) -> float: lead_one = self.sm["radarState"].leadOne @@ -297,8 +294,6 @@ class CarController(CarControllerBase): self.last_button_frame = self.frame elif self.frame % 2 == 0: can_sends.extend([hyundaican.create_clu11(self.packer, (self.frame // 2) + 1, CS.clu11, self.cruise_button, self.CP)] * 25) - else: - self.make_jerk(CS, accel, actuators) # Parse lead distance from radarState and display the corresponding distance in the car's cluster if self.CP.openpilotLongitudinalControl and self.sm.updated['radarState'] and self.frame % 5 == 0: @@ -313,7 +308,7 @@ class CarController(CarControllerBase): use_fca = self.CP.flags & HyundaiFlags.USE_FCA.value can_sends.extend(hyundaican.create_acc_commands(self.packer, CC.enabled and CS.out.cruiseState.enabled, accel, self.jerk_l, self.jerk_u, int(self.frame / 2), hud_control, set_speed_in_units, stopping, - CC.cruiseControl.override, use_fca, CS, escc, self.CP, self.lead_distance, self.cb_lower, self.cb_upper)) + CC.cruiseControl.override, use_fca, CS, escc, self.CP, self.lead_distance)) # 20 Hz LFA MFA message if self.frame % 5 == 0 and self.CP.flags & HyundaiFlags.SEND_LFA.value: @@ -502,7 +497,7 @@ class CarController(CarControllerBase): self.jerk = self.jerk * 0.9 + accel_diff * 0.1 return self.jerk - def make_jerk(self, CS, accel, actuators): + def make_jerk(self, CS, accel, actuators, hud_control): jerk = self.cal_jerk(accel, actuators) a_error = accel - CS.out.aEgo jerk = jerk + (a_error * 2.0) @@ -516,7 +511,7 @@ class CarController(CarControllerBase): self.jerk_u = jerkLimit self.jerk_l = jerkLimit self.jerk_count = 0 - elif actuators.longControlState == LongCtrlState.stopping: + elif actuators.longControlState == LongCtrlState.stopping or hud_control.softHold > 0: self.jerk_u += 0.1 if self.jerk_u < 1.5 else -0.1 self.jerk_l += 0.1 if self.jerk_l < 1.0 else -0.1 self.jerk_count = 0 @@ -535,7 +530,7 @@ class CarController(CarControllerBase): self.jerk_u = jerkLimit self.jerk_l = jerkLimit self.jerk_count = 0 - elif actuators.longControlState == LongCtrlState.stopping: + elif actuators.longControlState == LongCtrlState.stopping or hud_control.softHold > 0: self.jerk_u += 0.1 if self.jerk_u < 0.5 else -0.1 self.jerk_l += 0.1 if self.jerk_l < 1.0 else -0.1 self.jerk_count = 0 diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py index f3776c46ef..b28a94e055 100644 --- a/selfdrive/car/hyundai/hyundaican.py +++ b/selfdrive/car/hyundai/hyundaican.py @@ -131,7 +131,7 @@ def create_lfahda_mfc(packer, enabled, lat_active, lateral_paused, blinking_icon return packer.make_can_msg("LFAHDA_MFC", 0, values) def create_acc_commands(packer, enabled, accel, lower_jerk, upper_jerk, idx, hud_control, set_speed, stopping, long_override, use_fca, - CS, escc, CP, lead_distance, cb_lower, cb_upper): + CS, escc, CP, lead_distance): commands = [] scc11_values = { @@ -172,8 +172,8 @@ def create_acc_commands(packer, enabled, accel, lower_jerk, upper_jerk, idx, hud commands.append(packer.make_can_msg("SCC12", 0, scc12_values)) scc14_values = { - "ComfortBandUpper": cb_upper, # stock usually is 0 but sometimes uses higher values - "ComfortBandLower": cb_lower, # stock usually is 0 but sometimes uses higher values + "ComfortBandUpper": 0.0, # stock usually is 0 but sometimes uses higher values + "ComfortBandLower": 0.0, # stock usually is 0 but sometimes uses higher values "JerkUpperLimit": upper_jerk, # stock usually is 1.0 but sometimes uses higher values "JerkLowerLimit": lower_jerk, # stock usually is 0.5 but sometimes uses higher values "ACCMode": 2 if enabled and long_override else 1 if enabled else 4, # stock will always be 4 instead of 0 after first disengage