Ford: use platform codes to fuzzy fingerprint (#31124)
* Ford: use platform codes to fuzzy fingerprint
TODO: write scripts/tests (print platform codes and version ranges etc.)
May close #31052
* get_platform_codes: fix return type
* add print_platform_codes.py script
* print_platform_codes: sort versions
* match_fw_to_car_fuzzy: use set comprehension, and fix typo
* Ford: add missing Mach-E fw
From the route 83a4e056c7072678/2023-11-13--16-51-33 (which is already
in selfdrive/car/tests/routes.py, added in #30691).
* add ford_fuzzy_fingerprint.ipynb notebook
* get_platform_codes: use regex to parse firmware
* test_ford: test_platform_codes_fuzzy_fw
* test_ford: use get_platform_codes in test_fw_versions
* match_fw_to_car_fuzzy: improve comments
* test_ford: add test_platform_codes_spot_check
* test_ford: add test_match_fw_fuzzy
* remove comment from notebook
* TestFordFW: remove engine ECU FW
* update print_platform_codes.py
* remove part number (unecessary)
* platform codes can just use platform hint and model year - software revision not useful
* fuzzy FP on the platform hint and model year hint range
* fix platform codes test
* update notebook
* add notebook
* explain model year hint better
* test part numbers again
* cleanup notebooks
* remove notebook
* cleanup match_fw_to_car_fuzzy and add comments
* update comment
* .
* Revert "remove notebook"
This reverts commit 5d4ca202f2a23601d5c829204119f36a58f2b451.
* add notebook back
* remove PSCM from PLATFORM_CODE_ECUS
ABS and IPMA are the best for uniquely matching, and the radar is always required
* Revert "remove PSCM from PLATFORM_CODE_ECUS"
This reverts commit b7baeac19c18b5aa0c31da52f12054f4bae6e1ff.
* fix from merge
* more fixes
revert
* FW_RE -> FW_PATTERN
* this can actually be set
* conventions
* just add
* convention
* refactor matcher, this brings it more in line with Hyundai. IMPORTANT NOTE:
NOTE THAT WE remove the separation for the different platform code model year hint ranges, I don't see that being a problem
* better/smaller test
* add test to catch overlapping platform codes
* remove nb
* not now
---------
Co-authored-by: Shane Smiskol <shane@smiskol.com>
old-commit-hash: 85c9fea5d8
vw-mqb-aeb
parent
7b634ee1b3
commit
d1c726c6d7
3 changed files with 193 additions and 23 deletions
@ -0,0 +1,30 @@ |
||||
#!/usr/bin/env python3 |
||||
from collections import defaultdict |
||||
|
||||
from cereal import car |
||||
from openpilot.selfdrive.car.ford.values import get_platform_codes |
||||
from openpilot.selfdrive.car.ford.fingerprints import FW_VERSIONS |
||||
|
||||
Ecu = car.CarParams.Ecu |
||||
ECU_NAME = {v: k for k, v in Ecu.schema.enumerants.items()} |
||||
|
||||
|
||||
if __name__ == "__main__": |
||||
cars_for_code: defaultdict = defaultdict(lambda: defaultdict(set)) |
||||
|
||||
for car_model, ecus in FW_VERSIONS.items(): |
||||
print(car_model) |
||||
for ecu in sorted(ecus, key=lambda x: int(x[0])): |
||||
platform_codes = get_platform_codes(ecus[ecu]) |
||||
for code in platform_codes: |
||||
cars_for_code[ecu][code].add(car_model) |
||||
|
||||
print(f' (Ecu.{ECU_NAME[ecu[0]]}, {hex(ecu[1])}, {ecu[2]}):') |
||||
print(f' Codes: {sorted(platform_codes)}') |
||||
print() |
||||
|
||||
print('\nCar models vs. platform codes:') |
||||
for ecu, codes in cars_for_code.items(): |
||||
print(f' (Ecu.{ECU_NAME[ecu[0]]}, {hex(ecu[1])}, {ecu[2]}):') |
||||
for code, cars in codes.items(): |
||||
print(f' {code!r}: {sorted(map(str, cars))}') |
Loading…
Reference in new issue