Commit Graph

93 Commits

Author SHA1 Message Date
Shane Smiskol
4f019b5f60 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
old-commit-hash: e735a7f379
2024-08-17 00:54:51 -07:00
Shane Smiskol
95224db413 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
old-commit-hash: 6a15c42143
2024-08-16 15:13:00 -07:00
Shane Smiskol
915524d408 Copy kalman filter to selfdrive/car (#33307)
move to car/common/ and give proper names
old-commit-hash: bcfb50d98c
2024-08-14 18:10:11 -07:00
Shane Smiskol
e46d96bb11 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)
old-commit-hash: cf39cc823a
2024-08-13 20:40:36 -07:00
Shane Smiskol
c1084b3df3 selfdrive/car: rm make_can_msg (#33231)
* rm make_can_msg

* fix
old-commit-hash: bd4f0cec18
2024-08-07 21:58:16 -07:00
Shane Smiskol
7f4f1d4c5f make_can_msg: returns tuple (#33222)
* bump

* make_man_msg returns tuple

* fix CI.update typing

* bump

* better name

* Revert "better name"

This reverts commit 4deb38d4ed99e43721960f69da1dd46a1069eb42.

* common
old-commit-hash: 51bd368214
2024-08-07 16:12:00 -07:00
Shane Smiskol
d8f56b30b5 selfdrive/car: ban common (#33210)
* ban all of common & copy numpy_fast

* add numpy_fast

* these are okay

* and ban controls

* better name

* Conversions

* do utils, kalman

* clean up

* sorting

* don't forget
old-commit-hash: 8d961a12e5
2024-08-06 20:45:11 -07:00
Shane Smiskol
cfc2cda37c separate car logger forwarded to cloudlog (#33170)
* car logger

* try this

* fix double printing!

* clean up

* need to import where we actually use it (card won't be in submodule)

* NullHandler does not forward everything properly, need propagate=False to stop root logger from printing

* card is staying

* set up

* forward
old-commit-hash: 12a7b7f7fb
2024-08-05 12:31:31 -07:00
Shane Smiskol
5cc7d1c36b deprecate busTime (#33146)
* deprecate busTime

* bump

* do car can + more

* forgot some

* bump opendbc

* fix that too

* bump
old-commit-hash: 42f2601416
2024-07-30 21:26:58 -07:00
Shane Smiskol
7b724ed243 tester present msgs: use helper (#33147)
use helper
old-commit-hash: b6d124d268
2024-07-30 18:09:22 -07:00
Shane Smiskol
2cb381997f cars: remove some external imports (#33133)
* ford and gm

* clean that up

* also this

* honda

* temp fix

* move into selfdrive.car

* clean up

* more
old-commit-hash: 0739d79a51
2024-07-30 14:27:27 -07:00
Shane Smiskol
e8c4fb0177 Reapply "selfdrive/car: ban imports from external modules" (#32993) (#32994)
* Reapply "selfdrive/car: ban imports from external modules" (#32993)

This reverts commit 626d78ec548fe19acfdf3c2c3e063fac3b257dc6.

* controls will just use controls

* also these

* ignore
old-commit-hash: d684d8f0f6
2024-07-15 11:59:25 -07:00
Shane Smiskol
a878118b00 Revert "selfdrive/car: ban imports from external modules" (#32993)
Revert "selfdrive/car: ban imports from external modules (#32973)"

This reverts commit c1e8ff2dbc47ccb07fb41a4e88bfb66af2669254.
old-commit-hash: 35a4a773f1
2024-07-15 11:14:04 -07:00
Dean Lee
58df39a2ba selfdrive/car: ban imports from external modules (#32973)
* lint import

* Update selfdrive/car/__init__.py

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
old-commit-hash: 83d4623590
2024-07-15 11:12:24 -07:00
Shane Smiskol
43cac3cf24 PlatformConfig: clean up and print all flags (#32369)
* script to print flags

* don't need

* SAL

* back

* fix
old-commit-hash: f597d63bf6
2024-05-07 15:00:02 -07:00
Shane Smiskol
43c72d410d Platforms: less redundant string repr (#32233)
smol
old-commit-hash: 3d0f9fb18f
2024-04-16 23:37:46 -07:00
Adeeb Shihadeh
fcbce3d8f6 cleanup pedal crc
old-commit-hash: 23e8ad7397
2024-03-20 10:35:33 -07:00
thenhnn
77d6d1a8f1 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>
old-commit-hash: 489528dcae
2024-03-19 11:16:02 -07:00
Adeeb Shihadeh
3bf3f4bf78 remove pedal (#31903)
* remove pedal

* bump panda

* fix

* update refs
old-commit-hash: fa12a67228
2024-03-17 22:42:49 -07:00
Justin Newberry
4de27acf3d more car info -> car docs (#31885)
old-commit-hash: 0b92f4e9ee
2024-03-17 16:53:57 -07:00
Justin Newberry
5a7de94a13 rename CarInfo to CarDocs (#31879)
car info to car docs
old-commit-hash: 655e5f7c3e
2024-03-15 11:45:44 -07:00
Shane Smiskol
60f0948fba docs: don't support multi-type car info (#31875)
don't support multi-type car info
old-commit-hash: bdae188c6f
2024-03-15 00:11:41 -07:00
Shane Smiskol
b286b84044 Revert "common PlatformFlags base class + test for < 32 bits" (#31793)
Revert "common PlatformFlags base class + test for < 32 bits (#31779)"

This reverts commit 7e75a99b03be1289aa515894e81caa1138374a38.
old-commit-hash: 99610c8819
2024-03-08 00:15:21 -08:00
Justin Newberry
fd2a03b1c2 common PlatformFlags base class + test for < 32 bits (#31779)
* add 32 bit check

* space

* this is not required

* jk yes we do
old-commit-hash: 8ba5d660f3
2024-03-07 14:01:28 -08:00
Justin Newberry
e6dbf6d614 cars: remove CAR_INFO map (#31739)
* no carinfo map

* smaller diff

* not on mock
old-commit-hash: 25ccb2426c
2024-03-06 11:22:12 -08:00
Justin Newberry
e9ca84c95c 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
old-commit-hash: b0eae8c1b7
2024-03-01 11:31:51 -08:00
Justin Newberry
9b6963a00d Hyundai: move car specs to platformconfig (#31661)
* specs

* override

* fixes 1

* fix 3

* fixes 4

* fixes

* fixes

* fixc

* fix number 723124

* that too

* fixes

* aa
old-commit-hash: 2e0db7f8d8
2024-03-01 10:31:43 -08:00
Shane Smiskol
2ac06e8d7d Toyota: use platform config (#31607)
* part 1. Toyota platform config

* more

* everything works now

* no more DBC

* janky but that saves a lot of car lines

* need to init inside values or else it won't be reliable

* no return

* fixes

* minor update

* common flags, no dbc grouping

* some clean up

* some clean up

* rename

* copied wrong :(

* another

* copied specs for easiest ones first

* second easiest

* fix erroneous commas

* more clean up

* do the rest

* bug

* the refactor is so error prone

* huh?!

* static

* fix stiffness factor

* detect unsupported DSU

* Revert "detect unsupported DSU"

This reverts commit 9b72de6c8ef282ce20f6472970874a960761884b.

* fix DBC diff

* test carparams

* test sets

* scratch

* catches this

* Revert "scratch"

This reverts commit de08daa9fb8cc0368c5847b669e87b1b2e577616.

* Revert "test sets"

This reverts commit 62402f9b021cdf16a27fd9fb0883d81169711cbd.

* Revert "test carparams"

This reverts commit b02971659c2a8268d0ac8fdff02231dc36b5a197.

* Update ref_commit
old-commit-hash: 52ee070fe0
2024-03-01 02:14:33 -08:00
Justin Newberry
0ffb29accd HKG: move to platform config (#31649)
* fuck me!

* that kinda makes things pretty nice

* move it down

* and move this comment

* Wip

* more flags :/

* add the debug shit

* add

* lets not break this yet

* MORE flags git add .git add .git add .git add .!

* B

* add mando

* update ref

* possibly better?

* we can use flags here

* formatting

* formatting

* move up

* canfd subclass

* this is more clear

* spacing

* static!

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
old-commit-hash: e341707b0f
2024-02-29 17:04:54 -08:00
Justin Newberry
b3bb450e4a add CAR.print_debug (#31652)
print debug
old-commit-hash: ac16c5518a
2024-02-29 15:01:47 -08:00
Justin Newberry
1a5b057983 Honda: move to platformconfig (#31637)
* first

* Fixes

* not

* not

* Fixes

* fix

* cleanup + use sets for now

* update ref

* update ref
old-commit-hash: 5734d7c2bf
2024-02-29 11:29:40 -08:00
Justin Newberry
b17981eced carspecs: add more units (#31646)
more units
old-commit-hash: f775faf26d
2024-02-29 10:42:11 -08:00
Shane Smiskol
d8c7b75973 Platform config small cleanup (#31638)
no field, label mass, correct spacing
old-commit-hash: 85150c0289
2024-02-28 23:54:41 -08:00
Justin Newberry
9ccd7f15f9 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
old-commit-hash: 3a6c3315ab
2024-02-28 20:12:14 -08:00
Justin Newberry
3321dfe90b Nissan: move to platform config (#31599)
* do nissan

* cleanup + fix
old-commit-hash: d3f0f76a7e
2024-02-27 10:16:06 -08:00
Justin Newberry
d6f9e2c805 platformconfig: freeze all dataclasses (#31605)
* frozen

* frozen
old-commit-hash: 9ecff49118
2024-02-26 21:16:05 -08:00
Eric Brown
0f78a52a22 GM: move to platform config (#31553)
* subaru platform config

* forester wrong dbc

* spacing

* subaru car specs

* someday!

* more red diff

* Move GM to platform config

* Implement CarSpecs

* Simplify centerToFront

* Accidentally had subaru DBC

* Fix typo in DBC name

* done above

* two spaces

* that is moved up

* fix hardcoded fingerprints

* whitespace

* values

* better?

* fix

* bump

* fix

* fix

---------

Co-authored-by: Justin Newberry <justin@comma.ai>
old-commit-hash: 5012e15aa6
2024-02-25 17:53:26 -08:00
Jason Young
5cb007daf3 VW: Move car specs to PlatformConfig (#31567)
* subaru platform config

* forester wrong dbc

* spacing

* subaru car specs

* someday!

* more red diff

* all brands can be done like this

* but this should be done first and thats subaru specific

* that seems very low but we shouldn't change it here

* as long as it subclasses str its fine

* well that sucked

* cleanup and follow refactor

* diff reduction

* oops

* fix

* force fingerprint

* Revert "force fingerprint"

This reverts commit 600fbcd7d559703601a06c8876a640de417e5b6c.

* space

* Fix specs

* this one too

---------

Co-authored-by: Justin Newberry <justin@comma.ai>
old-commit-hash: da540eac13
2024-02-25 17:38:17 -08:00
Cameron Clough
9bd90112d0 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
old-commit-hash: 995250ae49
2024-02-24 16:41:23 -08:00
Justin Newberry
c564806520 Subaru: move carspecs to PlatformConfig (#31550)
* subaru platform config

* forester wrong dbc

* spacing

* subaru car specs

* someday!

* more red diff

* all brands can be done like this

* but this should be done first and thats subaru specific

* that seems very low but we shouldn't change it here

* as long as it subclasses str its fine

* fix
old-commit-hash: 1161d33c18
2024-02-23 13:23:40 -08:00
Justin Newberry
3d5b7dadaf cleanup PlatformConfig (#31551)
cleanup
old-commit-hash: 73a497ded8
2024-02-22 17:49:27 -08:00
Justin Newberry
351b1e1f5f cars: introduce "platformconfig" to be a configuration for all relevant car information (#31542)
* this is decent

* make sure the docs don't change for now

* hackery

* these can live here
old-commit-hash: 1ee8c9aa33
2024-02-22 15:58:37 -08:00
Adeeb Shihadeh
952ca664fa Update Python packages and pre-commit hooks (#29739)
* Update Python packages and pre-commit hooks

* fix linter

---------

Co-authored-by: adeebshihadeh <adeebshihadeh@users.noreply.github.com>
old-commit-hash: 9719b22761
2023-08-31 15:00:13 -07:00
Shane Smiskol
c5a673b998 car interfaces: handle buttons changing state without going unpressed (#26463)
* rename function first and foremost

* the function

* comment

* move usages over

* probably fine

* comments

* btn

* single line

* not comments

* fix keyword

* is it not clear?

* noEntry while holding cancel

* bumpo

* remove

* better?

* better?

* try this

* try this

* loop

* better

* more clear

* Revert "more clear"

This reverts commit 37e0277e4bfe6f1c553dbbcece6f532a280be62e.

* no optional

* fine

* add comment

* clean up honda

* one line

* can also do this

* but unclear

This reverts commit 1984a72cc8680b23c202695b8aeeb1aa28f7160c.

* bumppanda
old-commit-hash: 24f5a6170d
2023-08-25 16:47:10 -07:00
Shane Smiskol
fca565cad1 car/__init__: missing ending newline
old-commit-hash: ed6e72ae1f
2023-08-25 00:43:29 -07:00
Adeeb Shihadeh
16ec56398c add openpilot prefix to imports (#29498)
* add openpilot prefix to imports

* more

* more

* fix docs

* fix linter

* bump submodules

* fix patched tests

* update dynamic imports

* debug

* Revert "debug"

This reverts commit db5e13b9911cc74438bee123bc3430da6c31b24b.

* fix pm test
old-commit-hash: a9626f95b6
2023-08-20 20:49:55 -07:00
Shane Smiskol
183515c04b Rename CivicParams (#29459)
* CivicParams -> ReferenceCarParams

* remove usage in interface

* better name

* revert
old-commit-hash: 8dcd108972
2023-08-17 21:02:09 -07:00
Justin Newberry
268fb070a8 Subaru: calculate steering angle rate (#29409)
* calculate rate

* added adeeb's comment

* move to selfdrive/car

* that makes way more sense

* much simpler

* fix rate

* preglobal doesn't have a counter

* update ref

* merge

* update ref after merging
old-commit-hash: 7ec52da33a
2023-08-15 15:28:46 -07:00
Jason Young
b4614b3c28 car interfaces: cleanup tire stiffness calculation (#28263)
* cleanup tire stiffness calculation

* bump cereal

* think these todos still apply

* gm: same default

* revert comments

* bump

* update refs

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
old-commit-hash: 90c4bbe8e4
2023-08-15 14:17:08 -07:00
Shane Smiskol
6b7b6034b7 common_fault_avoidance: take a bool (#29328)
old-commit-hash: 2a38f38be1
2023-08-11 00:27:53 -07:00