* create common gas brake safety test
* remove unrelated subaru reference
* also test below min_value
* better name and hardcoded
* use same as acceleration limits
* revert gm
* remove callable
* added common brake test and moved generic test to base safety class
* remove duplicate test
* wip
* wip
* rename longitudinalaccelsafety
* revert limits correct test
* fix controls allowed test
* move gm over to long gas brake test
* assert that limits are reasonable
* fix typing
* fix linter again
* fix linter again
* fix linter again
* like to make it clear
* typo
* fix from merge
* clearer names
* dont need thesemore
---------
Co-authored-by: Shane Smiskol <shane@smiskol.com>
* correct vehicle speed and add measured angle
* misra
* misra
* common test for angle
* PR cleanup
* use subaru prefix
* clean it up a bit
* minimize whitespace diff
* need float for deg_to_can
* Ford AEB safety
* whoops
* working tests
* debugging
* clean up
* stock aeb test
* split up test
* rm
* cmt
* rm
* just test stateless sigs for simple branch
* clean up
* rm
* just test this bit
* it's signed now
* cmt
* cmt
* clean up
* ohh
* add ACCDATA msg
* ford long safety
* long flag
* split stock and op long tests
* use accel limits for brake
* add comment
* fix acceleration limits
fix acceleration limits
* fix gas limits
* temp bug
* fix min gas, allow -0.5 (engine braking?)
* fix test
* fix tests
* yay it caught this
* pylint
* base name
* typing
* Revert "typing"
This reverts commit 7fb5e304cb.
* temp fix
* rm line
* this is handled by PandaSafetyTest
* revert
* move
---------
Co-authored-by: Cameron Clough <cameronjclough@gmail.com>
* ford curvature rate limits draft
* make common angle tests work with curvature
* comment
* no need for this
* extra line
* fix test
* generic curvature test class
* more reasonable limits
* adjust limits
* draft
* works
* works
* clean up
* add vehicle speed
* works
* clean up
* clean up
* more clean up
* more clean up
* lower
* double
* add updated bp
* remove
* can clean that up
* draft
* this works!
* think that's the correct placement
* try this
* closer
* use min
* add/sub one to not falsely trip
* remove old angle error safety
* i'm not sure if clamp is more readable
* fix that
* fix
* stash
* fix these tests
* ternary
* floats are a pain
* draft, works kinda
* even better
* round that
* need tolerance
* this should work (adding tol=1 wouldn't let us have multiple rate limits)
* test works
* clamp breaks if low is higher than high :(((
down from 150 blocked msgs to 7!
* no blocked msgs!!!
* test a whole bunch
* stash
* stash
* clean up test
* clean up test to be more like torque (+ speeds)
* clean up
* cmt
* test up
* up and down are good
* rename and remove
* this is tested
* uncomment
* this is tested by ensuring we move towards error at a minimum rate
* not used any more
* revert common
* clean up test_ford a bit more
* some clean up (combine variables where it makes sense)
* yeah can't use clamp since min isn't always < max, min(max(.. handles this
* clean up
* revert that
* comments
* cmt
* another
* that's old
* misra!
* Update board/safety/safety_ford.h
* Update board/safety/safety_ford.h
* add todo, fix test case
* more clear, matches panda
* add comment
* Update tests/safety/test_ford.py
* more fine speed increments
* rm comment
* better names
* this is expected behavior (tested by common checks)
* CURVATURE_ERROR_LIMIT_SPEED
* better name?
* pretty clean!
* same for up
* only used in one place now
* these are now clear
* common term
* make vehicle_speed a sample_t
* need to use values[0]
* speed is a float
* Revert "speed is a float"
This reverts commit 01af02f1d3.
* Revert "need to use values[0]"
This reverts commit 8f6d68345a.
* Revert "make vehicle_speed a sample_t"
This reverts commit ecd8dc86b6.
* safety fixes for new speed sample
* test fixes for new speed sample
* fix misra and make intermediate variable
* this isn't needed
* convert vehicle_speed into sample_t, change no behavior
* draft
* round
* test
* clean up
* round
* round all
* use min
* remove round macro from this PR
* reset speed measurement
* debug
* bbd
* rm
* revert
* test above and below
* need this now
* misra pt 1
* misra pt 2
* misra pt 3
* i don't understand this one, not different from other cases
* fix test
* test
* revert that
* draft
* test the sample_t works properly for safety modes that use it (angle only)
* can combine these tests
* test decimals
* global
* misra
comment
* suggestions
* fix
* use new helper
* test angle meas readback (ensures speed and yaw rate are used properly)
* revert
* rm
* tuple
* temp
* clean up
* stash
* Revert "stash"
This reverts commit cab96b3e2b.
* use global
* test negative
* name
* reset min torque meas too
* add test that fails
* cmt
* cmt
* clean up test
* don't be random
* above test tests this pretty much
* test angle too
* fix
* also test driver torque
* whoops
* whoops
* test that we can send curvature=0 if enabled=False while control_allowed=True (let's say EPS faults, OP doesn't want to actuate)
* draft
* only check error if apply bit is 1
* subtest
* no subtest
* fix safety and tests
* tests say this works
* clean up
* subtests are sloww
* Revert "subtests are sloww"
This reverts commit 560c6745c8.
* fix test from merge
* add comment
* add comment
* add another comment
* spacing
* set ford vehicle speed
* parse yaw rate signals
* misra
* misra
* misra
* misra
* draft
* update module
* already checked
* and set it properly
* some stuff
* draft
* clean up (will fail tests because we don't send yaw rate yet)
* could do something like this
* this is better and less prone to bugs
* match simple op limiting, debugging
* set checksum for messages in tests
* clean up
* fix that
* one m/s fudge
* fix sign of yaw rate
* interpolate detects size
* forgot OP flips the curvature sign. it matches yaw on can
* all my debugging crap
* make replay work for ford
* fix panda blocking messages (array is fixed size so size-1 is 0 rate at high speed)
* uncomment safety test limits
* revert
* round for zero blocked msgs
* fix limits
* meas safety checks that down rate is >=, not <
* test pass
* lots of comments and draft what one meas torque check would look like
* fix that
* add curvature meas
* add debugging stuff
* Revert "add debugging stuff"
This reverts commit 449783fc62.
* messy but at least one test passes now
* draft
* add max_steer
* some safety clean up
* and that
* start with a test that works
* another test that works (sort of, we need more strict panda safety without false positives)
* no max curvature check (not safety related), allow any rate limits
* add new function
* also need to consider max val here, since OP will send up to that
* and now use the function
* lower to 10
* compilation fixes
* clean up (no rate limiting)
* remove that too
* curvature diff test
* more clean up
* debug
* ?
* better names
* more official
* use _curvature_meas_msg_array here
* bit faster
* no i don't
* revert that
* why not just use angle_meas?
* bb ll
* bb deb
* clean up debug vals
* more
* revert replay drive debugging changes
* Update board/safety.h
* rm line
* only need to round the final thing
* not needed, under 10 ms
* make a class variable
* fix a misra?
* another misra?
better
* ?
* 12.1
* need to explicitly convert
* add one to not false trigger the violation (float rounding)
* not really needed
* rm line
* cmt
* use clamp
* rename
* in struct
* comment
* use max_limit_check
* draft clean up
* Revert "draft clean up"
This reverts commit d1a0e8acd1.
* make a global
make a global
* this is fine
* Add second speed
* 2.5 m/s is 9 kph, 4 kph is the max in the field
* add quality signal
* qf signal name
* comment
* checksum matches except it goes to zero when turning the car off despite counter still active
* update comments
* now test it
* spacing
* Update board/safety/safety_ford.h
* zzzz
* not needed
* whoops
* test vehicle state mismatch
* add to safety_helpers
* probably misra
* we might want to check it in both speed signals in case one doesn't exist on a car
* Revert "we might want to check it in both speed signals in case one doesn't exist on a car"
This reverts commit 3338931409.
* fix formatting
* 2 m/s (7 kph)
* set controls_allowed directly like other safety models
remove vehicle_state_mismatch
* obv
* Add second speed
* 2.5 m/s is 9 kph, 4 kph is the max in the field
* add quality signal
* qf signal name
* comment
* checksum matches except it goes to zero when turning the car off despite counter still active
* update comments
* now test it
* spacing
* Update board/safety/safety_ford.h
* zzzz
* not needed
* whoops
* test vehicle state mismatch
* add to safety_helpers
* probably misra
* we might want to check it in both speed signals in case one doesn't exist on a car
* Revert "we might want to check it in both speed signals in case one doesn't exist on a car"
This reverts commit 3338931409.
* fix formatting
* 2 m/s (7 kph)
* revert mismatch stuff
* added infotainment status to panda
* dont fwd infotainment status
* revert placeholder and add test case
* Fix test case
* gen2 only
* fix test case
* Revert "fix test case"
This reverts commit 8cc7579620.
* Revert "gen2 only"
This reverts commit 6a511a9976.
---------
Co-authored-by: Shane Smiskol <shane@smiskol.com>
* VW MQB: Cleanup HCA control message
* update opendbc ref
* revert this before merging
* MISRA
* revert Dockerfile to comma master
* reverted a little too much
* allow inactive accel values at all times
* cleaner
* unnecessary, done by default
* better comments
* move test to common class
* fix
* flip
* comment
* append 0 and INACTIVE_ACCEL to test accels + check acc_07 sends if inactive only
* cleanup
* fix that
* copy testing convention of VW and Honda
---------
Co-authored-by: Shane Smiskol <shane@smiskol.com>
* civic22_long
use long flag
* maybe?
* Update safety_honda.h
* revert the 0x1c8 addition
* init radarless safety check
* correct accel parsing
* add test class (WIP)
* remove current_controls_allowed
* Fix ACC_HUD
* patch
* Add missing safety to test name
* Pass irrelevant test
* move comment
* remove unused comments
* add comment to TestHondaBoschRadarlessSafety
* Fix message overlap
The "exceptions for common msgs across different hondas" fix does not seem to be working. Created another exception for TestHondaBoschRadarless based on the HondaNidec exception above
* Fix base
* remove comment
* remove buttons from LONG TX
* make a base Radarless test class
* can't remove them, since safety doesn't check bosch
* test accel limits
* test accel limits
* we can do the clean up in another pr
---------
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: sshane <shane@smiskol.com>
* part 1 of clean up
* make it work and pass
* remove lta stuff
* remove commented lta tests
* more
* move test back to where it was
* rm line
* rename that
* fix that
* start to add LTA
* angle test
* fix tests and add base stock longitudinal class
* formatting
* clean that up
* convention
* add ALLOW_DEBUG
* part 1 of clean up
* make it work and pass
* remove lta stuff
* remove commented lta tests
* more
* move test back to where it was
* rm line
* rename that
* fix that
* we always want to enforce LTA disallowed actually
* not sure if these are helpful
* endswith("Base")
* adeeb
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
* check checksum
* think pylint won't like this
* complete test
* do this
* no need
---------
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
* assert the other signals are zeroed
* add to tja function
* fix misra
* test
* should tx
* ?
* rm line
* up here
* Update tests/safety/test_ford.py
* faster
* adjust round
* panda for pc!
* little more
* fake panda
* move some more stuff
* increase timeout
* move that
* print helpers
* cleanup
* just move it for now
* revert jenkins changes
* do toyota, hyundai, gm
* comments
* honda draft
* Revert "honda draft"
This reverts commit a1f466a5c9.
* do tesla
* vw draft
* finish vw
* fix safety
* clean up
* fix function names
* do honda and fix safety test not checking pos accel for bosch
* clean that up
* 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
* 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 c7fdc3b00c.
* fix test
* 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 67abe4c86b.
* fix
* HKG: Car Port for Genesis GV70 2023
* Revert "HKG: Car Port for Genesis GV70 2023"
This reverts commit 01bfda6dff.
* 0x1a0 rx check
* Wrong one oops
* Check 0x1a0 based on param
* no need
* getting a bit messy, clean up soon!
* clean up
* clean up
Co-authored-by: Shane Smiskol <shane@smiskol.com>
* more complete tests
* use parameterized_class
* make clear this only tests EV right now
* fix python linter
* rename reference
* clean up and fix python linter again
* VW MQB: Longitudinal safety
* disregard ACC_13 for now
* abstraction cleanup
* fix long control flag name
* quick hack
* VW MQB: Cleanup message counter handling
* various cleanup
* try without ACC_04
* follow DBC updates
* bump Docker opendbc ref
* additional main switch and cancel handling/testing
* pacify linter
* style
* handle the overlap tests like HKG CANFD
* update replay route
* commonize elements between MQB and PQ
* Apply suggestions from code review
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
* proper use of globals/conventions
* make these global
* this is better for now
* better comment on accel boundary scaling
* spelling error
* reset on init
* try bumping openpilot
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
* 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>
* h90d safety
* quicker rate
* update comment
* support multi frames?
* stash
* stash
* might work?
* stash
* clean up
* revert that
* add test
* fixup tests
* clean up
* remove test
* try to combine tests
* Revert "try to combine tests"
This reverts commit f147955b94.
* seems simpler
* more explicit
* shouldn't be needed
* no hyundai stuff
* no line
* consecutively
* comment
* comment
* comment
* revert
* comment
* check earlier
check earlier
* ensure we don't set a negative value
* add todo comments
* for loop
* 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
* allow sending steering buttons msg to camera
The DBC lists both the IPMA and PCM as receiving modules for the `CcAslButtnCnclPress` and `CcAsllButtnResPress` signals used to cancel/resume ACC.
Sending resume to both buses is confirmed to work by three testers, now it's just down to tweaking openpilot to get high reliability.
* add test for both buses
* only send TJA to bus 2
* 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 256f3be9a8.
* 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 6bc63a345a.
* 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 bc37a7eedd.
* need to check at test time not class init time
* toyota steer fault safety
* fix
* alternative safety
* no comment
* should be good
* same behavior, a bit simpler
* better tests
* fix comment
* update safety comment
* const is actual number of messages
* Fix bug
* misra
* Fix test
* clean up logic a bit
clean up logic a bit
fix
* fix
fix
* clean up tests
* unsigned
* forgot to rename message when merged
* Comments
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
* Update names
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
* rename rest of variables
* real time checks
* clean up safety tests
* revert
* add this
* clean up
* better name
* use common steering checks
* reverse order
* make common
* re-organize the safety
* clean up safety_toyota
* more clean up
* add comment back
* 19
* recover
* some variable name clean up
* rename and reset `valid_steering_msg_count`, another recover message
* move comment
* remove reset_toyota_timer, minor test clean up
* common test
* use init_tests
* threshold used to be: frame you can cut steer on, now it's min num of valid frames (next frame you can cut, 18+1)
* Update tests/safety/test_toyota.py
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
* fix realtime
* Update board/safety/safety_toyota.h
* Apply suggestions from code review
* Update board/safety/safety_toyota.h
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
* Hyundai: Car Port for Tucson Hybrid 2022
* Remove test comments
* Fix fwd_hook
* Allow tx on 0x1a0
* Fix byte counts
* Send LFA and HDA icons based on engageability
* Add FLAG_HYUNDAI_CANFD_HDA2 flag
* Update __init__.py
* Allow tx with CRUISE_INACTIVE
* Panda safety cleanup
* Include bus 0 in rx checks
* Missed one
* Remove redundant check
* Add comments
* start cleanup
* little more
* more cleanup
* tests
* one more test case
* rename
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
* VW PQ: Updated checksum and counter handling
* first pass PQ long control safety
* refactor stock test to prep for long test
* long control tests
* falling edge enable logic and tests
* accidentally worked but this is better
* test misra/cppcheck evaluation of debug build
* Revert "test misra/cppcheck evaluation of debug build"
This reverts commit 7594fc5e2f.
* allow use of manufacturer ramp-up rate
* soften wheel-touch threshold
* fix tests
* check/test ACC main switch state
* fix CRC for Motor_5
* derp
* retry CI
* try that again
* fuuuu
* fix Motor_5 checksum validation
* use existing acc_main_on global
* re-pin opendbc
* no need for resume spam in longitudinal mode
* concise
* consistency cleanup
* comment and whitespace cleanup
* more cleanup
* more
* restore driver torque threshold
* add long control replay route
* obsolete comment
* proper flag name
* wild to mild-ish
* bump openpilot ref
* Update test_safety_replay.py
* handle non existent routes
* comment consistency/polish
* flip comparison order for falling edge clarity
* restore refs
* read the diff next time, speedy
* srsly
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
* 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 2e46f8746f.
* Revert "Add OP VOACC override stock cam"
This reverts commit a4b096cc1e.
* 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 500577921f.
* 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>
* Hyundai: Car Port for 2022 Kona Electric Camera SCC
* add missing flag
* set camera_scc in other safety modes
* Add safety test
* this will be a stock longitudinal port for now
* common cruise check
make this check common
* Fix comment typo
* Camera SCC HKG send CLU11 on bus 2
* Update CLU11 comment
* fix button test when txing
* just add bus 2 to existing addr checks
* actually no, this will never be on bus 2
* CLU11 is always on bus 0
line
* consistent param ordering
* fix test
fix test
* this is fine
* Mistook SCC for CLU, fix
* try to make this a little more clear
* add comment
* fix that
Co-authored-by: Shane Smiskol <shane@smiskol.com>