From 1d86afdf8349db197de76e25086a5d6b75be404f Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Sat, 25 Jan 2025 01:39:06 -0600 Subject: [PATCH] carName -> brand (#34474) * bump * brand * body is lower --- opendbc_repo | 2 +- selfdrive/car/car_specific.py | 22 +++++++++++----------- selfdrive/car/card.py | 2 +- selfdrive/car/tests/test_models.py | 8 ++++---- selfdrive/controls/plannerd.py | 2 +- selfdrive/locationd/torqued.py | 2 +- selfdrive/modeld/modeld.py | 2 +- selfdrive/selfdrived/events.py | 2 +- selfdrive/selfdrived/selfdrived.py | 2 +- selfdrive/test/process_replay/migration.py | 2 +- selfdrive/ui/tests/body.py | 2 +- selfdrive/ui/tests/test_ui/run.py | 2 +- tools/plotjuggler/juggle.py | 2 +- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/opendbc_repo b/opendbc_repo index 8c4ed1b3f9..fb81b6e7e7 160000 --- a/opendbc_repo +++ b/opendbc_repo @@ -1 +1 @@ -Subproject commit 8c4ed1b3f9520f29fc9e0522edac79473b064663 +Subproject commit fb81b6e7e73228b71502d09959d9bd1f49759c58 diff --git a/selfdrive/car/car_specific.py b/selfdrive/car/car_specific.py index 144f9f073b..eaa287b2f3 100644 --- a/selfdrive/car/car_specific.py +++ b/selfdrive/car/car_specific.py @@ -42,19 +42,19 @@ class CarSpecificEvents: self.cruise_buttons: deque = deque([], maxlen=HYUNDAI_PREV_BUTTON_SAMPLES) def update(self, CS: car.CarState, CS_prev: car.CarState, CC: car.CarControl): - if self.CP.carName in ('body', 'mock'): + if self.CP.brand in ('body', 'mock'): events = Events() - elif self.CP.carName in ('subaru', 'mazda'): + elif self.CP.brand in ('subaru', 'mazda'): events = self.create_common_events(CS, CS_prev) - elif self.CP.carName == 'ford': + elif self.CP.brand == 'ford': events = self.create_common_events(CS, CS_prev, extra_gears=[GearShifter.manumatic]) - elif self.CP.carName == 'nissan': + elif self.CP.brand == 'nissan': events = self.create_common_events(CS, CS_prev, extra_gears=[GearShifter.brake]) - elif self.CP.carName == 'chrysler': + elif self.CP.brand == 'chrysler': events = self.create_common_events(CS, CS_prev, extra_gears=[GearShifter.low]) # Low speed steer alert hysteresis logic @@ -65,7 +65,7 @@ class CarSpecificEvents: if self.low_speed_alert: events.add(EventName.belowSteerSpeed) - elif self.CP.carName == 'honda': + elif self.CP.brand == 'honda': events = self.create_common_events(CS, CS_prev, pcm_enable=False) if self.CP.pcmCruise and CS.vEgo < self.CP.minEnableSpeed: @@ -86,7 +86,7 @@ class CarSpecificEvents: if self.CP.minEnableSpeed > 0 and CS.vEgo < 0.001: events.add(EventName.manualRestart) - elif self.CP.carName == 'toyota': + elif self.CP.brand == 'toyota': events = self.create_common_events(CS, CS_prev) if self.CP.openpilotLongitudinalControl: @@ -101,7 +101,7 @@ class CarSpecificEvents: # while in standstill, send a user alert events.add(EventName.manualRestart) - elif self.CP.carName == 'gm': + elif self.CP.brand == 'gm': # The ECM allows enabling on falling edge of set, but only rising edge of resume events = self.create_common_events(CS, CS_prev, extra_gears=[GearShifter.sport, GearShifter.low, GearShifter.eco, GearShifter.manumatic], @@ -120,7 +120,7 @@ class CarSpecificEvents: if CS.vEgo < self.CP.minSteerSpeed: events.add(EventName.belowSteerSpeed) - elif self.CP.carName == 'volkswagen': + elif self.CP.brand == 'volkswagen': events = self.create_common_events(CS, CS_prev, extra_gears=[GearShifter.eco, GearShifter.sport, GearShifter.manumatic], pcm_enable=self.CP.pcmCruise, enable_buttons=(ButtonType.setCruise, ButtonType.resumeCruise)) @@ -143,7 +143,7 @@ class CarSpecificEvents: # if CC.eps_timer_soft_disable_alert: # type: ignore[attr-defined] # events.add(EventName.steerTimeLimit) - elif self.CP.carName == 'hyundai': + elif self.CP.brand == 'hyundai': # On some newer model years, the CANCEL button acts as a pause/resume button based on the PCM state # To avoid re-engaging when openpilot cancels, check user engagement intention via buttons # Main button also can trigger an engagement on these cars @@ -160,7 +160,7 @@ class CarSpecificEvents: events.add(EventName.belowSteerSpeed) else: - raise ValueError(f"Unsupported car: {self.CP.carName}") + raise ValueError(f"Unsupported car: {self.CP.brand}") return events diff --git a/selfdrive/car/card.py b/selfdrive/car/card.py index db89da262f..78cd19e78b 100755 --- a/selfdrive/car/card.py +++ b/selfdrive/car/card.py @@ -173,7 +173,7 @@ class Car: # Update carState from CAN CS = self.CI.update(can_list) - if self.CP.carName == 'mock': + if self.CP.brand == 'mock': CS = self.mock_carstate.update(CS) # Update radar tracks from CAN diff --git a/selfdrive/car/tests/test_models.py b/selfdrive/car/tests/test_models.py index ee60c47021..45358542de 100644 --- a/selfdrive/car/tests/test_models.py +++ b/selfdrive/car/tests/test_models.py @@ -362,11 +362,11 @@ class TestCarModelBase(unittest.TestCase): if self.safety.get_vehicle_moving() != prev_panda_vehicle_moving: self.assertEqual(not CS.standstill, self.safety.get_vehicle_moving()) - if not (self.CP.carName == "honda" and not (self.CP.flags & HondaFlags.BOSCH)): + if not (self.CP.brand == "honda" and not (self.CP.flags & HondaFlags.BOSCH)): if self.safety.get_cruise_engaged_prev() != prev_panda_cruise_engaged: self.assertEqual(CS.cruiseState.enabled, self.safety.get_cruise_engaged_prev()) - if self.CP.carName == "honda": + if self.CP.brand == "honda": if self.safety.get_acc_main_on() != prev_panda_acc_main_on: self.assertEqual(CS.cruiseState.available, self.safety.get_acc_main_on()) @@ -421,7 +421,7 @@ class TestCarModelBase(unittest.TestCase): # On most pcmCruise cars, openpilot's state is always tied to the PCM's cruise state. # On Honda Nidec, we always engage on the rising edge of the PCM cruise state, but # openpilot brakes to zero even if the min ACC speed is non-zero (i.e. the PCM disengages). - if self.CP.carName == "honda" and not (self.CP.flags & HondaFlags.BOSCH): + if self.CP.brand == "honda" and not (self.CP.flags & HondaFlags.BOSCH): # only the rising edges are expected to match if CS.cruiseState.enabled and not CS_prev.cruiseState.enabled: checks['controlsAllowed'] += not self.safety.get_controls_allowed() @@ -443,7 +443,7 @@ class TestCarModelBase(unittest.TestCase): if button_enable and not mismatch: self.safety.set_controls_allowed(False) - if self.CP.carName == "honda": + if self.CP.brand == "honda": checks['mainOn'] += CS.cruiseState.available != self.safety.get_acc_main_on() CS_prev = CS diff --git a/selfdrive/controls/plannerd.py b/selfdrive/controls/plannerd.py index bcfc4d0c14..a74b40e15f 100755 --- a/selfdrive/controls/plannerd.py +++ b/selfdrive/controls/plannerd.py @@ -14,7 +14,7 @@ def main(): cloudlog.info("plannerd is waiting for CarParams") params = Params() CP = messaging.log_from_bytes(params.get("CarParams", block=True), car.CarParams) - cloudlog.info("plannerd got CarParams: %s", CP.carName) + cloudlog.info("plannerd got CarParams: %s", CP.brand) ldw = LaneDepartureWarning() longitudinal_planner = LongitudinalPlanner(CP) diff --git a/selfdrive/locationd/torqued.py b/selfdrive/locationd/torqued.py index 2b7cc62527..986c5349f5 100755 --- a/selfdrive/locationd/torqued.py +++ b/selfdrive/locationd/torqued.py @@ -71,7 +71,7 @@ class TorqueEstimator(ParameterEstimator): self.offline_friction = 0.0 self.offline_latAccelFactor = 0.0 self.resets = 0.0 - self.use_params = CP.carName in ALLOWED_CARS and CP.lateralTuning.which() == 'torque' + self.use_params = CP.brand in ALLOWED_CARS and CP.lateralTuning.which() == 'torque' if CP.lateralTuning.which() == 'torque': self.offline_friction = CP.lateralTuning.torque.friction diff --git a/selfdrive/modeld/modeld.py b/selfdrive/modeld/modeld.py index 5783f6aa8e..82a2ef1597 100755 --- a/selfdrive/modeld/modeld.py +++ b/selfdrive/modeld/modeld.py @@ -197,7 +197,7 @@ def main(demo=False): CP = get_demo_car_params() else: CP = messaging.log_from_bytes(params.get("CarParams", block=True), car.CarParams) - cloudlog.info("modeld got CarParams: %s", CP.carName) + cloudlog.info("modeld got CarParams: %s", CP.brand) # TODO this needs more thought, use .2s extra for now to estimate other delays steer_delay = CP.steerActuatorDelay + .2 diff --git a/selfdrive/selfdrived/events.py b/selfdrive/selfdrived/events.py index 41f08007d6..9da844bce4 100755 --- a/selfdrive/selfdrived/events.py +++ b/selfdrive/selfdrived/events.py @@ -314,7 +314,7 @@ def modeld_lagging_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubM def wrong_car_mode_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int, personality) -> Alert: text = "Enable Adaptive Cruise to Engage" - if CP.carName == "honda": + if CP.brand == "honda": text = "Enable Main Switch to Engage" return NoEntryAlert(text) diff --git a/selfdrive/selfdrived/selfdrived.py b/selfdrive/selfdrived/selfdrived.py index 8ed7eee675..6ae51e030f 100755 --- a/selfdrive/selfdrived/selfdrived.py +++ b/selfdrive/selfdrived/selfdrived.py @@ -87,7 +87,7 @@ class SelfdriveD: self.is_metric = self.params.get_bool("IsMetric") self.is_ldw_enabled = self.params.get_bool("IsLdwEnabled") - car_recognized = self.CP.carName != 'mock' + car_recognized = self.CP.brand != 'mock' # cleanup old params if not self.CP.experimentalLongitudinalAvailable: diff --git a/selfdrive/test/process_replay/migration.py b/selfdrive/test/process_replay/migration.py index 10a5cdf6ec..14934f8521 100644 --- a/selfdrive/test/process_replay/migration.py +++ b/selfdrive/test/process_replay/migration.py @@ -381,7 +381,7 @@ def migrate_carParams(msgs): CP = msg.as_builder() CP.carParams.carFingerprint = MIGRATION.get(CP.carParams.carFingerprint, CP.carParams.carFingerprint) for car_fw in CP.carParams.carFw: - car_fw.brand = CP.carParams.carName + car_fw.brand = CP.carParams.brand ops.append((index, CP.as_reader())) return ops, [], [] diff --git a/selfdrive/ui/tests/body.py b/selfdrive/ui/tests/body.py index 7e24c2beb7..07a2ef5128 100755 --- a/selfdrive/ui/tests/body.py +++ b/selfdrive/ui/tests/body.py @@ -8,7 +8,7 @@ if __name__ == "__main__": batt = 1. while True: msg = messaging.new_message('carParams') - msg.carParams.carName = "BODY" + msg.carParams.brand = "body" msg.carParams.notCar = True pm.send('carParams', msg) diff --git a/selfdrive/ui/tests/test_ui/run.py b/selfdrive/ui/tests/test_ui/run.py index 55d12f6acf..15b3466aa5 100644 --- a/selfdrive/ui/tests/test_ui/run.py +++ b/selfdrive/ui/tests/test_ui/run.py @@ -118,7 +118,7 @@ def setup_onroad_wide_sidebar(click, pm: PubMaster): setup_onroad_wide(click, pm) def setup_body(click, pm: PubMaster): - DATA['carParams'].carParams.carName = "BODY" + DATA['carParams'].carParams.brand = "body" DATA['carParams'].carParams.notCar = True DATA['carState'].carState.charging = True DATA['carState'].carState.fuelGauge = 50.0 diff --git a/tools/plotjuggler/juggle.py b/tools/plotjuggler/juggle.py index 6f52e70006..7ca5c3641e 100755 --- a/tools/plotjuggler/juggle.py +++ b/tools/plotjuggler/juggle.py @@ -85,7 +85,7 @@ def juggle_route(route_or_segment_name, can, layout, dbc=None): if dbc is None: for cp in [m for m in all_data if m.which() == 'carParams']: try: - DBC = __import__(f"opendbc.car.{cp.carParams.carName}.values", fromlist=['DBC']).DBC + DBC = __import__(f"opendbc.car.{cp.carParams.brand}.values", fromlist=['DBC']).DBC fingerprint = cp.carParams.carFingerprint dbc = DBC[MIGRATION.get(fingerprint, fingerprint)]['pt'] except Exception: