Commit Graph

548 Commits

Author SHA1 Message Date
Adeeb Shihadeh
7f6ef7cd00 fix flashing H7 in bootstub + tests (#1007)
Co-authored-by: Bruce Wayne <batman@comma.ai>
2022-08-02 22:28:54 -07:00
Robbe Derks
6bdf249d03 Dynamic sector erase (#1006)
* dynamic sector erase

* fix red panda flash

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-08-02 21:58:56 -07:00
Adeeb Shihadeh
fe3ad834c6 improved HITL test reliability (#897)
* improved HITL test reliability

* little more

* revert that

* little speedup

* some speed up

Co-authored-by: Bruce Wayne <batman@comma.ai>
2022-08-02 17:05:47 -07:00
Adeeb Shihadeh
4b86b83991 Subaru: support Outback and Global Gen 2 (#991)
* Subaru: support Outback and Global Gen 2

* send 0x321

* check bus

* fwd that

* gen2 limits

* lower max steer

* update safety replay route
2022-07-29 20:44:41 -07:00
Igor Biletskyy
4c433e6d47 CAN flasher: add timeout to CanHandle on transmit (#1001)
add timeout to canhandle
2022-07-25 20:23:16 -07:00
Cameron Clough
3a17c2e07f Ford: add safety code for LCA vehicles (#966)
* Ford: add CAN messages and signal definitions

* Ford: implement safety hooks

* Ford: add safety unit tests

* Use standstill signal

* Rename bus

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

* Simplify brake pressed

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

* Ford LKAS msg helper

* Simplify button violation check

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

* Simplify LKAS action check

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

* Tidy up tests

* Use standstill signal for tests

* Misra fix

* Unused definition

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

* Simplify signal bit shifting

* Remove type hints

* Add panda safety type hints

* Fix vehicle moving signal

* Fix button checks

* Fix steer allowed tests

* Fix standstill threshold in tests

* Maybe this works?

* More button tests

* Revert "Simplify button violation check"

This reverts commit c6496269844328a007ea52b5766501d7c1ea40c2.

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-07-23 16:54:58 -07:00
Adeeb Shihadeh
a1686ca3ca safety tests: use can packer for counters (#995)
* safety tests: use can packer for counters

* bump opendbc
2022-07-21 18:50:42 -07:00
Adeeb Shihadeh
1dfee5973b Subaru: cleanup counter handling (#992) 2022-07-19 17:18:42 -07:00
Jason Young
4ce5b5a44d VW PQ: Updated safety test checksum and counter handling (#964)
* VW PQ: Updated checksum and counter handling

* bump opendbc for Docker/CI
2022-07-15 10:49:34 -07:00
Adeeb Shihadeh
2abeab913f EV6: reject fake cruise engagements (#987)
* EV6: reject fake cruise engagements

* bump opendbc

* update comment

* raise to 8

* add addr check
2022-07-12 17:42:13 -07:00
Adeeb Shihadeh
baecd2ecc6 Chrysler: increase Ram rate limits (#981) 2022-07-11 15:01:35 -07:00
Adeeb Shihadeh
ca927fe931 EV6: allow TX of 0x2a4 (#983)
* EV6: allow TX of 0x2a4

* don't fwd
2022-07-08 22:08:54 -07:00
Adeeb Shihadeh
53466f0934 Chrysler: allow resume button (#980) 2022-07-06 23:43:56 -07:00
Adeeb Shihadeh
fae3ee2e81 Chrysler: Ram 1500 support (#969)
* RamInit

* Some fixes

* ram param

* cleanup steering

* invert

* couple fixups

* tests pass

* check that

* misra fixes

* same limits

* revert that

* remove those

Co-authored-by: Jonathan <jraycec@gmail.com>
Co-authored-by: Shane Smiskol <shane@smiskol.com>
2022-07-06 22:50:29 -07:00
Adeeb Shihadeh
6c0d0b43c2 Chrysler: update tests after DBC updates (#979)
* Chrysler: update tests after DBC updates

* lil cleanup
2022-07-05 16:33:12 -07:00
Adeeb Shihadeh
2652453892 EV6: adjust steering thresholds (#972)
* EV6: match max torque of rest of Hyundais

* update tests

* adjust that

* Apply suggestions from code review

* Update test_hyundai_hda2.py
2022-06-23 13:41:22 -07:00
Shane Smiskol
4bc85ad40a Chrysler: use correct engaged bit (#973)
* use new engaged bit

* fix msg name

* update signal

* update opendbc ref
2022-06-22 14:46:25 -07:00
Shane Smiskol
515df2bb72 Chrysler: use universal gas and brake signals (#970)
* RamInit

* just gas and brake changes

* unsigned

* fix tests

* bump openpilot version (TEMP)

* misra

* system

Co-authored-by: Jonathan <jraycec@gmail.com>
2022-06-16 21:49:22 -07:00
Shane Smiskol
3dbd30864e Honda Civic 2022 (radarless): car safety (#942)
* civic 2022

* remove

* maybe not the right way

* Honda Radarless: add tests

* update

* different bus

* other bus

* Revert "other bus"

This reverts commit 691e045f8724e57f135ad8d1683e83acbc16b91f.

* add new HUD message

* add

* different bus

* correct freq

* small updates

* comma

* remove

* remove for now

* missing

* not needed

* make into a safety param and clean up

* this can be reverted

* clean up tests (something's broken)

* fix some errors

* this message doesn't exist on any bus

* this car doesn't have BRAKE_MODULE

* make safety more explicit and fix button safety

* fix some tests

* fix tests

formatting

clean up

* radarless uses SCM_FEEDBACK too

* fix tx msgs, clean up, make test common between bosch tests

* misra

* Fix python linting errors

add comment

* not sure where that came from

* add comments

add comments

* we can guarantee honda_bosch_long is true only if not radarless

* these are the same! 🎉

* use updated route with correct tx msgs

* helper pt bus function

* this is explained above

* use function

* no more blocked messages!

* bump openpilot

* comment

* line too long

* needs system

* send on bus 0

* Camera needs bus 2 for buttons

This reverts commit f90db5d359c1c952de87ea4a2127ae599306e729.

* fix button tests

* bump openpilot

* move this down

* make this explicit

* comments

Co-authored-by: vanillagorillaa <ntmccoy@yahoo.com>
Co-authored-by: vanillagorillaa <31773928+vanillagorillaa@users.noreply.github.com>
2022-06-16 19:02:44 -07:00
Shane Smiskol
6c1738814b safety replay: set alternative experience (#961)
* Set alternative experience in safety replay

* fix

* smaller clean up diff
2022-06-13 10:59:27 -07:00
Jason Young
475a9a3124 fix CANPackerPanda counter state init (#956) 2022-06-02 11:18:46 -07:00
Shane Smiskol
d967a6b504 safety tests: use base class for common driver steering torque tests (#950)
* rename to torque_cmd_msg

* Move most of the driver torque tests into common.DriverTorqueSteeringSafetyTest

* fix static analysis so far

* HDA2 just works

* TODO: Subaru

* Subaru

* Move Mazda steering constants into class

* rm line

* split into classes

* move test_against_torque_driver into common driver torque tests

* rename to match all other tests

* fix linter

* revert changes
2022-05-25 22:51:33 -07:00
Shane Smiskol
583d3a0c7b Mazda: fix steering safety and add tests (#952)
* fix steering safety and add tests for mazda

* fix steering safety and add tests for mazda
2022-05-25 22:19:18 -07:00
Shane Smiskol
6117c381f2 safety tests: create classes for common torque steering tests (#951)
* Create base class for common steering tests (motor/driver)

* fix class name
2022-05-25 19:24:55 -07:00
Shane Smiskol
dff5e6ed31 Hyundai: check CF_Lkas_ActToi bit (#947)
* Hyundai: check steer request bit

* add tests (should make common with Toyota in the future)

* fix comment
2022-05-25 11:36:59 -07:00
Shane Smiskol
6d19b46ef5 GM: revert back to brake threshold (#949)
Revert "GM: change from brake threshold to Brake_Pressed bit (#846)"

This reverts commit 3bd3ae885a.
2022-05-20 19:41:26 -07:00
Adeeb Shihadeh
62f709afd4 fix missing CAN-FD safety modes 2022-05-19 16:55:53 -07:00
Willem Melching
36c62afa0c Kia EV6 (#905)
* block lkas

* taco time

* local changes

* start

* tx checks

* counter + vehicle moving

* support big can fd

* check crc

* add torque to rx checks

* tests

* little more

* little more

* get some misra coverage

Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-05-19 15:59:58 -07:00
Shane Smiskol
36ccbd56fa Toyota: check STEER_REQUEST bit (#940)
* check steer_req

* think this is clearer on first glance

* add test

* also test recovery

* Update tests/safety/test_toyota.py

* Update tests/safety/test_toyota.py

* move
2022-05-16 12:20:31 -07:00
Robbe Derks
893a81aa82 Tesla: allow forwarding of stock AEB (#937)
* allow forwarding of stock AEB

* misra fix
2022-05-16 13:12:14 +02:00
Adeeb Shihadeh
69215887dc safety: prep for CAN FD (#943) 2022-05-15 23:46:04 -07:00
eFini
297cdb27ef Toyota: forward ACC messages if stock longitudinal (#934)
* do not block 0x343 if toyota_stock_longitudinal set to true

* Update board/safety/safety_toyota.h

* Update board/safety/safety_toyota.h

* Update tests/safety/test_toyota.py

* Update tests/safety/test_toyota.py

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2022-05-14 01:08:32 -07:00
Willem Melching
d5bd81e5b5 fixes for mypy check for return-any 2022-05-12 14:22:58 +02:00
Shane Smiskol
1d2127876d Hyundai: use GET_BIT and fix safety on incorrect bit (#933)
* use GET_BIT where possible

* fix test to catch this
2022-05-11 22:36:53 -07:00
Shane Smiskol
eb662e4e50 Make safety param uint16_t (#931)
* change safety param to uint16_t

* accidental paste
2022-05-02 13:36:19 -07:00
Shane Smiskol
326cc2a8db Toyota: stock longitudinal safety (#927)
* safety for non-longitudinal

* flip around param for easily replaying old logs on new panda

* fix misra: a function parameter should not be modified

* safety

* the toyota tests all share common messages

* fixup tests

* update comment

* same as tesla test

* check if subset

* update comments

update comments
2022-04-28 22:29:29 -07:00
Adeeb Shihadeh
d031d6e283 Toyota: add safety param flag for alt brake message (#925)
* Toyota: add safety param flag for alt brake message

* fix misra

* Update board/safety/safety_toyota.h
2022-04-27 11:31:24 -07:00
Shane Smiskol
bb2aea1ac6 Hyundai: enforce recent button press to allow controls with PCM (#923)
* add safety for hyundai stock long button-only enable

* add full logic, use 4 frames of button samples

* comment above and in openpilot is enough explanation

* make misra happy

* add tests

* add comments and better variable names

* only check button values on rising edge of PCM ACC enable

* common function

* Revert "common function"

This reverts commit 81e642ca987b76d8353003f7f622a1bec5003713.

* simplify: keep track of last interaction instead

* revert changes to sample_t

* make unsigned

* clip to max and use uint8

* start at 4

* consistent

* apply suggestions

* Update board/safety/safety_hyundai.h

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

* unify function

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-04-26 11:45:09 -07:00
Shane Smiskol
ee9ef693a1 Revert "Hyundai: enforce recent button press to allow controls with PCM (#917)"
This reverts commit 9a91323c04.
2022-04-26 02:07:53 -07:00
Shane Smiskol
9a91323c04 Hyundai: enforce recent button press to allow controls with PCM (#917)
* add safety for hyundai stock long button-only enable

* add full logic, use 4 frames of button samples

* comment above and in openpilot is enough explanation

* make misra happy

* add tests

* add comments and better variable names

* only check button values on rising edge of PCM ACC enable

* common function

* Revert "common function"

This reverts commit 81e642ca987b76d8353003f7f622a1bec5003713.

* simplify: keep track of last interaction instead

* revert changes to sample_t

* make unsigned

* clip to max and use uint8

* start at 4

* consistent

* apply suggestions

* Update board/safety/safety_hyundai.h

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

* unify function

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-04-25 18:57:02 -07:00
Shane Smiskol
7dd9493eb1 safety_param: change to unsigned (#910)
* make safety_param unsigned

* final one

* uint32_t

* change flags as well

* Revert "change flags as well"

This reverts commit ed8897dd86b0dbfc80e6b8633f36d80c9bc91052.

* unsigned

* update health packet version

update health packet version

* update struct H->I

* bump health version

* actually used
2022-04-20 23:25:03 -07:00
Shane Smiskol
a1d97f9a0b Toyota: fix interceptor pressed mismatch (#919)
* change to openpilot threshold

* add interceptor comments

* fix test threshold
2022-04-20 22:20:24 -07:00
Shane Smiskol
c925407461 Honda: fix interceptor pressed mismatch (#915)
* update panda interceptor gains

* update test threshold

* update threshold

* don't divide second track by 2 (?)

* fix test

* we don't divide by 2 anymore

* better wording

* remove value

* bump PR

* no 1e-5
2022-04-12 10:59:05 -07:00
Robbe Derks
cc0fdffee6 Calculate interrupt load and add to health packet (#913)
* calculate interrupt load

* forgot to change this

* being cautious about overflows

* utils

* fix bootstub

* cleanup

* also exclude pedal

* fix misra

Co-authored-by: Comma Device <device@comma.ai>
2022-04-11 11:59:47 +02:00
Shane Smiskol
81246fdac1 move alternative experience class to python module (#909)
* move alternative experience class to common python module

* same formatting
2022-04-04 18:49:56 -07:00
Shane Smiskol
6a4daee044 safety: disallow longitudinal actuation while gas is pressed (#884)
* test implemented for Toyota

* fix Toyota interceptor

* use hasattr

* do Honda (still need Nidec ACC_HUD safety)

* add longitudinal_allowed to ACC_HUD (Nidec w/ no pedal

* rx not needed

* add base test for longitudinal

* update name

* stash

* do GM

* use gas_pressed_prev

* do tesla safety

* add full tests

* add get_longitudinal_allowed for simpler tests

* remove unnecessary tests and revert honda/hyundai

* fix honda after revert

* make sure releasing gas allows longitudinal again

* clean up

* clean up

* Just check longitudinal allowed

* don't need to reset detection

* use prev and add brake detection

* only on gas

* make sure we don't change current_controls_allowed braking behavior

* clean up tests

* use current_controls_allowed for honda & GM

* this is pretty much tested in common

* fix up tests and move common tests

* revert

* better place

* add for body
2022-04-01 19:54:40 -07:00
Shane Smiskol
94bfed6d28 safety tests: rename interceptor message functions (#900) 2022-04-01 19:14:41 -07:00
Adeeb Shihadeh
560bcc4063 body: add RX checks (#903)
* body: add RX checks

* add that
2022-03-31 15:58:54 -07:00
Shane Smiskol
79145f9e5f safety tests: rename gas/brake message functions (#893)
* _brake_msg and _gas_msg were confusing

* use class inheritance to define test specific safety variables

* Revert "use class inheritance to define test specific safety variables"

This reverts commit 734efd96f3f66c2cff62674a6510c1c4b08f22cd.

* common function to set up each test

fix honda

* Revert "common function to set up each test"

This reverts commit fe4e71b3c64c6dd9717ea4f188abef7114cbfce8.

* rename related function

* formatting

* consistent name

* revert this change
2022-03-28 13:13:27 -07:00
Shane Smiskol
31d70299ae Tesla: add longitudinal controls allowed safety (#890)
* no long actuation if controls not allowed

* comment (bump)

* don't compare floats

* tesla longitudinal test

* clean up

* forgot all

* update constant

* fix
2022-03-28 13:03:07 -07:00