Commit Graph

369 Commits

Author SHA1 Message Date
Shane Smiskol
e735a7f379 move selfdrive/car to opendbc (#32630)
* move most of /car

* move some car tests

move some car tests

* fix selfdrive/car/tests

* fix selfdrive/controls tests

* fix the rest of the selfdrive tests

* bump opendbc

* fix all tests

* few more non-test references

* remove opcar and move docs to car

fix these debugging scripts

fix docs

* bump opendbc and panda

forgot panda
2024-08-17 00:54:51 -07:00
Shane Smiskol
6a15c42143 selfdrive/car: ban cereal and capnp (#33208)
* ban cereal and msgq

* common too

* do toyota/values.py

* do all fingerprints

* example without builder

* this still works, but no type checking anymore

* stash

* wtf, how does this work

* okay actually not bad

* safe

* epic!

* stash data_structures.py

* some clean up

* hell yeah

* clean up old file

* add to delete

* delete

This reverts commit 90239b7797ace31ee647a2fdbd67e0c3faa98dcf.

* switch more CarParams stuff over

remove unused

* fix car tests by removing cereal! mypy forgets about dataclass if we wrap it :(

* fix this too

* fix this too

* remove more cereal and add some good hyundai tests

* bunch more typing

* override default with 20hz radar

* temp capnp converter helper

* more lateralTuning

* small union replicator is better than what i was trying, and fixes mypy dynamic typing issues

* can keep all this the same now!

* type ret: CarParams, add more missing structs, revert lateralTuning changes (smaller diff!)

* revert more

* get first enum automatically, but ofc mypy doesn't pick up the new metaclass so can't use :(

would have been `CarParams.NetworkLocation()`

* Revert "get first enum automatically, but ofc mypy doesn't pick up the new metaclass so can't use :("

This reverts commit bb28b228becba932052d2fc5a4389784027435b1.

* remove cereal from car_helpers (TODO: caching)

* remove a bunch of temp lines

* use dataclass_transform!

* remove some car.CarParams from the interfaces

* remove rest of car.CarParams from the interfaces

* same which() API

* sort

* from cereal/cache from fingerprinting!

* more typing

* dataclass to capnp helper for CarParams, cached it since it's kinda slow

* (partial) fix process replay fingerprintig for new API

* latcontrollers take capnp

* forgot this

* fix test_models

* fix unit tests

* not here

* VehicleModel and controller still takes capnp CP since they get it from Params()

* fix modeld test

* more fix

* need to namespace to structs, since CarState is both class and struct

* this was never in the base class?!

* clean that up again

* fix import error

fix import error

* cmts and more structs

* remove some more cereal from toyota + convert CarState to capnp

* bruh this was wrong

* replace more cereal

* EventName is one of the last things...

* replace a bunch more cereal.car

* missing imports

* more

* can fix this typing now

* proper toyota+others CS typing!

* mypy can detect return type of CS.update() now

* fix redeclaration of cruise_buttons type

* mypy is only complaining about events now

* temp fix

* add carControl struct

* replace CarControl

i hope there's no circular imports in hyundai's CC

* fine now

* lol this was wrong too

* fix crash

* include my failed attempts at recursively converting to dataclass (doesn't implicitly convert types/recursively :( )

but attrs does, maybe will switch in the future

* clean up

* try out attr.s for its converter (doesn't work recursively yet, but interesting!)

* Revert "try out attr.s for its converter (doesn't work recursively yet, but interesting!)"

This reverts commit ff2434f7bbd45a4d4bfb21f7d6712d1f1c3bcde9.

* test processes doesn't fail anymore (on toyota)!

* fix honda crash

* stash

* Revert "stash"

This reverts commit c1762af4e776790e4ad1322ad4ce0610157346e0.

* remove a bunch more cereal!

* LET'S GOOO

* fix these tests

* and these

* and that

* stash, something is wrong with hyundai enable

* Revert "stash, something is wrong with hyundai enable"

This reverts commit 39cf327def258e2959fe23cd7a550a858f6d8f03.

* forgot these

* remove cereal from fw_versions

* Revert "remove cereal from fw_versions"

This reverts commit 232b37cd409b55d04b1afc90d4a80c49e710eb56.

* remove rest of the cereal exceptions!

* fix that

* add typing to radard since I didn't realize RI.update() switched from cereal to structs

* and here too!

* add TODO for slots

* needed CS to be capnp, fix comparisons, and type hint car_specific so it's easier to catch type issues (capnp isn't detected by mypy :( )

* remove the struct converter

* save ~4-5% CPU at 100hz, we don't modify after so no need to deepcopy

btw pickle.loads(pickle.dumps()) is faster by ~1% CPU

* deepcopy -> copy: we can technically make a reference, but copy is almost free and less error-prone

saves ~1% CPU

* add non-copying asdict function

* should save ~3% CPU (still 4% above baseline)

* fix that, no dict support

* ~27% decrease in time for 20k iterations on 3X (3.37857 -> 2.4821s)

* give a better name

* fix

* dont support none, capitalize

* sheesh, this called type() on every field

* remove CS.events, clean up

* bump card %

* this was a bug on master!

* add a which enum

* default to pid

* revert

* update refs

* not needed, but consistent

* just Ecu

* don't need to do this in this pr

* clean up

* no cast

* consistent typing

* rm

* fix

* can do this if we're desperate for the last few %

* Revert "can do this if we're desperate for the last few %"

This reverts commit 18e11ac7883a0a56583750b1cc5a2b13011e7299.

* type this

* don't need to convert carControl

* i guess don't support set either

* fix CP type hint

* simplify that
2024-08-16 15:13:00 -07:00
Shane Smiskol
6a5bbb261e fw_versions.py: mark raw in f-string 2024-08-16 00:38:28 -07:00
Shane Smiskol
b41f9f2dfe run_process_on_route.py: use zstd 2024-08-16 00:08:17 -07:00
Shane Smiskol
2ed567b0f5 move live fingerprint debugging code to debug/car (#33308)
* remove cereal from fw_versions

* fix it

* do ecu_addrs and vin

* do last one

* move executable-ness

* notexe

* nice test
2024-08-14 19:24:24 -07:00
Maxime Desroches
1dcd660815 fix bash + python3 shebangs (#33287)
fix shebangs
2024-08-13 21:22:13 -07:00
Kacper Rączy
9734015bbb controlsd: use livePose (#33283)
* Pose calibrator

* Fix static analysis

* Fix static

* Fix test_latcontrol

* Fix test_latcontrol

* Update services in process replay

* Fix static

* Matmul not mul

* Add assertion

* Move pose calibration to data_sample

* Update ref commit

* Remove llk from cycle alerts

* Deprecated nogps event

* Switch power_draw to lp

* Bring back noGps alert

* Add handling code back

* get_bool

* Bring inputsok back
2024-08-13 21:11:16 -07:00
Shane Smiskol
7c112341c3 Reapply "update to new opendbc API (#32009)" (#33151)
This reverts commit ac130001cc.
2024-07-31 15:37:39 -07:00
Maxime Desroches
1dd8bdc791 Remove hexdump package (#33155)
* remove hexdump

* uv lock

* cleanup
2024-07-31 13:34:14 -07:00
Shane Smiskol
ac130001cc Revert "update to new opendbc API (#32009)"
This reverts commit 0dddc97dca.
2024-07-31 02:38:44 -07:00
Dean Lee
0dddc97dca update to new opendbc API (#32009)
* use new opendbc api

* export pandad_python

* merge master

* merge master

* bump opendbc

* bump opendbc

* improve func

* keep interface unchanged

* fix test_car_interfaces

* bump opendbc

* bump opendbc

* fix test_models

* the interface now has to convert from can capnp to list, so we should include this time

* goes from ~210 to ~240 mean ms real time

* remoe busTime

* lowercase sendcan

* consistent msgtype

* bump

* bump

* not used in lat_mpc

* space

* bump to master

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2024-07-31 00:24:46 -07:00
Shane Smiskol
11cb2d3a0b qlog_size.py: use zstd (#33137)
qlog_size: use zstd
2024-07-29 20:13:43 -07:00
Shane Smiskol
e68bb26e14 tools: keep re pattern file small (#33084)
remove bz2 from re file
2024-07-25 22:05:10 -07:00
Kacper Rączy
c96dbd5a0b Fix msgq context overrides (#33014)
* Fix msgq context overrides

* Remove unneccesary changes

* add reset_context helper

* Remove redundant import
2024-07-18 20:19:39 -07:00
Shane Smiskol
f31ad97e92 qlog_size: decimate rlog option (#33011)
* decimate option

* clean up

* check exists
2024-07-17 21:57:36 -07:00
Shane Smiskol
35a4a773f1 Revert "selfdrive/car: ban imports from external modules" (#32993)
Revert "selfdrive/car: ban imports from external modules (#32973)"

This reverts commit 83d4623590.
2024-07-15 11:14:04 -07:00
Dean Lee
83d4623590 selfdrive/car: ban imports from external modules (#32973)
* lint import

* Update selfdrive/car/__init__.py

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2024-07-15 11:12:24 -07:00
Shane Smiskol
69d4b0fdf0 ruff: check shadowed variables (#32851)
* check shadowed variables

* fix
2024-06-27 14:44:26 -07:00
Shane Smiskol
e798caa3e5 qlog_size.py: more accurate msg size breakdown (#32723)
* grouping changes outcome

* clean up

* clean up

* clean up

* clean up

* clean up
2024-06-11 22:55:42 -07:00
Shane Smiskol
81dc33e569 Fixup qlog size (#32719)
* stash

* Revert "stash"

This reverts commit 5a22b44919d4cb8681cc08d99656954423abda93.

* improvements

* rm

* method 2

* Revert "method 2"

This reverts commit 7112d95b3eead8bfdd8efb1dcefd4edbe9107680.

* unreal for now

* stash

* Revert "stash"

This reverts commit a7c5b31d8043b8da96c21a8d40281cece3cada61.

* clean up

* update description
2024-06-11 21:36:13 -07:00
Adeeb Shihadeh
20a44bb4e9 debug: add summary to check_timings 2024-06-08 21:01:39 -07:00
Adeeb Shihadeh
34e329649d boardd is pandad (#32628)
* boardd is pandad

* rename tests
2024-06-04 19:16:55 -07:00
Shane Smiskol
c7b3ece37e revert marking some files as unexecutable (#32613)
* this is not a test

* these are not tests!
2024-06-03 17:19:27 -07:00
Adeeb Shihadeh
c59887c810 test_*.py files are no longer executable (#32610)
* test_*.py files are no longer executable

* cleanup empty lines

* update precommit

* fixme

* enable

* build
2024-06-03 15:48:56 -07:00
Shane Smiskol
63f55f4915 debug FW fingerprinting: live support (#32585)
* live debug!

* clean up
2024-05-31 22:28:03 -07:00
Adeeb Shihadeh
accdade4cf manager: move to system/ (#32538)
* manager: move to system/

* one more
2024-05-25 12:41:17 -07:00
Adeeb Shihadeh
b2e4c64cf8 ruff: enable UP 2024-05-20 17:43:54 -07:00
Adeeb Shihadeh
2d838f95da boardd: add debug flag for injecting SPI errors (#32346)
* pull out ll first

* errors

---------

Co-authored-by: Comma Device <device@comma.ai>
2024-05-07 21:36:04 -07:00
Shane Smiskol
888b38c3db print_flags.py: clean up
always ensure current impl of something is the best!
2024-05-07 15:06:23 -07:00
Shane Smiskol
f597d63bf6 PlatformConfig: clean up and print all flags (#32369)
* script to print flags

* don't need

* SAL

* back

* fix
2024-05-07 15:00:02 -07:00
Shane Smiskol
97dc444023 fix uiview (#32290)
* fix uiview

* add DMoji!
2024-04-24 17:05:18 -07:00
Shane Smiskol
cb8e336cd7 debug FW query offline: annotate sendcan/can (#32239)
bet
2024-04-17 15:38:05 -07:00
Shane Smiskol
6acf763db4 Volkswagen: fingerprint on VIN chassis code (#32148)
* add function signature and behavior comment

* add test

* move chassis codes to platform config!

* add a shared chassis code test

* function

* test matching

* this commit isn't complete yet

* Revert "this commit isn't complete yet"

This reverts commit ae77d5cd54e1f43d390fb70c4da38a95ac34f8da.

* need to check WMI

* TODO: test WMI

* test wmi

* radar FW sanity check

* fix test

* fixes from merge

fixes from merge

* whoops

* fix static analysis!

* do match_fw_to_car

match_fw_to_car takes vin

* makes sense to keep it one function, and we can return exact or fuzzy!

* clean up

* kinda pointless

* fix more tests

* back to function being only fuzzy

* revert test_fw_fingerprint

* revert test_fw_fingerprint

* simplify

* clean up/fixes

* rename test

* less duplicatey WMI descriptions

* fix

* convert to enum

* I am confident about these WMIs

* these are also good

* we support 5N AUS/NZ and NAR (North American) AX Tiguans

fixes

* Tiguan also Mexico

* only one user for caddy

* got from the test route

* check that the gateway type matches the platform (each platform has 1 or 2 types)

* ~gateway~ -> exact FW match

* remove re

* ensure WMIs are set

* actually no reason to delete

* move comment up to the platform config

* proper wmis typing

* spacing

* flip
2024-04-12 22:00:03 -07:00
MarinkoMagla
9d1b3cc773 Encode the actual current date in vw_mqb_config.py (#32093) 2024-04-10 15:22:36 -07:00
Dean Lee
178cc8747c debug/check_can_parser_performance: remove overhead of capnp conversion (#32048) 2024-03-29 10:17:39 -07:00
Shane Smiskol
81fae3d807 More fingerprint migration fixes (#32018)
* fix migration

* another
2024-03-26 16:43:09 -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
de7f14dbd7 Fingerprints migration dictionary (#31838)
move migration to op!
2024-03-12 11:50:26 -07:00
Shane Smiskol
1644572be2 run_process_on_route: print log location 2024-03-06 01:04:31 -08:00
noname314
95a80fd2cd HKG: Add FW versions and Enable Radar Tracks for KOR Sonata DN8 Hybrid 2020 (#31371)
* HKG: Add FW versions for KOR Sonata DN8 Hybrid 2020

* HKG: Enable radar tracks for KOR Sonata DN8 Hybrid 2020

* rm extra

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2024-03-05 18:08:32 -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
Adeeb Shihadeh
2cf831a304 debug: improve count_events.py output 2024-02-20 14:20:53 -08:00
Adeeb Shihadeh
528e555892 debug: print log messages in relative time 2024-02-19 22:33:08 -08:00
Shane Smiskol
c5f1f4c676 test_fw_query_on_routes: get first qlog (#31496)
* fast

* this isn't internal

* see
2024-02-16 17:55:15 -08:00
Adeeb Shihadeh
663f7017f2 fix linter 2024-02-15 13:35:49 -08:00
Adeeb Shihadeh
64851baea8 debug/count_events.py improvements 2024-02-15 13:13:11 -08:00
Justin Newberry
d6762c3035 live_logreader to its own file (#31436)
own file
2024-02-13 13:29:52 -08:00
Justin Newberry
0a92c5bf96 LogReader: live_logreader helpers (#31416)
live helper
2024-02-12 12:58:25 -08:00
Shane Smiskol
c2ee072907 format fingerprints: fix empty FW versions (#31230)
fix
2024-01-30 03:07:00 -08:00