Commit Graph

231 Commits

Author SHA1 Message Date
cl0cks4fe
dd9d5d4528 Unittest to pytest (#32366)
* add pytest-asyncio

* switch common

* switch selfdrive

* switch system

* switch tools

* small fixes

* fix setUp and valgrind pytest

* switch to setup

* fix random

* switch mock

* switch test_lateral_limits

* revert test_ui

* fix poetry.lock

* add unittest to banned-api

* add inline ignores to remaining unittest imports

* revert test_models

* revert check_can_parser_performance

* one more skip

---------

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2024-05-17 11:01:44 -07:00
andreasdamm
7ab39fb92c Added ECU FW version for 2021 Lincoln Aviator Black Label Grand Touring (#32361) 2024-05-07 21:49:52 -07:00
Cameron Clough
85c9fea5d8 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>
2024-05-07 20:28:59 -07:00
Shane Smiskol
5d28b929c3 distance bars: bars always cycle 1, 2, 3 (#32251)
1, 2, 3 instead of 2, 3, 4
2024-04-18 19:39:08 -07:00
Shane Smiskol
70cdcc51a9 [bot] Fingerprints: add missing FW versions from CAN fingerprinting cars (#32203)
Export fingerprints
2024-04-15 09:28:32 -07:00
Cameron Clough
7bc81341e1 Ford: add Ranger 2024 (CAN FD, dashcam only) (#31956)
* Ford: add Ranger 2024 (CAN FD, dashcam only)

* force fingerprint

* debug

* add FW (using debug_fw_fingerprinting_offline)

* add test route

* Revert "debug"

This reverts commit 9d128cb1bbb28fb0cb8da6725c291ebe285e7467.

* Revert "force fingerprint"

This reverts commit 421d92172f354b4713a1371bec9dc9b1bbb6318f.

* update package and finalise steer ratio

"Adaptive Cruise Control with Lane Centering" is part of the Raptor
Standard Equipment Group (i.e. only on the Raptor trim). However,
looking at As-Built/VIN data for Raptor LARIATs show that although Ford
does not advertise it they do come with Lane Centering (the configurator
only says they have ACC with Stop and Go).

ACC with Stop and Go can also be added to the lower XLT trim as part of
the Technology Package, but it is unclear at this point whether that
includes Lane Centering.

The 2021 Ranger had a 17.0 steer ratio. The As-Built data suggests
17/18. PlotJuggler shows the liveParameters.steerRatio between 16.5-17.5
on two short drives.

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2024-04-14 18:00:34 -07:00
Shane Smiskol
8671e6217b [bot] Fingerprints: add missing FW versions from new users (#32055)
Export fingerprints
2024-03-29 14:25:14 -07:00
Hunter Jackson
8f4a5d7700 Update Ford Maverick fingerprints (#32043)
* update maverick fingerprints

* Update selfdrive/car/ford/fingerprints.py

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2024-03-29 14:18:53 -07:00
Cameron Clough
b59ae50961 Ford: handle metric cruise speed (v2) (#31463)
* Ford: handle metric cruise speed (v2)

**Description**

I found a signal which appears to match the IPC "Show km/h" setting.
Requires https://github.com/commaai/opendbc/pull/1010.

**Verification**

- [ ] Test in car and confirm that toggling the "Show km/h" setting does
  not result in the cruise speed shown in openpilot being incorrect.
- [ ] Test in a non-English (metric) car.

* not present on Q4

* fix freq

* test

* Revert "test"

This reverts commit 5e3a9f6df126d51685157de1e52bd6695db40fac.

* Update ref_commit

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2024-03-21 16:19:59 -07:00
Justin Newberry
b0eb3ba4f4 cars: platform enums -> prepend brand name (#31927)
* with brand name

* migrate

* Fix

* fixes

* more

* passes

* fix

* fix the doc

* collects

* these too

* more stuff

* body exception :/

* more

* hardcode i guess

* update ref

* toyota

* more toyota

* and here

* final!

* fix notebooks and ccs

* move this here
2024-03-19 17:29:50 -07:00
Adeeb Shihadeh
3a7582d9a6 Abstract out common CarInterface.apply (#31924) 2024-03-19 13:46:31 -07:00
thenhnn
489528dcae PlatformConfig: automatically get platform_str from the enum name (#31868)
* get platform_str from the enum name

* fix tests

* add migration table

* remove impossible todo

* Add link to PR in MIGRATION table

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* Remove useless brand name comments and rename RAM_1500 to RAM_1500_5TH_GEN

* rename RAM_HD to RAM_HD_5TH_GEN

* rename references to RAM_HD and RAM_1500

* change "mock" to "MOCK" and rename torque data of Nissan Leaf 2018 IC

* remove MOCK from fingerprints.py

* change hard-coded car model in test_can_fingerprint.py/test_timing

* migration

* update ref

* space

* prius

---------

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: justin newberry <justin@comma.ai>
Co-authored-by: Justin Newberry <jnewberry0502@gmail.com>
2024-03-19 11:16:02 -07:00
Justin Newberry
0b92f4e9ee more car info -> car docs (#31885) 2024-03-17 16:53:57 -07:00
Shane Smiskol
5746c4672d Ford: hybrid docs (#31874)
* kinda works

* fix

* clean up

* rm hybrid entries

* shorter

* shorter

* fix that

* one line!

* we can get rid of this now!
2024-03-15 15:37:29 -07:00
Justin Newberry
655e5f7c3e rename CarInfo to CarDocs (#31879)
car info to car docs
2024-03-15 11:45:44 -07:00
Shane Smiskol
bdae188c6f docs: don't support multi-type car info (#31875)
don't support multi-type car info
2024-03-15 00:11:41 -07:00
Shane Smiskol
af177f3d10 [bot] Fingerprints: add missing FW versions from new users (#31839)
Export fingerprints
2024-03-11 23:43:25 -07:00
RandomHB
fedb2a9360 Update fingerprints.py 2022 Ford F-150 PowerBoost (fwdCamera) (#31462)
* Update fingerprints.py 2022 Ford F-150 PowerBoost (fwdCamera)

* update MY

* also likely works for hybrid

* fix that

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2024-03-11 22:17:10 -07:00
GRIFFIT807
adc15d69a2 Add support for 2024 Ford Maverick (#31828)
* Update fingerprints.py

* Update values.py

* 24

* Update CARS.md

* hybrid should match up

---------

Co-authored-by: Justin Newberry <jnewberry0502@gmail.com>
Co-authored-by: Shane Smiskol <shane@smiskol.com>
2024-03-11 21:31:53 -07:00
Cameron Clough
011eed0daf Ford: show longitudinal personality in IPC (#31796)
* Ford: show longitudinal personality in IPC

Adjust the time gap to 2, 3 or 4 bars for openpilot long.

TODO: set AccTGap_D_Dsply when value changes so that the popup appears
with the new time gap

Depends on #31760.

* ACC UI: show time gap popup when distance changes

* Revert "ACC UI: show time gap popup when distance changes"

This reverts commit c4e8e10970078a534d5714ddced92d540e9e3c0c.

* ACC UI: send on distance bars change

* don't need this check - just send on first frame
2024-03-11 20:30:09 -07:00
Cameron Clough
682f16d1b5 Ford: fix counter in LateralMotionControl2 message (#31806)
The counter should be between 0-15 inclusive. This only affects CAN FD cars.
2024-03-09 20:54:54 -08:00
Yasushi Oh
1589adddf1 bugfix: add support for Bronco Sport 2023 (#31794)
* bugfix: add support for Bronco Sport 2023

* Apply suggestions from code review

* update docs

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2024-03-08 21:49:12 -08:00
Shane Smiskol
99610c8819 Revert "common PlatformFlags base class + test for < 32 bits" (#31793)
Revert "common PlatformFlags base class + test for < 32 bits (#31779)"

This reverts commit 8ba5d660f3.
2024-03-08 00:15:21 -08:00
Justin Newberry
8ba5d660f3 common PlatformFlags base class + test for < 32 bits (#31779)
* add 32 bit check

* space

* this is not required

* jk yes we do
2024-03-07 14:01:28 -08:00
Cameron Clough
98a491b1f2 Ford: parse distance button (#31733)
Ford: parse ACC gap toggle button

Use the ACC gap toggle button signal from the SCCM. There are two other
signals for "increase" and "decrease" gap buttons, but no supported car
has these buttons.
2024-03-07 01:54:33 -08:00
Shane Smiskol
78a46ce724 car values formatting (#31747)
values formatting
2024-03-06 15:47:44 -08:00
Justin Newberry
25ccb2426c cars: remove CAR_INFO map (#31739)
* no carinfo map

* smaller diff

* not on mock
2024-03-06 11:22:12 -08:00
Justin Newberry
b0eae8c1b7 platformconfig and carspecs are now required, carspecs no longer kwarg (#31667)
* required

* mock can be a platform!

* default is mock

* fix that

* and that one
2024-03-01 11:31:51 -08:00
Cameron Clough
341b81c0a5 Ford: use flags for CANFD (#31664) 2024-03-01 12:18:03 -05:00
Adeeb Shihadeh
b8c9d3bd09 Revert "Ford: remove unnecessary __init__"
This reverts commit 7687cafe8c.
2024-02-28 21:13:26 -08:00
Shane Smiskol
7687cafe8c Ford: remove unnecessary __init__ 2024-02-28 20:47:49 -08:00
Justin Newberry
3a6c3315ab Subaru: move to flags within PlatformConfig (#31584)
* flags

* update ref

* use the flags directly

* use post_init (don't freeze)

* we can maintain frozen with custom class

* not preglobal

* move to common

* cleanup
2024-02-28 20:12:14 -08:00
Justin Newberry
d4c497d826 add CarControllerBase base class to all CarControllers (#31630)
just base class for now
2024-02-28 17:13:44 -08:00
Shea_D
4cec88c029 Ford - Add OBDC Cable Length to CarPartList (#31608)
* Update comma cable requirement for Ford CANFD

* Adding Long_Cable to part list

* Moving cable info into doc_definitions under CarHarness

* Updating parts for ford_q4

* Updating Q3 info

* Updated MachE with USBC coupler

* fix typo

* updating docs/cars.md

* Add 3X angled no cable

* Adding in nocable device package

* Add missing )

Co-authored-by: Cameron Clough <cameronjclough@gmail.com>

* Generating new Docs.MD

* Added threex_nocable for MachE

* Swap MachE to regular mount no cable

* confirmed with Comma Operations all boxes include 1.5ft cable regardless of 9.5ft selection

* Updating CarInfo

* Update USB_Coupler for Q4 Harness

* Remove cable from import

* removed ]

* Disagree with the inconsistency but OK

Co-authored-by: Shane Smiskol <shane@smiskol.com>

* Update selfdrive/car/ford/values.py

---------

Co-authored-by: sheaduncan <sduncan@Yeti-PC>
Co-authored-by: Cameron Clough <cameronjclough@gmail.com>
Co-authored-by: Shane Smiskol <shane@smiskol.com>
2024-02-28 17:07:06 -08:00
Cameron Clough
0e41bf3474 Ford: fix As-Built request identifier (#31609)
Should be 0xDE00 not 0xDE
2024-02-27 10:59:27 -08:00
Cameron Clough
c724d1c86c Ford: log interesting module configuration data (#31569)
* Ford: log interesting module configuration data

Ford ECUs have what is called "As-Built Data" which is configured at the
factory/workshop to set what packages/features are enabled on the car.
But they also contain vehicle specific information (VIN, make, model,
weight, wheel base...), DTC information and driver preferences.

I dumped the CAN traffic for the FORScan diagnostic tool to see how it
requests this information from the ECUs.

<details>
<summary>FORScan communication with IPMA (camera)</summary>
<pre>
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': '0200'}
{'addr': 1806, 'type': 'negative_response', 'hex': '2231'}
{'addr': 1798, 'type': 'request', 'service': 'TESTER_PRESENT', 'hex': '00'}
{'addr': 1806, 'type': 'positive_response', 'service': 'TESTER_PRESENT', 'hex': '00'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'f190'}
{'addr': 1806, 'type': 'negative_response', 'hex': '2231'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de00'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de00020799dbaa10296516a440000000000000000000000000'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'f113'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'data': b'\xf1\x13JX7T-19H406-CH\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'hex': 'f1134a5837542d3139483430362d434800000000000000000000'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'f188'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'data': b'\xf1\x88JX7T-14F397-AH\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'hex': 'f1884a5837542d3134463339372d414800000000000000000000'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'f120'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'data': b'\xf1 JX7T-14F397-BF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'hex': 'f1204a5837542d3134463339372d424600000000000000000000'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'f121'}
{'addr': 1806, 'type': 'negative_response', 'hex': '2231'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'f124'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'data': b'\xf1$JX7T-14F398-AG\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'hex': 'f1244a5837542d3134463339382d414700000000000000000000'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'f125'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'data': b'\xf1%JX7T-14F398-BF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'hex': 'f1254a5837542d3134463339382d424600000000000000000000'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'f126'}
{'addr': 1806, 'type': 'negative_response', 'hex': '2231'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'f10a'}
{'addr': 1806, 'type': 'negative_response', 'hex': '2231'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'f111'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'data': b'\xf1\x11JX7T-14F403-CA\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'hex': 'f1114a5837542d3134463430332d434100000000000000000000'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'f18c'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'data': b'\xf1\x8c182762191\x00\x00\x00\x00\x00\x00\x00', 'hex': 'f18c31383237363231393100000000000000'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'f162'}
{'addr': 1806, 'type': 'negative_response', 'hex': '2231'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'f110'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'data': b'\xf1\x10DS-JX7T-19H406-AD\x00\x00\x00\x00\x00\x00\x00', 'hex': 'f11044532d4a5837542d3139483430362d414400000000000000'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': '0202'}
{'addr': 1806, 'type': 'negative_response', 'hex': '2231'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'd100'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'd10001'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'd700'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'd70001010101'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'd701'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'd70101020000'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'dd01'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'dd010102f8'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'f113'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'data': b'\xf1\x13JX7T-19H406-CH\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'hex': 'f1134a5837542d3139483430362d434800000000000000000000'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'fd08'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'fd0800000500500100300000000000000000000000300000000000000000200100400300100200001200f00300500000000000000300c00b00400200000000000000000000000000000000200f01201e01501400a00200200400700d02501d01700700e06405005e05503401100a000000002002002001000000'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'fd09'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'fd09ffec0001fef60002'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de00'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de00020799dbaa10296516a440000000000000000000000000'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DTC_INFORMATION', 'hex': '028f'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DTC_INFORMATION', 'hex': '02ff50019768c253002cc401862cc418862c'}
... skip DTC requests ...
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de00'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de00020799dbaa10296516a440000000000000000000000000'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de01'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de01fd5616db5fffff557fe1f842080000000800000008000000080000000819bfe00f7c00000000000000000000000000000000'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de02'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de02800000008000000080000000800000008337fc00800000008000000080000000800000008337fc0000000000000000000000'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de03'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de03fffc26c3800000000000'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de04'}
{'addr': 1806, 'type': 'positive_response', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de04546a8c0000000000'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de05'}
{'addr': 1806, 'type': 'negative_response', 'hex': '2231'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de06'}
{'addr': 1806, 'type': 'negative_response', 'hex': '2231'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de07'}
{'addr': 1806, 'type': 'negative_response', 'hex': '2231'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de08'}
{'addr': 1806, 'type': 'negative_response', 'hex': '2231'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de09'}
{'addr': 1806, 'type': 'negative_response', 'hex': '2231'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de0a'}
{'addr': 1806, 'type': 'negative_response', 'hex': '2231'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de0b'}
{'addr': 1806, 'type': 'negative_response', 'hex': '2231'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de0c'}
{'addr': 1806, 'type': 'negative_response', 'hex': '2231'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de0d'}
{'addr': 1806, 'type': 'negative_response', 'hex': '2231'}
{'addr': 1798, 'type': 'request', 'service': 'READ_DATA_BY_IDENTIFIER', 'hex': 'de0e'}
{'addr': 1806, 'type': 'negative_response', 'hex': '2231'}
</pre>
</details>

Using UDS service `READ_DATA_BY_IDENTIFIER`, we can read the As-Built
blocks from `0xDExx` with no diagnostic session/security access necessary.

I used [Online As-Built databases](https://cyanlabs.net/asbuilt-db/) and
various coding spreadsheets shared online to find values we might be
interested in using for fingerprinting (both vehicle parameters and
identifying the platform).

ABS:
- Payload tier (Base, Mid Payload Upgrade, Heavy Duty Payload
  Upgrade...)
- Wheelbase
- Steering ratio
- Cruise Control Mode (Normal, Adaptive)
- Enable Stop and Go

PSCM:
- Enable Lane Keeping Aid
- Enable Traffic Jam Assist
- Enable Lane Centering Assist

IPMA (Q4):
- Steering ratio
- Wheelbase

APIM (Sync 3 and Sync 4):
- Steering ratio
- Vehicle weight
- Wheelbase

There are more potentially useful signals which I haven't included
although they might not be necessary:
- Vehicle (Ford platform code, like "C344" or "C519" - although the
  source of the mapping from index to code is FORScan and not Ford
themselves unless we can find a better source).
- Fuel type
- Vehicle length/height/front track/rear track
- Tire circumference (could be useful for converting wheel speed rad/s
  to m/s)
- Steering angle source (Pinion, Wheel)
- Country code (letters, e.g. US, CA or UK)
- Transmission type
- CAN network architecture
- More feature flags (the APIM also stores settings for ACC, LCA, BLIS)

The full list of settings I have found is
[here](https://github.com/incognitojam/op-notebooks/blob/main/ford/settings.py).

* FwQueryConfig: add data_requests

* add car_data to CarInterface get_params

* Revert "add car_data to CarInterface get_params"

This reverts commit aa161a6b82082705db97bea2c4317e1888a74845.

* test_ford: add APIM ecu address

* Revert "FwQueryConfig: add data_requests"

This reverts commit dc5484a9b80be5bc61a7fdf55560b8813bc43ef7.

* fix block numbers and add extra queries

* bump test_fw_query_timing

* add missing query whitelists

* simplify asbuilt requests

* use forscan block ids

* formatting

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2024-02-27 04:22:10 -08:00
Justin Newberry
9ecff49118 platformconfig: freeze all dataclasses (#31605)
* frozen

* frozen
2024-02-26 21:16:05 -08:00
Cameron Clough
8e03cdfc2a Ford: move to PlatformConfig (#31554)
* Ford: move to PlatformConfig

* Align Aviator model years with Explorer

* Add CarSpecs to PlatformConfig

---------

Co-authored-by: justin <justin@comma.ai>
2024-02-25 17:55:42 -08:00
Cameron Clough
995250ae49 use pyupgrade to update to new typing syntax (#31580)
* add pyupgrade hook

* run pyupgrade (pre-commit run -a)

* ruff --fix

* Revert "add pyupgrade hook"

This reverts commit 56ec18bb6b8602a0b612f3803d96cdad14b52066.

* revert changes to third_party/

* manual type fixes

* explicit Optional wrapping capnp objects
2024-02-24 16:41:23 -08:00
Cameron Clough
6ed72b3626 Ford: add hybrid variants to docs (#31575)
* Ford: add hybrid variants to docs

Following up on https://github.com/commaai/openpilot/pull/31568

| CarInfoPlatform              | ElectrificationLevel   | ModelYear              | Series                                                                                            | Trim                                                                |
|:-----------------------------|:-----------------------|:-----------------------|:--------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------|
| FORD BRONCO SPORT 1ST GEN    | ICE                    | 2021, 2022             | BADLANDS, BASE, BIG BEND, FIRST EDITION, OUTER BANKS                                              |                                                                     |
| FORD ESCAPE 4TH GEN          | FHEV                   | 2020, 2021, 2022       | SE, SEL, Titanium                                                                                 |                                                                     |
| FORD ESCAPE 4TH GEN          | ICE                    | 2020, 2021, 2022       | S, SE, SEL, Titanium                                                                              |                                                                     |
| FORD ESCAPE 4TH GEN          | PHEV                   | 2020, 2021, 2022       | SE, SEL, Titanium                                                                                 |                                                                     |
| FORD EXPLORER 6TH GEN        | HEV                    | 2020, 2021, 2022, 2023 | Limited, Platinum                                                                                 |                                                                     |
| FORD EXPLORER 6TH GEN        | ICE                    | 2020, 2021, 2022, 2023 | Base, Black Label, King Ranch, Limited, Platinum, Reserve, ST, ST-Line, Standard, Timberline, XLT |                                                                     |
| FORD EXPLORER 6TH GEN        | PHEV                   | 2020, 2021             | Black Label Grand Touring, Blk Label Grand Touring, Grand Touring                                 |                                                                     |
| FORD F-150 14TH GEN          | HEV                    | 2021, 2022, 2023       | , F-Series                                                                                        | SuperCrew                                                           |
| FORD F-150 14TH GEN          | ICE                    | 2021, 2022, 2023       | , F-Series                                                                                        | , Regular Cab, SuperCab, SuperCrew, SuperCrew-Raptor, SuperCrew-SSV |
| FORD F-150 LIGHTNING 1ST GEN | BEV                    | 2022, 2023             |                                                                                                   | SuperCrew                                                           |
| FORD MAVERICK 1ST GEN        | HEV                    | 2022, 2023             | SUPERCREW, XL XLT Lariat                                                                          | , SUPERCREW                                                         |
| FORD MAVERICK 1ST GEN        | ICE                    | 2022, 2023             | SUPERCREW, XL XLT Lariat, XLT Lariat                                                              | , SUPERCREW                                                         |
| FORD MUSTANG MACH-E 1ST GEN  | BEV                    | 2021, 2022, 2023       | California Route 1, GT, Premium, Select                                                           |                                                                     |

Data from NHTSA database and https://www.ford.co.uk/cars.

* revert F-150 model year change
2024-02-24 10:01:02 -08:00
Shane Smiskol
378ba114f9 Ford: support hybrid Q3 platforms (#31568)
* bump

* ford: remove dynamic dashcam lockout for hybrids

* releases?

* Revert "releases?"

This reverts commit 88d950043d79b8c00535f48ed84b854bc2ab2557.

* bump

* Reapply "releases?"

This reverts commit db5079dc3f1a6bce70bd04430be45704d8604e76.

* 097
2024-02-23 21:22:34 -08:00
Shane Smiskol
a2bda8724d Ford: add back OBD queries for logging (#31543)
* Revert "Reapply "Ford: don't fingerprint on engine (#31195)" part 2 (#31320)"

This reverts commit dd6065c33b.

* fix refs

* mark logging
2024-02-22 01:34:15 -08:00
Shane Smiskol
cabde52ac6 Ford: log traction control status (#31424)
* not sure which to use

* cluster changes a bit earlier andis already used for nonAdaptive
2024-02-12 19:20:49 -08:00
Shane Smiskol
ee16eefc1a Ford: Add missing FW for Escape 2022 (#31321)
Add missing FW for a25d5d0b645d8bc3
2024-02-06 00:05:08 -08:00
Shane Smiskol
dd6065c33b Reapply "Ford: don't fingerprint on engine (#31195)" part 2 (#31320)
* Reapply "Ford: don't fingerprint on engine (#31195) part 2"

This reverts commit 7694712cd6.

* add comment

Co-authored-by: Cameron Clough <cameronjclough@gmail.com>

---------

Co-authored-by: Cameron Clough <cameronjclough@gmail.com>
2024-02-05 23:57:46 -08:00
Shane Smiskol
50a552ab8d Reapply "Ford: don't fingerprint on engine (#31195)" (#31303)
* Reapply "Ford: don't fingerprint on engine (#31195)"

This reverts commit 7694712cd6.

* don't change the queries

* revert refs
2024-02-05 14:46:34 -08:00
Shane Smiskol
7694712cd6 Revert "Ford: don't fingerprint on engine (#31195)"
This reverts commit 1d1c9936cf.
2024-02-05 01:35:39 -08:00
Harald Schäfer
feaf52dd4c Ford long control improvements (#31123)
* Ford updates

* back to normal

* Small fixes

* Try max

* Does pred matter

* ref commit

* Update ref
2024-01-30 11:40:52 -08:00
Cameron Clough
1d1c9936cf Ford: don't fingerprint on engine (#31195)
* Ford: do not fingerprint engine

* add notebook

* Ford: add missing Explorer FW

* revert

* revert

* Revert "revert"

This reverts commit ad32feaa689f2b497c8bcc9fedc73cae6c87f697.

* TestFwFingerprintTiming: try these

* TestFwFingerprintTiming: update total ref time

* remove notebook

* fix ref

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2024-01-30 02:42:33 -08:00
Cameron Clough
1a202a55c1 Ford: add missing Mach-E fw (#31145)
From the route 83a4e056c7072678/2023-11-13--16-51-33 (which is already
in selfdrive/car/tests/routes.py, added in #30691).
2024-01-24 15:37:32 -08:00