openpilot icon indicating copy to clipboard operation
openpilot copied to clipboard

Toyota: match speed on dash

Open pd0wm opened this issue 3 years ago • 1 comments

TODO:

  • [x] Find imperial bit for set speed
  • [ ] Find current speed

pd0wm avatar Jul 21 '22 12:07 pd0wm

  • [x] Verify UI set speed is common and correct
  • [ ] Verify UI speed is common and correct
  • [x] Verify speed unit is common and correct
  • [ ] Find conversion factors and confirm it's common on all cars
    • [ ] Metric: According to @cydia2020, he sees 189 kph on the dash, 180 kph in openpilot = 1.05 factor
    • [ ] Imperial: Seems to be the same as metric (84 mph / 80 mph) = 1.05

sshane avatar Aug 24 '22 07:08 sshane

The 2021 Lexus ES300h has an offset of 1.033. This was raised in a previous PR:

  • https://github.com/commaai/openpilot/pull/24650

sunnyhaibin avatar Aug 30 '22 18:08 sunnyhaibin

I use 1.09 for corollas and corollacross Brazil made: https://github.com/AlexandreSato/openpilot/commit/05856cd63825947cbe463223da382ccbf8747c79

AlexandreSato avatar Sep 03 '22 20:09 AlexandreSato

Grouping this way makes much more sense, still increments of 0.005. I found from manual testing that the acceptable range is approximately also 0.005, for example 1.017 to 1.022 worked decently well for my car with hysteresis of 0.5 km/h:

Group: 1.028, group avg: 1.0294, group mean diff: 0.0021
TOYOTA RAV4 HYBRID 2022         - 1.0307460317460317
TOYOTA MIRAI 2021               - 1.0304705882352942
TOYOTA RAV4 2022                - 1.03015
TOYOTA RAV4 2019                - 1.029957142857143
TOYOTA RAV4 HYBRID 2019         - 1.0293478260869566
TOYOTA PRIUS TSS2 2021          - 1.0258405797101449

Group: 1.023, group avg: 1.0221, group mean diff: 0.0009
TOYOTA PRIUS 2017               - 1.0230138888888891
LEXUS ES HYBRID 2018            - 1.0230000000000001
TOYOTA HIGHLANDER HYBRID 2018   - 1.0222173913043477
TOYOTA COROLLA HYBRID TSS2 2019 - 1.0216825396825397
TOYOTA HIGHLANDER 2017          - 1.0208245614035087

Group: 1.018, group avg: 1.0172, group mean diff: 0.0013
LEXUS RX 2020                   - 1.0196923076923077
LEXUS RX HYBRID 2020            - 1.0185
TOYOTA COROLLA TSS2 2019        - 1.0184675324675325
LEXUS ES HYBRID 2019            - 1.0174285714285716
LEXUS RX HYBRID 2017            - 1.0169166666666667
LEXUS ES 2019                   - 1.0167608695652175
TOYOTA CAMRY 2021               - 1.0166190476190478
TOYOTA COROLLA 2017             - 1.0163970588235294
TOYOTA CAMRY HYBRID 2021        - 1.016392857142857
TOYOTA HIGHLANDER 2020          - 1.016029411764706
LEXUS RX 2016                   - 1.015943396226415

Group: 1.013, group avg: 1.0139, group mean diff: 0.0011
TOYOTA HIGHLANDER HYBRID 2020   - 1.0154918032786886
TOYOTA AVALON 2019              - 1.01545
TOYOTA AVALON HYBRID 2019       - 1.0148
TOYOTA AVALON 2016              - 1.0138
TOYOTA CAMRY 2018               - 1.013661764705882
TOYOTA CAMRY HYBRID 2018        - 1.0135952380952378
TOYOTA C-HR 2018                - 1.0131000000000001
TOYOTA SIENNA 2018              - 1.0128214285714285
TOYOTA AVALON 2022              - 1.012

However, when running on only metric (above was imperial), the results for a lot of cars change and I'm not sure why yet:

Group: 1.045, group avg: 1.0534, group mean diff: 0.0084
TOYOTA RAV4 HYBRID 2022         - 1.06275
LEXUS NX HYBRID 2018            - 1.056375
TOYOTA HIGHLANDER 2017          - 1.051611111111111
TOYOTA PRIUS TSS2 2021          - 1.0485
TOYOTA RAV4 HYBRID 2019         - 1.047952380952381

Group: 1.04, group avg: 1.0376, group mean diff: 0.0024
TOYOTA CAMRY 2018               - 1.0375714285714286

Group: 1.035, group avg: 1.036, group mean diff: 0.0011
TOYOTA COROLLA HYBRID TSS2 2019 - 1.037111111111111
TOYOTA COROLLA TSS2 2019        - 1.0349493670886074

Group: 1.03, group avg: 1.0302, group mean diff: 0.0005
LEXUS RX 2016                   - 1.0313333333333332
TOYOTA RAV4 HYBRID 2017         - 1.0300208333333334
LEXUS RX 2020                   - 1.0298888888888889
TOYOTA RAV4 2019                - 1.02956

Group: 1.025, group avg: 1.024, group mean diff: 0.0012
TOYOTA HIGHLANDER 2020          - 1.02528
TOYOTA RAV4 2022                - 1.023818181818182
TOYOTA HIGHLANDER HYBRID 2020   - 1.023

Group: 1.02, group avg: 1.0152, group mean diff: 0.0048
LEXUS ES HYBRID 2019            - 1.0196153846153846
TOYOTA PRIUS 2017               - 1.0191052631578947
TOYOTA CAMRY HYBRID 2021        - 1.0164444444444445
TOYOTA RAV4 2017                - 1.0056666666666667

sshane avatar Sep 08 '22 06:09 sshane

@adeebshihadeh I think I've gotten the dash speed factors as close as I can. The two troubles I ran into were:

  • on Toyota stock ACC, the dash always displays 1 mph less than the set speed, so to get the correct factors I had to add 1 mph to the set speeds. If you don't the factor would be much too high and the speed wouldn't match.
  • on foreign cars that are locked to using metric, their factors seem much higher than their NA counterparts. I verified that it's not a metric vs. imperial difference as the same factor works on the TSS2 Camry Hybrid both in metric and imperial

So we'll have to accept that the C3's speed will never be exact on all Toyotas (unless we learn the factor online), however this PR should be a strict improvement to what's on master.

Tested on these cars:

  • Camry Hybrid TSS2 - matches well w/ metric & imperial
  • AU Corolla TSS2 - matches well w/ metric
  • AU RAV4 2022 TSS2 - C3 is 1 kph lower w/ metric

sshane avatar Sep 08 '22 21:09 sshane

We became a lot closer in PR: https://github.com/commaai/openpilot/pull/26408, closing for now

sshane avatar Nov 15 '22 04:11 sshane