Skip to content

Toyota: use radar in place of abs for platform code ECU - #31043

Merged
sshane merged 26 commits into
masterfrom
toyota-no-abs
Jan 25, 2024
Merged

sshane merged 26 commits into
masterfrom
toyota-no-abs

Conversation

@sshane

@sshane sshane commented Jan 17, 2024 •

Copy link
Copy Markdown
Collaborator

Looking at the non-zero TTFF list, this would have solved a fair amount of the Toyota cases in the last few months. Will need to do some verification to ensure that nothing regresses.

The reason we chose abs over fwdRadar was because it nicely split ICE and hybrid cars, before we combined them. However, this means that it is too sensitive to minor differences within the same model year and generation (it shows trim and engine differences sometimes).

If we switch to fwdRadar, we need to combine the rest of the hybrid platforms, but this means that we need to detect some sng related features relying on the hybrid/ICE split. More on that here


Non-zero fingerprinting cars from the openpilot-metrics cars page from 2023-10-10 to 2024-01-17:

Dongle Platform Gain FP?
c3f88a5035764f65 TOYOTA PRIUS TSS2 2021 Gain
7525f320bb0420f0 TOYOTA RAV4 2023 Gain
9d09cc205c254c4b TOYOTA RAV4 2022 (or 2023) No (unseen RAV4 in EU region)
404d0b3326346d5a TOYOTA RAV4 2023 Gain
061932dac503c0f7 TOYOTA RAV4 2023 No (2024 with new major version)
007f1416e7b53998 TOYOTA RAV4 2023 Gain
69e4f202ff8a7c3e TOYOTA COROLLA TSS2 2019 Gain
ad087a7655bd6039 TOYOTA CAMRY 2021 Both fuzzy FP (Gain when removing all its FW)
d90d60569fa8bfe0 TOYOTA CAMRY 2021 Gain
9993ef6cfe3613bf TOYOTA RAV4 2023 Gain
8d1efe1f449e4386 TOYOTA HIGHLANDER 2020 Gain (with hybrid combination)
bff212aa671150d5 TOYOTA COROLLA TSS2 2019 No
9bf4af979ddee563 LEXUS IS 2023 No (base vs F-Sport trim, EPS also shows a difference)
01762a5235a24145 LEXUS RC 2020 No - significantly new MY (2018, added here without FW or source, expected: #25134)

@sshane

sshane commented Jan 25, 2024 •

Copy link
Copy Markdown
Collaborator Author

I checked a random segment from each dongle for the last year + all mock routes, I also ignored any mock routes that didn't have a majority of Toyota FW responses -- a good heuristic for whether the car is a Toyota/Lexus or not:

Total checked dongles: 3871
Total checked platforms: 32

Here's all the dongles that didn't gain a fingerprint with this PR, they're all mostly unsupportable cars, so this is good!

View
Dongles stayed same (no gain) 17

no gain! c5a2f0d514baa01c|2023-04-08--14-34-34--12 mock vin car name: TOYOTA Sienna Hybrid 2021 5TDKRKEC2........
no gain! c35915933c1bc687|2023-03-04--12-23-23--2 mock vin car name: TOYOTA Sienna Hybrid 2022 5TDKRKEC7........
no gain! bfd59919af7a9183|2023-03-02--20-00-56--32 mock vin car name: TOYOTA Venza Hybrid 2023 JTEAAAAH8........
no gain! 45d332ef56466d87|2023-03-04--20-56-32--0 mock vin car name: TOYOTA RAV4 Prime Plug-in Hybrid 2021 JTMAB3FV0........
no gain! 524cd60e4f7afcdd|2023-04-22--12-50-08--11 mock vin car name: TOYOTA Sienna Hybrid 2023 5TDCSKFC2........
no gain! c7e296b914b21642|2023-02-26--19-40-20--0 mock vin car name: TOYOTA RAV4 Prime Plug-in Hybrid 2021 JTMAB3FV2........
no gain! c27e776f2a552b38|2023-12-27--14-48-58--0 mock vin car name: TOYOTA Prius Prime Plug-in Hybrid 2022 JTDKAMFP1........
no gain! 9d09cc205c254c4b|2024-01-20--15-39-13--0 mock vin car name: TOYOTA   JTDAGNAC5........
no gain! 1547f5d12a3942eb|2024-01-08--15-55-40--0 mock vin car name:    000000000........
no gain! f60772e6acef55c4|2023-12-12--15-33-10--0 mock vin car name: TOYOTA RAV4 Hybrid 2022 4T3RWRFV5........  # missing EPS? recent routes are good
no gain! 0b54d0594d924cd9|2023-12-23--14-58-53--0 mock vin car name:    000000000........  # unseen platform code in Japan
no gain! 787a897ec84996e7|2023-12-03--14-30-24--0 mock vin car name: TOYOTA Corolla Hybrid 2022 JTDEAMDE0........  # missing EPS? recent routes are good
no gain! a2c30de116fe186d|2023-06-24--21-29-58--12 mock vin car name: TOYOTA RAV4 Hybrid 2023 2T3RWRFV9........  # missing EPS? recent routes are good
no gain! 5f847404b2508ce0|2023-05-08--11-27-40--7 mock vin car name: TOYOTA Land Cruiser  JTEBR3FJ1........
no gain! 9bf4af979ddee563|2023-12-14--04-57-32--0 mock vin car name: LEXUS IS 2023 JTHAP1D26........  # new EPS version, we only have 1 in DB
no gain! 817df76359225baa|2023-12-28--20-19-48--0 mock vin car name: TOYOTA RAV4 Prime Plug-in Hybrid 2022 JTMEB3FV4........
no gain! 519cd5cb1bd7f6f5|2023-10-17--14-19-35--0 mock vin car name: TOYOTA RAV4 Prime Plug-in Hybrid 2023 JTMEB3FV6........

And we have 19 new dongles that now fingerprint with both using fwdRadar and neither! No dongles lose matches.

View
Dongles stayed same (no gain) 17
Gain: 19 dongles
Loss: 0 dongles
Even: 3852 dongles

something mismatched
404d0b3326346d5a|2023-12-29--11-21-36--0 mock
(True, [])  # abs
(False, ['TOYOTA RAV4 2023'])  # fwdRadar
(False, ['TOYOTA RAV4 2023'])  # neither (fwdCamera and eps)

something mismatched
7525f320bb0420f0|2023-12-05--22-11-17--0 mock
(True, [])
(False, ['TOYOTA RAV4 2023'])
(False, ['TOYOTA RAV4 2023'])

something mismatched
3b1e68fd17e4d223|2023-06-27--16-35-56--38 LEXUS ES 2019
(True, [])
(False, ['LEXUS ES 2019'])
(False, ['LEXUS ES 2019'])

something mismatched
26d5fad65695ba89|2023-12-13--15-22-07--0 TOYOTA RAV4 2023
(True, [])
(False, ['TOYOTA RAV4 2023'])
(False, ['TOYOTA RAV4 2023'])

something mismatched
9993ef6cfe3613bf|2023-12-30--17-50-36--44 TOYOTA RAV4 2023
(True, [])
(False, ['TOYOTA RAV4 2023'])
(False, ['TOYOTA RAV4 2023'])

something mismatched
e16e4f4ef04a4ab3|2023-12-22--10-25-18--8 mock
(True, [])
(False, ['TOYOTA RAV4 2022'])
(False, ['TOYOTA RAV4 2022'])

something mismatched
c3f88a5035764f65|2024-01-15--23-13-40--0 mock
(True, [])
(False, ['TOYOTA PRIUS TSS2 2021'])
(False, ['TOYOTA PRIUS TSS2 2021'])

something mismatched
7c4c77e442583f42|2023-02-05--16-31-26--39 TOYOTA PRIUS TSS2 2021
(True, [])
(False, ['TOYOTA PRIUS TSS2 2021'])
(False, ['TOYOTA PRIUS TSS2 2021'])

something mismatched
495ad4581a73fe31|2023-10-19--13-01-24--17 TOYOTA PRIUS TSS2 2021
(True, [])
(False, ['TOYOTA PRIUS TSS2 2021'])
(False, ['TOYOTA PRIUS TSS2 2021'])

something mismatched
f408dd110b0536c6|2024-01-03--05-35-28--3 mock
(True, [])
(False, ['TOYOTA HIGHLANDER 2020'])
(False, ['TOYOTA HIGHLANDER 2020'])

something mismatched
0bbe367c98fa1538|2023-06-27--12-41-04--6 mock
(True, [])
(False, ['TOYOTA PRIUS TSS2 2021'])
(False, ['TOYOTA PRIUS TSS2 2021'])

something mismatched
01dbb5f1401cb7ae|2023-02-28--21-23-21--2 TOYOTA PRIUS TSS2 2021
(True, [])
(False, ['TOYOTA PRIUS TSS2 2021'])
(False, ['TOYOTA PRIUS TSS2 2021'])

something mismatched
9b3ad576e0a790c7|2023-10-06--21-41-37--16 TOYOTA RAV4 2022
(True, [])
(False, ['TOYOTA RAV4 2022'])
(False, ['TOYOTA RAV4 2022'])

something mismatched
a7439389f7c058a6|2023-09-05--18-44-13--7 TOYOTA ALPHARD 2020
(True, [])
(False, ['TOYOTA ALPHARD 2020'])
(False, ['TOYOTA ALPHARD 2020'])

something mismatched
69e4f202ff8a7c3e|2023-12-09--16-10-00--0 mock
(True, [])
(False, ['TOYOTA COROLLA TSS2 2019'])
(False, ['TOYOTA COROLLA TSS2 2019'])

something mismatched
3343b62dd3cee552|2023-02-15--12-18-56--1 TOYOTA PRIUS TSS2 2021
(True, [])
(False, ['TOYOTA PRIUS TSS2 2021'])
(False, ['TOYOTA PRIUS TSS2 2021'])

something mismatched
dafb0cb9e28e0249|2023-04-30--10-28-37--1 TOYOTA PRIUS TSS2 2021
(True, [])
(False, ['TOYOTA PRIUS TSS2 2021'])
(False, ['TOYOTA PRIUS TSS2 2021'])

something mismatched
007f1416e7b53998|2023-12-23--05-05-11--0 mock
(True, [])
(False, ['TOYOTA RAV4 2023'])
(False, ['TOYOTA RAV4 2023'])

something mismatched
b1d815294319e3f7|2023-06-10--11-20-13--0 mock
(True, [])
(False, ['TOYOTA RAV4 2023'])
(False, ['TOYOTA RAV4 2023'])

Notebook code:

View
def get_most_likely_brand(car_fw):
  brands = defaultdict(int)
  for fw in car_fw:
    brands[fw.brand] += 1
  brands = {b: c for b, c in brands.items() if c > 3}
  if len(brands) == 0:
    return None
  return sorted(brands.items(), key=lambda x: x[1])[-1][0]

gain_losses = {}
checked_dongles_set = set()
checked_platforms_set = set()
dongles_stayed_same = set()

print('Results: {}'.format(len(results)))
for r in tqdm(results):
  segment, CP, fp_results, platform = r
  dongle = segment.split('|')[0]

  if len(CP.carFw) == 0:
    continue

  if dongle in checked_dongles_set:
    continue
  
  checked_dongles_set.add(dongle)
  checked_platforms_set.add(platform)

  new_method_comparing = 'fwdRadar'

  # (allow_fuzzy, allow_exact, platform_code_ecu)
  if fp_results[(True, True, 'abs')] == fp_results[(True, True, new_method_comparing)] and len(fp_results[(True, True, new_method_comparing)][1]) != 1:
    # don't consider other brands for this metric
    if get_most_likely_brand(CP.carFw) == 'toyota':
      try:
        # assert False
        parsed = vpic.decode_vin(CP.carVin)
        electrification = (' Plug-in Hybrid' if 'PHEV' in parsed.electrification_level else
                         ' Hybrid' if 'HEV' in parsed.electrification_level else '')
        car_vin_name = f'{parsed.make} {parsed.model}{electrification} {parsed.model_year}'
      except:
        car_vin_name = None
      print('no gain!', segment, platform, 'vin car name:', car_vin_name, CP.carVin[:-8] + '........')
      # print(fp_results[(True, True, 'abs')])
      # print(fp_results[(True, True, 'fwdRadar')])
      # print(fp_results[(True, True, 'neither')])
      dongles_stayed_same.add(dongle)
      print()

  if not (fp_results[(True, True, 'abs')] == fp_results[(True, True, 'fwdRadar')] == fp_results[(True, True, 'neither')]):# or platform == 'mock':
    print('something mismatched')
    print(segment, platform)
    print(fp_results[(True, True, 'abs')])
    print(fp_results[(True, True, 'fwdRadar')])
    print(fp_results[(True, True, 'neither')])
    print()

  if dongle not in gain_losses:
    matches_fuzzy_old = fp_results[(True, True, 'abs')][1]
    matches_fuzzy_new = fp_results[(True, True, new_method_comparing)][1]
    if len(matches_fuzzy_new) == 1 and len(matches_fuzzy_old) != 1:
      gain_losses[dongle] = 'gain'
    elif len(matches_fuzzy_new) != 1 and len(matches_fuzzy_old) == 1:
      gain_losses[dongle] = 'loss'  # 'loss_noradar' if missing_radar else 'loss'
    else:
      gain_losses[dongle] = 'even?'

  if not (fp_results[(True, True, 'fwdRadar')] == fp_results[(True, True, 'neither')]):# or platform == 'mock':
    print('one of the new methods mismatched')
    print(segment, platform)
    print(fp_results[(True, True, 'abs')])
    print(fp_results[(True, True, 'fwdRadar')])
    print(fp_results[(True, True, 'neither')])
    print()

@sshane
sshane merged commit be15b31 into master Jan 25, 2024
@sshane
sshane deleted the toyota-no-abs branch January 25, 2024 10:02
66thparallel pushed a commit to 66thparallel/janes_openpilot_fork that referenced this pull request May 1, 2026
* use radar instead of abs

* str the strenum

* Lexus ES: non-TSS2 probably don't have stop and go without DSU-pull and/or pedal

* remove from NO_STOP_TIMER_CAR. this set is so confusing

* Combine ES & ESH (preferring ESH's DSU msgs)

* ES: forgot substitute

* comment

* Highlander: combine, preferring the hybrid for DSU msg mismatches (0x365 and 0x366)

* remove duplicates and sort

* update docs

* toyota non_essential ECU test

* Lexus RX: combine, preferring hybrid's msgs (they all exist on ICE)

* sort and remove dups

* parameterize so we can test with notebook

* this too

* clean up

* clean up

* tuple makes more sense

* update comments

* update

* update

* update
old-commit-hash: be15b31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant