openpilot
openpilot copied to clipboard
[$500 bounty] Ford: reliable fuzzy fingerprinting
Context: You will improve the reliability of Ford fingerprinting by giving openpilot an understanding of the FW versions.
We have already implemented FW version parsing with specific brand understanding for Hyundai and Toyota. For Hyundai, we have the human-readable platform codes that the auto manufacturer uses, then we filter the fuzzy match by part date for a rough model year identifier. For Toyota, we parse out a region-specific platform code + a version code that describes new control APIs.
Check out recent Ford fingerprinting PRs, which ECUs are getting added more often?
Goal: Implement the same type of fuzzy fingerprinting for Ford, which seems to have patterns we can use to identify platforms. The solution should detect and fail to fingerprint a platform with breaking API changes, like a new vehicle generation with new control messages. Conversely, it should also fingerprint every unseen Ford Bronco with a very minimal amount of FW from one seen.
Certain Ford forums may have user-provided FW dumps to check your theories with, since openpilot has only largely seen one generation of each platform.
Required:
- [ ] works for all supported cars, plus the dashcam Q4 platform cars
- [ ] Parse the platform code with a way to split API/MY differences
- [ ] Choose certain or all ECUs to do fuzzy fingerprinting on
- [ ] Tests, if necessary
- [ ] Ship to release with same quality as the other custom fuzzy fingerprinting functions
General notes for anyone that might be interested in this bounty.
Observations: Mazda and Ford share some ECUs
CAN & CANFD platforms have different UDS query responses. Also C3 + Red Panda on a CANFD platform behaves differently than the C3X for fingerprinting. Unsure why C3 + RP fails to capture all the fingerprints most of the time. (I'm the only C3 + RP on the Ford CANFD platform, so maybe this is a non issue)
Ford VIN breakouts https://vpic.nhtsa.dot.gov/mid/home/displayfile/80532849-df78-41d0-9c6b-ca62ca456c93
I started awhile back developing something based on VINs that's incomplete and it's also not to the spec Shane described above but thought I'd share if it helped someone.
Define the Ford F150 and MACHE VIN lists for checks
model_year_codes = {'M': 2021, 'N': 2022, 'P': 2023, 'R': 2024, 'S': 2025} f150_codes = ['F1C', 'F1E', 'W1C', 'W1E', 'X1C', 'X1E', 'W1R', 'W1P', 'W1S', 'W1T'] lightning_codes = ['L', 'V'] mach_e_codes = ['K1R', 'K1S', 'K2S', 'K3R', 'K3S', 'K4S']
Function to check the model of the vehicle based on the VIN
def check_ford_model(vin): # Check if the model year code is in the allowed list if vin[9] in model_year_codes:
# Check if it's a Ford vehicle and determine the model
if vin.startswith('1FT'):
vin_positions_567 = vin[4:7]
if vin_positions_567 in f150_codes:
if vin[7] in lightning_codes:
return f"FORD F-150 LIGHTNING 1ST GEN"
else:
return f"FORD F-150 14TH GEN"
elif vin.startswith('3FM'):
vin_positions_567 = vin[4:7]
if vin_positions_567 in mach_e_codes:
return f"FORD MUSTANG MACH-E 1ST GEN"
return "Not a recognized Ford Model or Model Year"