Commit Graph

61 Commits

Author SHA1 Message Date
Shane Smiskol
c0632cd32b GM: enable on rising edge of resume (#1157)
* rising edge of resume

* fix test

* comment

* todo fix tests

* fix test

* we want to test the transition from btn prev to btn cur, not unpressed to x to y

* range
2022-11-13 19:10:45 -08:00
Shane Smiskol
0096d0c4fc GM: handle run-away set speed (#1156)
* Revert "GM: enable on rising edge of resume (#1155)"

This reverts commit 5aa33e1b2f.

* allow set/resume to any other button (except cancel)

* explicit test

* This is a test of both PRs combined

* Revert "This is a test of both PRs combined"

This reverts commit c7fdc3b00c12da64763c371f8cf017faa0273b1d.

* fix test
2022-11-12 01:55:41 -08:00
Shane Smiskol
ff48ecc34e Revert "GM: enable on rising edge of resume (#1155)"
This reverts commit 5aa33e1b2f.
2022-11-12 01:47:13 -08:00
Shane Smiskol
5aa33e1b2f GM: enable on rising edge of resume (#1155)
* rising edge of resume

* fix test

* comment
2022-11-12 00:01:15 -08:00
Shane Smiskol
281eb7731b GM Camera: use ECM brake pressed bit (#1138)
* GM camera: use ECM brake pressed bit

* back to ECMEngineStatus

* length 8

* common gmcamera class

* move to longitudinal base

* Revert "move to longitudinal base"

This reverts commit 67abe4c86b0e5e00432ab0ab80a8db6061f3cc3e.

* fix
2022-11-08 20:17:02 -08:00
Shane Smiskol
8f7befa9bb GM: clean up safety classes (#1143)
* add PCM_CRUISE flag to GM safety tests (like safety code)

* pcm_status_msg

* rm 2
2022-11-08 19:50:11 -08:00
Jason Shuler
cf4aa6bb30 GM: longitudinal support for camera-integrated cars (#1014)
* Allow brake TX on PT bus

* Initial Panda GM cam harness support
 * Complete rewrite / simplification
 * Add param for cam harness (default is OBD2)
   - Forward btw 0 and 2
   - Filter LKAS and optionally ACC from cam
 * Add param for stock ACC
   - Allows ACC on PT bus when set, not otherwise
   - Allows ACC from cam when set, not otherwise
 * Add temporary WIP EPS timing workaround in ifdef

* Remove keepalive; regen == braking

* Fix MISRA violations

* EPS timing opt-in by param

* Minor clean up

* remove timing code for readability

fix and formatting

* we only need to send one message if cam harness and stock long

* Simplify params

* Removed dup brake msg

* revised params, split 3-ways

* add test

* clean up a bit, no need to send ACC yet

like this

* split out button enable and pcm enable into seperate tests

* some formatting

some formatting

* GM CAM uses PCM cruise for controls_allowed

* fix gas safety tests

* misra

* fix static analysis

comment

* fix brake pressed

* Add OP VOACC override stock cam

* Add VOACC safetyparam to init.py

* openpilot long safety

* do this in another PR

* add back

* add safety tests

* rename

* struct for safety

* not used

* temporary fault fix

* adjust max gas

* allow PSCMStatus in long mode

* stash

* fix max gas

* fix and clean up tests

* clean up longitudinal tests into a common class

* fix pylint

* subclass

* clean that up

* rm

* blocking

* comment

* comment

* lower case

* brake bus

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2022-11-01 00:58:18 -07:00
Shane Smiskol
494c5a403a GM Cam: pass on useless tests (#1122)
* pass

* Caps
2022-10-27 21:23:36 -07:00
Shane Smiskol
187fdee385 safety: remove pre-enable state (#1121)
* current_controls_allowed is now unused

* reduce diff

* remove from honda

* these test nothing

* fix
2022-10-27 17:51:20 -07:00
Shane Smiskol
2db69bc941 Revert "GM: different brake thresholds by platform (#1104)" (#1116)
This reverts commit 5962bcd08a.
2022-10-21 18:11:31 -07:00
Shane Smiskol
d51dd496cb GM: more longitudinal safety (#1115)
* seems cleaner

* abort struct

* fix

* add variable in test_gm (TODO: add tests)

* fix test for new safety

* cmt

* && -> ||
2022-10-21 00:20:01 -07:00
Shane Smiskol
54f9390ff5 GM: allow TX PSCMStatus message (#1111)
* forwarding

* add to tx msgs

* don't block

* Revert "don't block"

This reverts commit b1ca52f86d59500c6232df6afac97a51daf7bd51.

* fix forwarding tests

* comment

* add comment
2022-10-19 23:25:22 -07:00
Shane Smiskol
b95a65df58 GM: match ECM standstill check (#1105)
* match ECM check

* fix

* needs to be <= 10 to avoid a fault, fix for safety tests

* fix
2022-10-18 11:22:04 -07:00
Shane Smiskol
5962bcd08a GM: different brake thresholds by platform (#1104)
* Different brake pressed thresholds

* Update board/safety/safety_gm.h
2022-10-14 16:51:53 -07:00
Shane Smiskol
1303af2db2 GM: change brake pressed signal (#1089)
* Match openpilot brake check

* comment

* simple

* Update test

* doesn't take an int

* msg varies in size by platform

* 2 extra bytes of zeros on Escalade

* label platforms

* space
2022-10-07 16:10:09 -07:00
Shane Smiskol
9bcd9b9a24 GM: update max brake (#1087)
update max brake
2022-10-04 00:20:31 -07:00
Shane Smiskol
788e0b5ac9 GM: same regen check as openpilot (#1026)
* it was only checking a specific bit

* same check as openpilot

* reset on init

* unsigned

* should fix conflicts

* common

* comment

* Add missing function

* Tests

* the alternative is a mess

typo

typo

* draft

* finish common

* works but you need RegenSafetyTest before all other classes

* Revert "works but you need RegenSafetyTest before all other classes"

This reverts commit 256f3be9a86e2412220d473037d64b84167ae98d.

* This works too

* need parameterized, subtests nor super() calls correctly reset state

* Fix test and comment

* comment

* another fix...

* subclass

* ABC

* order

* fix static analysis

* can do this

* Revert "can do this"

This reverts commit 6bc63a345a2d63019a640092dd9538203e8b213d.

* this is nicer, no pylint errors

* Update tests/safety/common.py

* underscore

* dynamically detect and add tests

* simpler

* only for safety modes with a regen message

* check attr

* Revert "check attr"

This reverts commit bc37a7eedd2269bb3bc77d96762f0f0df6890991.

* need to check at test time not class init time
2022-09-12 21:32:06 -07:00
Jason Shuler
5e0dde7b48 GM: Add support for cam harness & stock ACC (#962)
* Allow brake TX on PT bus

* Initial Panda GM cam harness support
 * Complete rewrite / simplification
 * Add param for cam harness (default is OBD2)
   - Forward btw 0 and 2
   - Filter LKAS and optionally ACC from cam
 * Add param for stock ACC
   - Allows ACC on PT bus when set, not otherwise
   - Allows ACC from cam when set, not otherwise
 * Add temporary WIP EPS timing workaround in ifdef

* Remove keepalive; regen == braking

* Fix MISRA violations

* EPS timing opt-in by param

* Minor clean up

* remove timing code for readability

fix and formatting

* we only need to send one message if cam harness and stock long

* Simplify params

* Removed dup brake msg

* revised params, split 3-ways

* add test

* clean up a bit, no need to send ACC yet

like this

* split out button enable and pcm enable into seperate tests

* some formatting

some formatting

* GM CAM uses PCM cruise for controls_allowed

* fix gas safety tests

* misra

* fix static analysis

comment

* fix brake pressed

* Add OP VOACC override stock cam

* Add VOACC safetyparam to init.py

* Revert "Add VOACC safetyparam to init.py"

This reverts commit 2e46f8746f31c399823d9fae9fb9e77e6fee6eea.

* Revert "Add OP VOACC override stock cam"

This reverts commit a4b096cc1e7ee572b22e5f4422b9a6d43f94479c.

* better comments

* better comments

better comments

fix

* move non-base msg definitions to subclass

* various comments

* TODO: add button safety

* add button safety

* use new pcm_cruise_check

* revert regen braking change

* only cancel button allowed

* Apply suggestions from code review

* Update board/safety/safety_gm.h

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

* fix suggestion

* Fix tests

* Revert "Fix tests"

This reverts commit 500577921f32be24934acc80af98aab3af86d028.

* this is a much simpler fix, do full fix in another PR

* tx button safety

Co-authored-by: Shane Smiskol <shane@smiskol.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-08-12 15:56:39 -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
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
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
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
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
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
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
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
730155cbcd GM: use new DBC (#836)
* bump openpilot commit

* Rename GM PT dbc to generated

Co-authored-by: Jason Shuler <jshuler@gmail.com>
2022-01-24 21:13:54 -08:00
Jason Young
1735bec7d5 Fix safety test coverage and permissions (#828) 2022-01-17 22:13:32 -08:00
Jason Shuler
83cf88557c GM Switch to AcceleratorPedal2 (#813) 2022-01-03 15:54:37 -08:00
Adeeb Shihadeh
0d97b6d4eb Safety Test: ensure TX msgs for other cars are blocked (#521) 2020-06-21 23:25:54 -07:00
Willem Melching
e0a706e4f0 Stricter pylint (#550)
* stricter pylint

* Add as argument
2020-06-02 16:27:07 -07:00
Adeeb
d7f7b14118 Enable almost all Flake8 checks (#548)
* fix W391

* E262

* E703

* W293

* some E

* E231

* some more E

* E225

* more E

* E252

* no tabs

* more tabs

* E701

* uds.py

* almost all of them

* only e265 left

* not sure why this is triggering on commented out code

* ignore esptool
2020-06-01 01:49:26 -07:00
Adeeb Shihadeh
275e76c2b2 fix linter complaint about too many blank lines 2020-05-31 17:20:47 -07:00
Willem Melching
b8267341a1 Add pre commit checks + CI (#545)
* Add pre commit checks

* untested but should work

* fix typo in dockerfile

* add sqlite

* add pylintrc to ignore usb1 members

* Typo in stage name

* Move to requirements
2020-05-29 11:52:03 -07:00
Adeeb
0bc864b3d5 Make torque-based steering state global (#518)
* use generic steering state vars for toyota

* chrysler

* gm

* comment

* more unnecessary lines

* hyundai

* subaru

* vw

* fix mazda
2020-04-28 10:33:20 -07:00
Adeeb
d9355c4148 Make cruise_engaged_prev a global + test case for it (#519)
* make cruise_engaged_prev a global

* test for cruise_engaged_prev
2020-04-27 22:13:30 -07:00
Adeeb
2115376412 Abstract sample speed test (#516)
* all cars move

* honda

* update comments

* vw
2020-04-27 21:36:56 -07:00
Adeeb Shihadeh
bd98fe6031 safety tests: use shorter function name 2020-04-27 15:27:28 -07:00
Adeeb
57cc954f24 Safety Test Refactor: GM (#504)
* start GM refactor

* use packer
2020-04-15 16:59:01 -07:00
eFini
4e98bbe8c9 Apply unsafe allow gas mode to all cars. (#480)
Apply unsafe iso accel/decel limit to toyota.
2020-04-06 08:56:36 -07:00
rbiasini
ceff91d3c5 Standardize brake safety tests (#465)
* WIP: improve safety test format

* Fix tests
2020-03-07 23:22:47 -08:00
Riccardo
110ca03160 remove long_controls_allowed unused param and reduce technical debt 2019-12-20 16:17:37 -08:00
Riccardo
4f9c879696 remove abunch of lines from safety regression tests by using common make_msg function 2019-11-19 11:29:04 -08:00
rbiasini
6249a183d6 tx_hook shall have a white-list of messages (#381)
* Started whitelisting messages

* Also toyota and cadilalc fix

* bug fixes and better checks. Need to figure out a solution for honda

* Whitelist also for subaru

* Added Chrysler as well to whitelist

* And Hyundai too

* now all supported cars should have a whitelist of messages

* Fix linter

* This should fix process replay

* Honda too is now whitelisted

* struct typedef

* Had forgot GM

* had a wrong addr for GM whitelist

* This should fix all the tests

* bump panda
2019-11-17 00:24:19 -08:00
Riccardo
e74ed93640 safety tests a bit more simplified 2019-11-15 01:12:54 -08:00
Riccardo
8af1a01ac6 clean up safety tests 2019-11-15 00:52:34 -08:00
rbiasini
cfcce8f06b WIP: Relay malfunction (#384)
* relay malfunction handling. WIP

* more cars to relay_malfunctions

* fixed safety tests

* minor change

* Fix linter

* all cars now have a relay_malfunction safety check

* added relay_malfunction safety test for fwd hooks

* added proper regression tests for relay malfunction to all cars

* temp patch to not fail regression in honda bosch

* also addr 0x194 is some nidec honda is steer control

* proper relay check for honda bosch too
2019-11-15 00:32:45 -08:00
Riccardo
e8d7ed1d90 Rename function name to not confuse safety_set_mode and set_safety_mode 2019-11-06 14:30:22 -08:00
rbiasini
fce38a91d7 Linter python (#299)
* Added pyflakes and Pylint for python

* Actually run linter in CI

* some simple pyflakes changes

* Add flake8 to panda reqs for linter test

* flake8 errors are fixed

* run flake8 in regression tests

* meant to run flake8

* hack to ignore unused import

* bug

* fix bugs in tucan_loopback

* Another fix by using set_safety_mode

* added pylintrc file

* more fixes and enabled pylint as well

* Fix pylint in circleci

* added linter to readme
2019-10-15 14:03:31 -07:00
rbiasini
70219d7bb2 match safety enum in cereal (#285)
* match safety enum in cereal

* removing tons of hardcoding

* add pythonpath to safety test

* Fix safety test in Docker
2019-10-02 18:20:32 -07:00