From b2ef8fb5bf1789b5c7dfd791e178ce994ec60f41 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Thu, 14 Sep 2023 03:47:47 -0400 Subject: [PATCH] Gap Adjust Cruise: Remove unused variables (#264) --- common/params.cc | 2 -- selfdrive/car/interfaces.py | 8 -------- selfdrive/car/toyota/interface.py | 15 +++++---------- selfdrive/manager/manager.py | 2 -- selfdrive/ui/ui.cc | 2 -- selfdrive/ui/ui.h | 2 +- 6 files changed, 6 insertions(+), 25 deletions(-) diff --git a/common/params.cc b/common/params.cc index 70604a66a4..59f6ca1816 100644 --- a/common/params.cc +++ b/common/params.cc @@ -247,8 +247,6 @@ std::unordered_map keys = { {"EnforceTorqueLateral", PERSISTENT}, {"EnhancedScc", PERSISTENT}, {"FleetManagerPin", PERSISTENT}, - {"GapAdjustCruiseMax", PERSISTENT}, - {"GapAdjustCruiseMin", PERSISTENT}, {"GmapKey", PERSISTENT}, {"GpxDeleteAfterUpload", PERSISTENT}, {"GpxDeleteIfUploaded", PERSISTENT}, diff --git a/selfdrive/car/interfaces.py b/selfdrive/car/interfaces.py index 66ac325106..5b81fce8b1 100644 --- a/selfdrive/car/interfaces.py +++ b/selfdrive/car/interfaces.py @@ -108,8 +108,6 @@ class CarInterfaceBase(ABC): self.op_lookup = {"+": operator.add, "-": operator.sub} self.prev_gac_button = False self.gac_button_counter = 0 - self.gac_min = -1 - self.gac_max = -1 self.reverse_dm_cam = self.param_s.get_bool("ReverseDmCam") self.mads_main_toggle = self.param_s.get_bool("MadsCruiseMain") self.lkas_toggle = self.param_s.get_bool("LkasToggle") @@ -481,12 +479,6 @@ class CarInterfaceBase(ABC): CS.gac_tr = gac_default put_nonblocking("LongitudinalPersonality", self.get_sp_gac_mpc(3)) return cs_out, CS - if self.gac_min != gac_min: - self.gac_min = gac_min - put_nonblocking("GapAdjustCruiseMin", str(self.gac_min)) - if self.gac_max != gac_max: - self.gac_max = gac_max - put_nonblocking("GapAdjustCruiseMax", str(self.gac_max)) if gac_button: self.gac_button_counter += 1 elif self.prev_gac_button and not gac_button and self.gac_button_counter < 50: diff --git a/selfdrive/car/toyota/interface.py b/selfdrive/car/toyota/interface.py index 1246fbb21f..159a4bb840 100644 --- a/selfdrive/car/toyota/interface.py +++ b/selfdrive/car/toyota/interface.py @@ -15,7 +15,8 @@ SteerControlType = car.CarParams.SteerControlType GearShifter = car.CarState.GearShifter GAC_DICT = {3: 1, 2: 2, 1: 3} - +GAC_MIN = 1 +GAC_MAX = 3 class CarInterface(CarInterfaceBase): @staticmethod @@ -317,19 +318,13 @@ class CarInterface(CarInterfaceBase): cluster_gap_display = 3 put_nonblocking("LongitudinalPersonality", self.get_sp_gac_mpc(3)) else: - if self.gac_min != 1: - self.gac_min = 1 - put_nonblocking("GapAdjustCruiseMin", str(self.gac_min)) - if self.gac_max != 3: - self.gac_max = 3 - put_nonblocking("GapAdjustCruiseMax", str(self.gac_max)) gap_dist_button = bool(self.CS.gap_dist_button) if gap_dist_button: self.gac_button_counter += 1 elif self.prev_gac_button and not gap_dist_button and self.gac_button_counter < 50: self.gac_button_counter = 0 - follow_distance_converted = self.get_sp_gac_state(self.CS.follow_distance, self.gac_min, self.gac_max, "+") - gac_tr = self.get_sp_distance(follow_distance_converted, self.gac_max, gac_dict=GAC_DICT) + follow_distance_converted = self.get_sp_gac_state(self.CS.follow_distance, GAC_MIN, GAC_MAX, "+") + gac_tr = self.get_sp_distance(follow_distance_converted, GAC_MAX, gac_dict=GAC_DICT) if gac_tr != self.CS.gac_tr: put_nonblocking("LongitudinalPersonality", self.get_sp_gac_mpc(gac_tr)) self.CS.gac_tr = gac_tr @@ -337,7 +332,7 @@ class CarInterface(CarInterfaceBase): self.gac_button_counter = 0 self.prev_gac_button = gap_dist_button cluster_gap_display = self.CS.gac_tr - gap_distance = self.get_sp_distance(cluster_gap_display, self.gac_max, gac_dict=GAC_DICT) + gap_distance = self.get_sp_distance(cluster_gap_display, GAC_MAX, gac_dict=GAC_DICT) if self.CS.gac_send_counter < 10 and gap_distance != self.CS.follow_distance: self.CS.gac_send_counter += 1 self.CS.gac_send = 1 diff --git a/selfdrive/manager/manager.py b/selfdrive/manager/manager.py index 8aae97c11e..8f6f29d07a 100755 --- a/selfdrive/manager/manager.py +++ b/selfdrive/manager/manager.py @@ -73,8 +73,6 @@ def manager_init() -> None: ("DynamicLaneProfileToggle", "0"), ("EnableMads", "1"), ("EnhancedScc", "0"), - ("GapAdjustCruiseMax", "0"), - ("GapAdjustCruiseMin", "0"), ("GpxDeleteAfterUpload", "1"), ("GpxDeleteIfUploaded", "1"), ("HandsOnWheelMonitoring", "0"), diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index ab4784bd16..a9d16357b0 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -246,8 +246,6 @@ void ui_update_params(UIState *s) { s->scene.hide_vego_ui = params.getBool("HideVEgoUi"); s->scene.true_vego_ui = params.getBool("TrueVEgoUi"); s->scene.chevron_data = std::atoi(params.get("ChevronInfo").c_str()); - s->scene.gac_min = std::atoi(params.get("GapAdjustCruiseMin").c_str()); - s->scene.gac_max = std::atoi(params.get("GapAdjustCruiseMax").c_str()); s->scene.dev_ui_enabled = params.getBool("DevUI"); s->scene.dev_ui_info = std::atoi(params.get("DevUIInfo").c_str()); s->scene.button_auto_hide = params.getBool("ButtonAutoHide"); diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index a39cc6e4bd..1bcfe11207 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -197,7 +197,7 @@ typedef struct UIScene { int chevron_data; bool gac; - int longitudinal_personality, gac_min, gac_max; + int longitudinal_personality; bool map_visible; bool dev_ui_enabled;