Commit Graph

1078 Commits

Author SHA1 Message Date
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 81e642ca98.

* 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 81e642ca98.

* 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 ed8897dd86.

* 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 734efd96f3.

* common function to set up each test

fix honda

* Revert "common function to set up each test"

This reverts commit fe4e71b3c6.

* 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
Adeeb Shihadeh
7986b8b1e4 make safety replay nice 2022-03-25 20:00:44 -07:00
Shane Smiskol
8c7cb8c5b5 Honda Nidec: ACC_HUD safety (#889)
* Honda Nidec ACC_HUD safety

* probably what misra wants

* fix safety and add test
2022-03-25 14:29:18 -07:00
Shane Smiskol
7104818e14 rename unsafeMode to alternativeExperience (#878)
* alternative experiences

* not unsafe

* more renames

more renames

* not yet true

* I think we import from panda now

* update comments and test

* not needed

* bump health pkt version

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-03-24 14:31:31 -07:00
Adeeb Shihadeh
e01c64574c Toyota: increase torque rate limit (#887)
* Closer to HYUNDAI

* Change tests too

* Change MAX_RT_DELTA too

* Change test too

* Lower buffer to 20%

Co-authored-by: Harald Schafer <harald.the.engineer@gmail.com>
2022-03-23 13:48:49 -07:00
Shane Smiskol
0591f68008 Honda: fix missing interceptor tests (#886)
* setUpClass never did anything

* oh, comments work as pass?

* pass

* Update tests/safety/test_honda.py

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-03-22 14:34:05 -07:00
Adeeb Shihadeh
991638a3df Tesla: only allow cancel button (#880) 2022-03-20 22:00:19 -07:00
Adeeb Shihadeh
499906f324 Nissan + Tesla: don't exit controls allowed on blocked message (#877)
* Nissan + Tesla: don't exit controls allowed on blocked message

* update tests
2022-03-18 14:52:52 -07:00
Adeeb Shihadeh
ba10911dbc GM: enters controls on falling edge of button presses (#876)
* GM: enters controls on falling edge of button presses

* update test
2022-03-16 11:46:57 -07:00
Adeeb Shihadeh
868fd5386c Hyundai: enter controls on falling edge of buttons (#875) 2022-03-16 10:37:48 -07:00
Adeeb Shihadeh
4acaebb62b Honda: enter controls on falling edge of button presses (#874)
* Honda: enter controls on falling edge of button presses

* update tests

* little nicer with enum

* remove duplicate

* fix that

* reset on init

* add honda prefix
2022-03-15 21:42:41 -07:00
Adeeb Shihadeh
e6722c7f99 Honda Nidec: match openpilot engagement behavior (#872)
* Honda Nidec: match openpilot engagement behavior

* update tests
2022-03-15 15:19:54 -07:00
Adeeb Shihadeh
5a7af82f06 Hyundai: only allow cancel while cruise is enabled (#870) 2022-03-13 19:42:40 -07:00
Igor Biletskyy
891653fe31 Docker: bump openpilot and fix Toyota EPS scale factor for test (#869)
* new commit

* fix EPS scale for Toyota
2022-03-08 18:19:59 -08:00
Igor Biletskyy
860e5a4d21 Red Panda: auto switching to CAN FD with BRS (#868)
* add canfd autoenable

* add check to tests

* fix default speeds

* add autoswitch test
2022-03-07 14:25:19 -08:00
Igor Biletskyy
51ccb9fbd2 HITL tests: change testing speeds (#862) 2022-02-24 14:36:53 -08:00
Adeeb Shihadeh
cb88a1756b Honda: revert back to button enable for Nidec (#858) 2022-02-22 21:29:50 -08:00
Shane Smiskol
3bd3ae885a GM: change from brake threshold to Brake_Pressed bit (#846)
* GM: Use ECMEngineStatus.Brake_Pressed

* use get bit

Co-authored-by: Jason Shuler <jshuler@gmail.com>
2022-02-04 23:23:29 -08:00
Adeeb Shihadeh
c89c8db650 libpandasafety: cleanup addr checks 2022-01-30 12:32:58 -08:00
Adeeb Shihadeh
bdb591f5e6 Honda: fix controls mismatch for stock PCM configs (#840)
* Honda: fix controls mismatch for stock PCM configs

* start tests

* all tests

* fix pylint

* misra

* Update board/safety/safety_honda.h
2022-01-29 16:56:39 -08:00
Adeeb Shihadeh
293d3ee43d fix typo in libpandasafety_py.py 2022-01-28 15:41:54 -08:00