Skip to content

Commit

Permalink
carName -> brand (#1666)
Browse files Browse the repository at this point in the history
* rename fields

* interfaces

* brand

* lot

* Revert "lot"

This reverts commit 0b48536.

* Revert "brand"

This reverts commit 27ff912.

* Revert "interfaces"

This reverts commit 0fd48b7.

* just brand

* brand

* comment
  • Loading branch information
sshane authored Jan 25, 2025
1 parent 8c4ed1b commit fb81b6e
Show file tree
Hide file tree
Showing 19 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion opendbc/car/body/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CarInterface(CarInterfaceBase):
@staticmethod
def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experimental_long, docs) -> structs.CarParams:
ret.notCar = True
ret.carName = "body"
ret.brand = "body"
ret.safetyConfigs = [get_safety_config(structs.CarParams.SafetyModel.body)]

ret.minSteerSpeed = -math.inf
Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/car.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ struct CarOutput {
# ****** car param ******

struct CarParams {
carName @0 :Text;
brand @0 :Text; # Designates which group a platform falls under. Each folder in selfdrive/car is assigned one brand string
carFingerprint @1 :Text;
fuzzyFingerprint @55 :Bool;

Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/car_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def fingerprint(can_recv: CanRecvCallable, can_send: CanSendCallable, set_obd_mu

start_time = time.monotonic()
if not skip_fw_query:
if cached_params is not None and cached_params.carName != "mock" and len(cached_params.carFw) > 0 and \
if cached_params is not None and cached_params.brand != "mock" and len(cached_params.carFw) > 0 and \
cached_params.carVin is not VIN_UNKNOWN and not disable_fw_cache:
carlog.warning("Using cached CarParams")
vin_rx_addr, vin_rx_bus, vin = -1, -1, cached_params.carVin
Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/chrysler/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class CarInterface(CarInterfaceBase):
@staticmethod
def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experimental_long, docs) -> structs.CarParams:
ret.carName = "chrysler"
ret.brand = "chrysler"
ret.dashcamOnly = candidate in RAM_HD

# radar parsing needs some work, see https://github.com/commaai/openpilot/issues/26842
Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/docs_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def __post_init__(self):
self.year_list = get_year_list(self.years)

def init(self, CP: CarParams, all_footnotes=None):
self.car_name = CP.carName
self.brand = CP.brand
self.car_fingerprint = CP.carFingerprint

if self.merged and CP.dashcamOnly:
Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/ford/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get_pid_accel_limits(CP, current_speed, cruise_speed):

@staticmethod
def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experimental_long, docs) -> structs.CarParams:
ret.carName = "ford"
ret.brand = "ford"
ret.dashcamOnly = bool(ret.flags & FordFlags.CANFD)

ret.radarUnavailable = Bus.radar not in DBC[candidate]
Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/gm/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def torque_from_lateral_accel(self) -> TorqueFromLateralAccelCallbackType:

@staticmethod
def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experimental_long, docs) -> structs.CarParams:
ret.carName = "gm"
ret.brand = "gm"
ret.safetyConfigs = [get_safety_config(structs.CarParams.SafetyModel.gm)]
ret.autoResumeSng = False
ret.enableBsm = 0x142 in fingerprint[CanBus.POWERTRAIN]
Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/honda/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get_pid_accel_limits(CP, current_speed, cruise_speed):

@staticmethod
def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experimental_long, docs) -> structs.CarParams:
ret.carName = "honda"
ret.brand = "honda"

CAN = CanBus(ret, fingerprint)

Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/hyundai/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class CarInterface(CarInterfaceBase):
@staticmethod
def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experimental_long, docs) -> structs.CarParams:
ret.carName = "hyundai"
ret.brand = "hyundai"

cam_can = CanBus(None, fingerprint).CAM
hda2 = 0x50 in fingerprint[cam_can] or 0x110 in fingerprint[cam_can]
Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/mazda/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class CarInterface(CarInterfaceBase):

@staticmethod
def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experimental_long, docs) -> structs.CarParams:
ret.carName = "mazda"
ret.brand = "mazda"
ret.safetyConfigs = [get_safety_config(structs.CarParams.SafetyModel.mazda)]
ret.radarUnavailable = True

Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/mock/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CarInterface(CarInterfaceBase):

@staticmethod
def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experimental_long, docs) -> structs.CarParams:
ret.carName = "mock"
ret.brand = "mock"
ret.mass = 1700.
ret.wheelbase = 2.70
ret.centerToFront = ret.wheelbase * 0.5
Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/nissan/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CarInterface(CarInterfaceBase):

@staticmethod
def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experimental_long, docs) -> structs.CarParams:
ret.carName = "nissan"
ret.brand = "nissan"
ret.safetyConfigs = [get_safety_config(structs.CarParams.SafetyModel.nissan)]
ret.autoResumeSng = False

Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/subaru/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CarInterface(CarInterfaceBase):

@staticmethod
def _get_params(ret: structs.CarParams, candidate: CAR, fingerprint, car_fw, experimental_long, docs) -> structs.CarParams:
ret.carName = "subaru"
ret.brand = "subaru"
ret.radarUnavailable = True
# for HYBRID CARS to be upstreamed, we need:
# - replacement for ES_Distance so we can cancel the cruise control
Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/tesla/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class CarInterface(CarInterfaceBase):

@staticmethod
def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experimental_long, docs) -> structs.CarParams:
ret.carName = "tesla"
ret.brand = "tesla"

# Needs safety validation and final testing before pulling out of dashcam
ret.dashcamOnly = True
Expand Down
6 changes: 3 additions & 3 deletions opendbc/car/tests/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ def test_naming_conventions(self, subtests):
for car in self.all_cars:
with subtests.test(car=car.name):
tokens = car.model.lower().split(" ")
if car.car_name == "hyundai":
if car.brand == "hyundai":
assert "phev" not in tokens, "Use `Plug-in Hybrid`"
assert "hev" not in tokens, "Use `Hybrid`"
if "plug-in hybrid" in car.model.lower():
assert "Plug-in Hybrid" in car.model, "Use correct capitalization"
if car.make != "Kia":
assert "ev" not in tokens, "Use `Electric`"
elif car.car_name == "toyota":
elif car.brand == "toyota":
if "rav4" in tokens:
assert "RAV4" in car.model, "Use correct capitalization"

Expand All @@ -52,7 +52,7 @@ def test_torque_star(self, subtests):
# honda sanity check, it's the definition of a no torque star
if car.car_fingerprint in (HONDA.HONDA_ACCORD, HONDA.HONDA_CIVIC, HONDA.HONDA_CRV, HONDA.HONDA_ODYSSEY, HONDA.HONDA_PILOT):
assert car.row[Column.STEERING_TORQUE] == Star.EMPTY, f"{car.name} has full torque star"
elif car.car_name in ("toyota", "hyundai"):
elif car.brand in ("toyota", "hyundai"):
assert car.row[Column.STEERING_TORQUE] != Star.EMPTY, f"{car.name} has no torque star"

def test_year_format(self, subtests):
Expand Down
4 changes: 2 additions & 2 deletions opendbc/car/tests/test_fw_fingerprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ def test_blacklisted_ecus(self, subtests):
for car_model, ecus in FW_VERSIONS.items():
with subtests.test(car_model=car_model.value):
CP = interfaces[car_model][0].get_non_essential_params(car_model)
if CP.carName == 'subaru':
if CP.brand == 'subaru':
for ecu in ecus.keys():
assert ecu[1] not in blacklisted_addrs, f'{car_model}: Blacklisted ecu: (Ecu.{ecu[0]}, {hex(ecu[1])})'

elif CP.carName == "chrysler":
elif CP.brand == "chrysler":
# Some HD trucks have a combined TCM and ECM
if CP.carFingerprint.startswith("RAM_HD"):
for ecu in ecus.keys():
Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/tests/test_lateral_limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def setup_class(cls):
if CP.notCar:
pytest.skip()

CarControllerParams = importlib.import_module(f'opendbc.car.{CP.carName}.values').CarControllerParams
CarControllerParams = importlib.import_module(f'opendbc.car.{CP.brand}.values').CarControllerParams
cls.control_params = CarControllerParams(CP)
cls.torque_params = get_torque_params()[cls.car_model]

Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/toyota/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def get_pid_accel_limits(CP, current_speed, cruise_speed):

@staticmethod
def _get_params(ret: structs.CarParams, candidate, fingerprint, car_fw, experimental_long, docs) -> structs.CarParams:
ret.carName = "toyota"
ret.brand = "toyota"
ret.safetyConfigs = [get_safety_config(structs.CarParams.SafetyModel.toyota)]
ret.safetyConfigs[0].safetyParam = EPS_SCALE[candidate]

Expand Down
2 changes: 1 addition & 1 deletion opendbc/car/volkswagen/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class CarInterface(CarInterfaceBase):
@staticmethod
def _get_params(ret: structs.CarParams, candidate: CAR, fingerprint, car_fw, experimental_long, docs) -> structs.CarParams:
ret.carName = "volkswagen"
ret.brand = "volkswagen"
ret.radarUnavailable = True

if ret.flags & VolkswagenFlags.PQ:
Expand Down

0 comments on commit fb81b6e

Please sign in to comment.