openpilot
openpilot copied to clipboard
HKG: reliable fuzzy fingerprinting
Still a draft. There are some cars that use the same platform codes, but are fundamentally different as far as openpilot is concerned. One big example are the older Ioniqs; some have radars, some use FCA or SCC for AEB, some are legacy, some send the LFA message, some support different torques, etc.
For these cars, we just ignore the multiple matches. @adeebshihadeh I am thinking we can track the cars we won't support with this fuzzy fingerprinting and work to combine the platforms over time (with good detection for the different features)
All Hyundai:
HYUNDAI IONIQ HYBRID 2017-2019 : radar: {b'AEhe'}, camera: {b'AEH'}
HYUNDAI IONIQ PLUG-IN HYBRID 2019 : radar: {b'AEhe'}, camera: {b'AEP'}
HYUNDAI IONIQ PHEV 2020 : radar: {b'AEhe'}, camera: {b'AEP'}
HYUNDAI IONIQ ELECTRIC 2020 : radar: {b'AEev'}, camera: {b'AEE'}
HYUNDAI IONIQ ELECTRIC LIMITED 2019 : radar: {b'AEev'}, camera: {b'AEE'}
HYUNDAI IONIQ HYBRID 2020-2022 : radar: {b'AEhe'}, camera: {b'AEH'}
HYUNDAI SONATA 2020 : radar: {b'DN89', b'DN8'}, camera: {b'DN8'}
HYUNDAI SONATA 2019 : radar: {b'LF'}, camera: {b'LFF'}
HYUNDAI TUCSON 2019 : radar: {b'TL'}, camera: {b'TL'}
HYUNDAI SANTA FE 2019 : radar: {b'TM'}, camera: {b'TM'}
HYUNDAI SANTA FE 2022 : radar: {b'TM'}, camera: {b'TMA', b'TM'}
HYUNDAI SANTA FE HYBRID 2022 : radar: {b'TMhe'}, camera: {b'TMH'}
HYUNDAI SANTA FE PlUG-IN HYBRID 2022: radar: {b'TMhe'}, camera: {b'TMP'}
KIA STINGER GT2 2018 : radar: {b'CK'}, camera: {b'CK'}
KIA STINGER 2022 : radar: {b'CK'}, camera: {b'CK'}
HYUNDAI PALISADE 2020 : radar: {b'ON', b'LX2'}, camera: {b'ON', b'LX2'}
HYUNDAI VELOSTER 2019 : radar: {b'JS'}, camera: {b'JS'}
GENESIS G70 2018 : radar: {b'IK'}, camera: {b'IK'}
GENESIS G70 2020 : radar: {b'IK'}, camera: {b'IK'}
GENESIS G90 2017 : radar: {b'HI'}, camera: {b'HI'}
HYUNDAI KONA 2020 : radar: {b'OS'}, camera: {b'OS9'}
KIA CEED INTRO ED 2019 : radar: {b'CD'}, camera: {b'CD'}
KIA FORTE E 2018 & GT 2021 : radar: {b'BD'}, camera: {b'BD'}
KIA K5 2021 : radar: {b'DL3'}, camera: {b'DL3'}
HYUNDAI KONA ELECTRIC 2019 : radar: {b'OSev'}, camera: {b'OSE', b'OE2'}
HYUNDAI KONA ELECTRIC 2022 : radar: {b'YB'}, camera: {b'OSP'}
KIA NIRO EV 2020 : radar: {b'DEev'}, camera: {b'DEE'}
KIA NIRO HYBRID 2019 : radar: {b'DEhe'}, camera: {b'DEP'}
KIA NIRO HYBRID 2021 : radar: {b'DEhe'}, camera: {b'DEH'}
KIA SELTOS 2021 : radar: {b'SP2'}, camera: {b'SP2'}
KIA OPTIMA 4TH GEN : radar: {b'JF'}, camera: {b'JFWG'}
KIA OPTIMA 4TH GEN FACELIFT : radar: {b'JF'}, camera: {b'JFA'}
HYUNDAI ELANTRA 2017 : radar: {b'PD'}, camera: {b'PD'}
HYUNDAI ELANTRA 2021 : radar: {b'CN7'}, camera: {b'CN7'}
HYUNDAI ELANTRA HYBRID 2021 : radar: {b'CNhe'}, camera: {b'CN7H'}
HYUNDAI KONA HYBRID 2020 : radar: {b'OShe'}, camera: {b'OSH'}
HYUNDAI SONATA HYBRID 2021 : radar: {b'DNhe'}, camera: {b'DN8H'}
KIA SORENTO GT LINE 2018 : radar: {b'UM'}, camera: {b'UMP'}
KIA SORENTO PLUG-IN HYBRID 4TH GEN : radar: {b'MQhe'}, camera: {b'MQ4H'}
KIA EV6 2022 : radar: {b'CV1'}, camera: {b'CV1'}
HYUNDAI IONIQ 5 2022 : radar: {b'NE1'}, camera: {b'NE1'}
HYUNDAI TUCSON 4TH GEN : radar: {b'NX4'}, camera: {b'NX4'}
HYUNDAI TUCSON HYBRID 4TH GEN : radar: {b'NX4'}, camera: {b'NX4'}
KIA SPORTAGE HYBRID 5TH GEN : radar: {b'NQ5'}, camera: {b'NQ5'}
HYUNDAI SANTA CRUZ 1ST GEN : radar: {b'NX4'}, camera: {b'NX4'}
KIA SPORTAGE 5TH GEN : radar: {b'NQ5'}, camera: {b'NQ5'}
GENESIS GV70 1ST GEN : radar: {b'JK1'}, camera: {b'JK1'}
GENESIS GV60 ELECTRIC 1ST GEN : radar: {b'JW1'}, camera: {b'JW1'}
KIA SORENTO 4TH GEN : radar: {b'MQ4'}, camera: {b'MQ4'}
You can see the two platform codes in the Palisade's versions since we include the Telluride too (ON
).
- [x] clean up
- [x] good unit tests
- [x] make the make-specific fp function generic and simple to use
using fleet data:
- [ ] check if new fuzzy FP misses any routes that old fuzzy FP got right
- [ ] check for false positives
- [ ] check no exceptions on random FW versions from car (datetime.strptime will throw an error)
last_n_days=360, brand='hyundai'
Total ttff events: 490
Total non-zero ttff: 158
Total preventable with existing platform codes: 115
67% -> 91% instant ttff by device
Adding date codes lets us expand the number of working fuzzy FP platforms by quite a bit. Here's an example of what they look like for the Hyundai Genesis vs. the Genesis G80 which have the same platform code. You can see they don't overlap any more, meaning we can differentiate them! This will also prevent false positives for new model years which we haven't seen like the new Palisades:
('HYUNDAI GENESIS 2015-2016', [b'DH_1401', b'DH_1402', b'DH_1403', b'DH_1404', b'DH_1405', b'DH_1406', b'DH_1407', b'DH_1408', b'DH_1409', b'DH_1410', b'DH_1411', b'DH_1412', b'DH_1501', b'DH_1502'])
('GENESIS G80 2017', [b'DH_1610', b'DH_1611', b'DH_1612', b'DH_1701', b'DH_1702', b'DH_1703', b'DH_1704', b'DH_1705', b'DH_1706', b'DH_1707', b'DH_1708', b'DH_1709', b'DH_1710', b'DH_1711', b'DH_1712', b'DH_1801', b'DH_1802', b'DH_1803', b'DH_1804', b'DH_1805', b'DH_1806', b'DH_1807'])
Going to revert back to requiring both radar and camera platform codes to match due to the nature of how the fuzzy fingerprinting function ignores missing ECUs. If the car has a camera but no radar, when we expect both, we would match which isn't what we want. This seems to be fine because we require 2 matches, but is much more flaky with just one match.
I'm instead going to add a comment to the function to make this clear (as it is not immediately) and then add this support in a way that's simple in the future. For now, this reduces the number of platforms we can fuzzy FP for HKG, but that is a fine tradeoff for false positives like this (think I remember a specific unrecognized car GH issue where a user didn't have a radar/SCC, only LKAS, so this is very real).
Even requiring two ECUs will bring Hyundai in line with Toyota's rate for successful instant TTFF (data is new devices for last year):
TODOS:
- [x] comment - https://github.com/commaai/openpilot/pull/28465
- [x] make 2 ecu matches requirement explicit with custom function - added test: https://github.com/commaai/openpilot/pull/26939/commits/caaa7db89c9784c2a24ca957441e4be445877795
Decided to revert the revert and just add matches with platform codes. Requiring two ECUs, matching independently with platform codes and exact versions, etc. is just masking the missing ECU problem which should be handled separately and explicitly -- this PR is already doing a lot.
replaced with https://github.com/commaai/openpilot/pull/28531