allow fuzzy fingerprinting

pull/31241/head
Shane Smiskol 1 year ago
parent 26717c0807
commit 91f143f311
  1. 4
      selfdrive/car/hyundai/tests/test_hyundai.py
  2. 5
      selfdrive/car/hyundai/values.py

@ -5,7 +5,7 @@ import unittest
from cereal import car from cereal import car
from openpilot.selfdrive.car.fw_versions import build_fw_dict from openpilot.selfdrive.car.fw_versions import build_fw_dict
from openpilot.selfdrive.car.hyundai.values import CAMERA_SCC_CAR, CANFD_CAR, CAN_GEARS, CAR, CHECKSUM, DATE_FW_ECUS, \ from openpilot.selfdrive.car.hyundai.values import CAMERA_SCC_CAR, CANFD_CAR, CAN_GEARS, CAR, CHECKSUM, DATE_FW_ECUS, \
HYBRID_CAR, EV_CAR, FW_QUERY_CONFIG, LEGACY_SAFETY_MODE_CAR, \ HYBRID_CAR, EV_CAR, FW_QUERY_CONFIG, LEGACY_SAFETY_MODE_CAR, CANFD_FUZZY_WHITELIST, \
UNSUPPORTED_LONGITUDINAL_CAR, PLATFORM_CODE_ECUS, HYUNDAI_VERSION_REQUEST_LONG, \ UNSUPPORTED_LONGITUDINAL_CAR, PLATFORM_CODE_ECUS, HYUNDAI_VERSION_REQUEST_LONG, \
get_platform_codes get_platform_codes
from openpilot.selfdrive.car.hyundai.fingerprints import FW_VERSIONS from openpilot.selfdrive.car.hyundai.fingerprints import FW_VERSIONS
@ -181,7 +181,7 @@ class TestHyundaiFingerprint(unittest.TestCase):
CAR.GENESIS_G70, # shared platform code, part number, and date CAR.GENESIS_G70, # shared platform code, part number, and date
CAR.GENESIS_G70_2020, CAR.GENESIS_G70_2020,
} }
excluded_platforms |= CANFD_CAR - EV_CAR # shared platform codes excluded_platforms |= CANFD_CAR - EV_CAR - CANFD_FUZZY_WHITELIST # shared platform codes
excluded_platforms |= NO_DATES_PLATFORMS # date codes are required to match excluded_platforms |= NO_DATES_PLATFORMS # date codes are required to match
platforms_with_shared_codes = set() platforms_with_shared_codes = set()

@ -337,7 +337,7 @@ def match_fw_to_car_fuzzy(live_fw_versions, offline_fw_versions) -> Set[str]:
# to distinguish between hybrid and ICE. All EVs so far are either exclusively # to distinguish between hybrid and ICE. All EVs so far are either exclusively
# electric or specify electric in the platform code. # electric or specify electric in the platform code.
# TODO: whitelist platforms that we've seen hybrid and ICE versions of that have these specifiers # TODO: whitelist platforms that we've seen hybrid and ICE versions of that have these specifiers
fuzzy_platform_blacklist = {str(c) for c in set(CANFD_CAR - EV_CAR)} fuzzy_platform_blacklist = {str(c) for c in (CANFD_CAR - EV_CAR - CANFD_FUZZY_WHITELIST)}
candidates: Set[str] = set() candidates: Set[str] = set()
for candidate, fws in offline_fw_versions.items(): for candidate, fws in offline_fw_versions.items():
@ -402,6 +402,9 @@ PLATFORM_CODE_FW_PATTERN = re.compile(b'((?<=' + HYUNDAI_VERSION_REQUEST_LONG[1:
DATE_FW_PATTERN = re.compile(b'(?<=[ -])([0-9]{6}$)') DATE_FW_PATTERN = re.compile(b'(?<=[ -])([0-9]{6}$)')
PART_NUMBER_FW_PATTERN = re.compile(b'(?<=[0-9][.,][0-9]{2} )([0-9]{5}[-/]?[A-Z][A-Z0-9]{3}[0-9])') PART_NUMBER_FW_PATTERN = re.compile(b'(?<=[0-9][.,][0-9]{2} )([0-9]{5}[-/]?[A-Z][A-Z0-9]{3}[0-9])')
# We've seen both ICE and hybrid for these platforms, and they have hybrid descriptors (MQ4H vs MQ4)
CANFD_FUZZY_WHITELIST = {CAR.KIA_SORENTO_4TH_GEN, CAR.KIA_SORENTO_HEV_4TH_GEN}
# List of ECUs expected to have platform codes, camera and radar should exist on all cars # List of ECUs expected to have platform codes, camera and radar should exist on all cars
# TODO: use abs, it has the platform code and part number on many platforms # TODO: use abs, it has the platform code and part number on many platforms
PLATFORM_CODE_ECUS = [Ecu.fwdRadar, Ecu.fwdCamera, Ecu.eps] PLATFORM_CODE_ECUS = [Ecu.fwdRadar, Ecu.fwdCamera, Ecu.eps]

Loading…
Cancel
Save