Commit Graph

9173 Commits

Author SHA1 Message Date
Dean Lee b14fca78e0 cereal/SubMaster: encapsulate frequency management in FrequencyTracker (#33252)
* encapsulate frequency management

* apply reviews

* early return, avoiding unnecessary calculations

* simplify avg freq calc
2024-08-19 16:53:13 -07:00
commaci-public 9b2cafe597 [bot] Update Python packages (#33327)
* Update Python packages

* fix opendbc

---------

Co-authored-by: Vehicle Researcher <user@comma.ai>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2024-08-19 15:25:05 -07:00
Shane Smiskol ee9977df2f card: fix memory leak from nested function scoping (#33328)
* stash

* no other leaks! pm.send grows memory usage by ~20mb but that's it

* undo

* clean up
2024-08-19 14:27:50 -07:00
Adeeb Shihadeh 08f64ae30a update test 2024-08-19 14:19:12 -07:00
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 1eda5f4736 car: move conversions.py into common/ 2024-08-16 15:53:37 -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
Kacper Rączy 51fae363e4 paramsd: remove usages of llk nested structures (#33317)
* Remove usages of llk nested structures

* Rename to debugFitlerState

* Semicolon

* Initial parameters debugFilterState
2024-08-16 14:25:42 -07:00
Shane Smiskol e6b2996478 test_fw_fingerprint.py: fix RAM HD test 2024-08-16 01:00:26 -07:00
Shane Smiskol a255b8043a ecu_addrs.py: fix function argument typing 2024-08-16 00:58:53 -07:00
Shane Smiskol c9f9eba614 card: fix return signature for update_events 2024-08-16 00:56:31 -07:00
Shane Smiskol 6a5bbb261e fw_versions.py: mark raw in f-string 2024-08-16 00:38:28 -07:00
Shane Smiskol c2ab62c2b2 radard: remove redundant NoneType check 2024-08-16 00:37:31 -07:00
Shane Smiskol 207c77ea93 hyundai: test some feature detection (#33315)
test some feature detection
2024-08-16 00:30:11 -07:00
Shane Smiskol bce11e393f hyundai: declare type override of cruise_buttons 2024-08-16 00:26:40 -07:00
Shane Smiskol f6780fca2f toyota: pycapnp enum which should be called 2024-08-16 00:18:37 -07:00
Shane Smiskol b41f9f2dfe run_process_on_route.py: use zstd 2024-08-16 00:08:17 -07:00
Shane Smiskol d43bf89978 GM: remove basedir import (#33312)
* remove these exceptions

* whoop

* ahhh
2024-08-14 22:55:17 -07:00
Shane Smiskol 424b657376 docs: remove common import (#33310)
* add opcar

* fix references

* actually better to split this so opendbc will test docs conventions, and openpilot will test diffing

* not exe

* clean up
2024-08-14 20:29:14 -07:00
Shane Smiskol 9d0180ca97 body: remove controls import (#33309)
* body uses car's PIDController

* use a simple version
2024-08-14 20:27:53 -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
Shane Smiskol bcfb50d98c Copy kalman filter to selfdrive/car (#33307)
move to car/common/ and give proper names
2024-08-14 18:10:11 -07:00
Kacper Rączy c61d504516 ui: remove GPS status from the sidebar (#33304)
* Remove usage of llk in ui

* Remove GPS from sidebar

* Remove it from test
2024-08-14 15:52:47 -07:00
Shane Smiskol b9dec5e3b5 rm tesla (#33300)
* rm tesla

* more rm

* ugh we should remove dynamic imports soon
2024-08-14 15:06:00 -07:00
Maxime Desroches 585f362738 lint.sh: better shebang lint (#33296)
-e
2024-08-14 11:34:52 -07:00
Shane Smiskol 7248b00086 Common CI._update function (#33289)
* use CP

* no car control, consistent _update function signatures

* eh it's fine to name it whatever

* clean up

* oops

* !!

* now we can delete this!

* nobody does anymore
2024-08-13 22:59:25 -07:00
Shane Smiskol cb61d0045c card: set mock carState fields (#33294)
* mock carstate inside card

* not used
2024-08-13 22:48:55 -07:00
Shane Smiskol 9f14c447db Move buttonEvents to CarState (#33292)
* move mazda button events to carstate

* do  more

* remove

* some more

* clean up
2024-08-13 22:30:46 -07:00
Shane Smiskol 29882b4519 Consistent spacing in car interfaces (#33293)
* formatting

* fix these

* not these
2024-08-13 22:08:48 -07:00
Shane Smiskol d65e1d9500 fix static analysis 2024-08-13 21:28:06 -07:00
Maxime Desroches 1dcd660815 fix bash + python3 shebangs (#33287)
fix shebangs
2024-08-13 21:22:13 -07:00
Shane Smiskol 65fccbf756 Car interface clean up (#33290)
* remove some defs

* now carstate

* remove carControl from CI update function

* almost merged that

* and that
2024-08-13 21:16:39 -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 cf39cc823a Move events out of car interfaces (#33280)
* chrysler down

* honda and ford

* we can pass the class for this

* do the rest

* clean that up

* remove EventName

* fix CI

* move smallest bodies to top

* rm todo

* eps_timer_soft_disable_alert is too ingrained in carcontroller

* re-did everything w/ no diff (except just passing cereal instead of class)
2024-08-13 20:40:36 -07:00
Shane Smiskol 3d2fbe9aa3 interfaces: assume CarState is instantiated (#33284)
test to make sure mock doesn't crash!
2024-08-13 19:36:21 -07:00
Shane Smiskol 90ce7781f4 fix fingerprint debug scripts (#33277)
* fix fp debugging

* fix these
2024-08-12 15:41:08 -07:00
Shane Smiskol 4618e8c124 [bot] Fingerprints: add missing FW versions from new users (#33276)
Export fingerprints
2024-08-12 12:41:14 -07:00
Shane Smiskol 7ec9986340 carState: add invalid sensors field (#33266)
* add to CS

* add vehicleSensorsInvalid to CarState

* fix ord

* clean up
2024-08-11 23:12:42 -07:00
Shane Smiskol 4e122ed2d1 remove map from ui preview (#33265)
* rm map from ui preview

* fix
2024-08-11 21:54:40 -07:00
Shane Smiskol 093c09a737 move the body events to card (#33262)
* move the body events to card

* rm import
2024-08-11 20:25:08 -07:00
Shane Smiskol d330358728 Revert "spinner: fix missing colon in QProgressBar border style" (#33263)
Revert "spinner: fix missing colon in QProgressBar border style (#33258)"

This reverts commit 85d8d0eddd.
2024-08-11 20:24:43 -07:00
Shane Smiskol 2dab8b31f2 Fix some car typing (#33256)
* ??

* fix these

* more typing and some fixes

* fix

* rm this for now

* fix
2024-08-11 19:12:46 -07:00
Dean Lee 85d8d0eddd spinner: fix missing colon in QProgressBar border style (#33258)
fix border style
2024-08-11 10:22:52 -07:00
Shane Smiskol ee62b9c88b move capnp CarParams decoding out of car_helpers (#33251)
* move capnp byte decoding out of car_helpers

* always wanted to type this

* and process replay

* this does nothing

* might as well
2024-08-10 00:06:56 -07:00
Shane Smiskol 4300f37cc4 Honda: round minEnableSpeed correctly (#33250)
round to even
2024-08-09 23:42:40 -07:00
Hoang Bui c06d975ec4 tools/sim: resolve import error on MacOS running Metadrive (#33244)
fix dynamic lib linking on mac
2024-08-09 23:12:40 -07:00
Dean Lee ad33cae40e pandad: move getenv check to global scope (#33235)
move getenv check to global
2024-08-08 08:45:03 -07:00
Shane Smiskol 9880b1393c selfdrive/car: generic CAN send/receive callbacks (#33215)
* start

* hmm API doesn't seem great

* better

* rm line

* sendcan -> can_send callable for best static type coverage, list -> tuple msg

TODO: logcan

* more sendcan -> can_send references

* remove pandad's capnp from selfdrive/car

* fix and remove cereal from test_can_fingerprint

* test_fw_fingerprint: remove pandad, less cereal

* comment done too

* better comment

* fix test_models test

* niceeee it works

* move to can_definitions

* can't come up with a better name :(

* I think we can remove SimpleNamespace soon

* fix test_can_fingerprint.py

* maintain previous behavior

* Revert "maintain previous behavior"

This reverts commit f848fd32132391692c6191a305bb38f74091ec91.

* can test comment

* no need for get_one_can now!

* big clean up: no SimpleNamespace

* now self explanatory!

* not needed

* use empty can again since this is now real

* cmt
2024-08-07 23:49:25 -07:00
Shane Smiskol 87f183f43c CAN fingerprinting: count empty CAN packets as frames (#33232)
* content of can packet won't affect can fingerprint time

* remove get_one_can

* fix comment

* actually we still want to be able to send empty can (xx fingerprint func does this if it runs out of msgs)

* fix process replay
2024-08-07 23:12:47 -07:00
Shane Smiskol bd4f0cec18 selfdrive/car: rm make_can_msg (#33231)
* rm make_can_msg

* fix
2024-08-07 21:58:16 -07:00