Commit Graph

513 Commits

Author SHA1 Message Date
Shane Smiskol 8c3bb0151e
deprecate busTime (#1989)
* deprecate busTime

* fix test_comms.py

* update opendbc

* way more than i thought

* and here

* oops
2024-07-30 21:20:48 -07:00
Jack Merrill d4a01f7555
Increase Subaru RPM limit (#1937)
* feat: increase Subaru RPM limit

* test: Update tests for Subaru RPM increase
2024-04-25 13:56:25 -07:00
Adeeb Shihadeh de061e4f73
remove rest of gmlan (#1908)
* remove rest of gmlan

* fix

* update struct

* update
2024-03-21 13:56:36 -07:00
Adeeb Shihadeh 567dbfe6d8
remove comma pedal (#1902) 2024-03-17 22:22:46 -07:00
Robbe Derks 41e9610ff8
Tesla Raven (#1886)
* raven uses a different steering angle sensor

* add raven flag

* raven test

* bump opendbc ref
2024-03-06 21:13:13 +01:00
Cameron Clough 0c7d5f11d7
use pyupgrade to update syntax (#1889) 2024-02-24 13:56:28 -08:00
Shane Smiskol 6aa4b55033
Ford: ignore 2nd speed checksum (#1887)
* ignore cs

* fix test

* fix coverage

* no dead code, remove todo

* typo
2024-02-23 19:08:12 -08:00
Jason Young cd11c7f9a4
VW PQ: Allow either HCA mode (#1885)
* write the test first, like a grownup

* pass the test!
2024-02-22 14:56:14 -08:00
Shane Smiskol 0a1ec8580e
Toyota: radar disable safety (#1611)
* toyota: add safety for tester present

* block ACC_HUD

* check stock ECU

* add test

* and now pass test

* check ACC_CONTROL for relay malfunction

* not needed

* split tx msgs, test_panda_safety_tx_cases was really helpful!

* now don't need this

* 0x343 is expected to be on bus 0 if stock long

* better as cases

* swap

* always block pre_collision if stock (used for dsu removal)

* do tx msgs

* fix comment
2024-02-14 23:22:06 -08:00
Shane Smiskol a037eebf38
Toyota: longitudinal msgs behind safety param (#1871)
* long is fully behind safety param

* fix

* spacing
2024-02-14 22:16:51 -08:00
Shane Smiskol 27768f5ef3
Toyota: check ACC_CONTROL for relay malfunction (#1870)
* check acc relay malfunction

* do what they do
2024-02-14 21:51:42 -08:00
Shane Smiskol aca33b83a4
tests: one file for safety and coverage tests (#1865)
* one file for all tests

* clean up

* unreachable

* Revert "unreachable"

This reverts commit 4b792b1f9b.
2024-02-13 17:27:19 -08:00
Shane Smiskol a99387d52d
pytest improvements (#1864)
* move these to pyproject so you can do pytest .

* add comment for bug

* add comment for bug
2024-02-13 16:57:45 -08:00
Jason Young 87f87d49ac
invoke system browser for coverage reports (#1862) 2024-02-13 14:28:21 -08:00
Shane Smiskol ec17f75efc
ELM safety: allow GM diagnostic camera address (0x24B) (#1842)
* allow 0x200 addresses for Bolt camera

* fix test

* only gm address

* think 15765-2 is the source

* test the data

* label

* should be here

* already labeled

* use constant!

* update table

* fix misra

* Revert "update table"

This reverts commit 71ef3fde7c.

* new cppcheck gets this
2024-01-29 20:23:57 -08:00
Shane Smiskol 266d4573b7
safety: test with default pytest dist (load) (#1840)
* faster safety test

* wondering how fast this is

* 4 threads too?
2024-01-29 02:03:35 -08:00
Jason Young 2a0536c631
VW MQB: Safety update for EA timeout fix (#955) 2024-01-09 19:20:46 -08:00
Justin Newberry 20722a5946
Subaru: cruise_rpm and cruise_throttle are 13 bits (#1786)
* fix cruise throttle

* and es_status

* bump opendbc
2023-12-29 19:25:02 -05:00
Shane Smiskol 5b41a63ae5
Ford: check predicted gas (#1776)
* check pred value

* test
2023-12-15 00:01:17 -08:00
Shane Smiskol bb75afc84e
safety: add safety param for gas interceptor (#1735)
* some refactoring still needing to be done here

* 50hz

* set rx checks

* tx msgs

* test

* fix

* forgot to check this since it's static now

* enable_gas_interceptor

* more

* remove int funcs since are common

* generic!

* not generic

* need to set counter now

* set_enable_gas_interceptor not needed

* already reset in safety init

* fix test

* remove gas_interceptor_detected (partly)

* oof need for hjonda too

* edit structs

* more honda (still broken)

* fix typo

* shift these down

* can also make this extensible

* stash

* defining classes is much simpler, maybe in future we will have some sort of wrapper after some more thought

* remove create_interceptor_test now

* add lta interceptor

* clean up print

* clean up

* once

* type hint

* rm

* no interceptor with stock long + good test

* add interceptor counter to honda

* need alt interceptor + set rx checks for honda

* we were never testing button enable with nidec + interceptor!

honda almost all passing

* these fixes make sense

* clean up

* better

* clean up test cov

* clean up

* not needed

* fix tx msgs

* clean up

* cppcheck

* fix

* unnecessary
2023-12-14 15:22:17 -08:00
Shane Smiskol 30647d6604
safety tests: set gas interceptor counter (#1775)
* safety: check interceptor msg counter (#1738)

* toyota: check interceptor counter

* add counters and check rx

* honda: check counter

* clean up

* revert

* typing
2023-12-13 19:32:16 -08:00
Shane Smiskol e51411344b safety tests: clean up gas interceptor detected 2023-12-12 22:58:09 -08:00
Shane Smiskol 294992ac2c
safety tests: rename gas interceptor test (#1774)
* more appropriate name for gas interceptor

* safety
2023-12-12 22:15:36 -08:00
Jason Wen a6b76dfda0
Hyundai CAN-FD Longitudinal: enable for ICE camera-SCC cars (non-HDA2) (#1671)
* allow ice camera scc longitudinal

* Merge commaai#30021

* test

* clean up

* clean up 2

* some test work

* re-use existing test for radar-scc for now

* clean up

* clean up

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2023-12-09 17:37:28 -08:00
Shane Smiskol ff49666893
Hyundai CAN FD: radar-SCC longitudinal test (#1771)
* this rightly fails

* now safety
2023-12-09 16:55:46 -08:00
Shane Smiskol cf108cd4cc
safety: full coverage (#1750)
* stash

* if x > xy.x[0], then subsequent x < xy.x[i+1] enforces it is monotonic, or uses last y

* rm

* test safety tick

* coverage: include safety.h

* car-only test

* MAX

* op

* add safety_config_valid
2023-12-09 02:27:29 -08:00
Shane Smiskol 80782bcbe4
Toyota: LTA steering control safety (#1189)
* simple lta safety

* fix compilation error

* allow current angle when disabled

* toyota angle rate limits

* use GET_BIT

* update limits, temp fix blocked msgs (not critical safety)

* try these limits

* debug

* add setme check, double rate limit for half rate

* update safety limits to openpilot (2 bp)

* had duplicate checks here

* rm line

* better comment

* silly bug

* draft

* Revert "draft"

This reverts commit 756ef70135.

* toyota: add safety for tester present

* block ACC_HUD

* check stock ECU

* add test

* and now pass test

* safety replay: support toyota lta

* remove radar stuff

* max torque safety

max torque safety

* driver torque

* one line

* match openpilot limits

* rename to max_angle and check quality flag

* measure current angle

* clean up

* oh we can combine

* no driver torque limiting for now

* todo: decide the tolerance if any

* add max angle and prepare for to enable inactive safety

* enable inactive safety

* fix replay when inactive

fix replay when inactive

* fix qf check

* ohh this was a bug

* measure vehicle speed

* because safety is in m/s

* rm MeasurementSafetyTest

* stash very draft changes

* fix

* uncomment

* clean up

* rm

* already added

* clean up

* temp fix

* test angle measurements

* add constant

* ltl cleanup

* include this test in test_angle_measurements

* better

* order makes more sense

* fix

* clean up ford cmts

* move to base

* todo

* misra

* already do this below

* angle tests: take in max angle as argument

useful for safety modes that are limited (ford/toyota)

* fix ramp test: round measurement since toyota's scale isn't round

* clean that up

* no subtest

* back

* is tested now!

* flat is more clear

* add check for mismatching bits

* LTA is fully tested now

* clean up

* test_angle_cmd_when_enabled

* whops

* flip

* fix broken test

* need this if we type angle meas func

* should set prev torque

* no subtest

* remove default valid qf

spce

* one line

* cmt

* fixes

* vehicle speed macro

* vehicle speed macro v2

* Update board/safety_declarations.h

* easier to follow

* one line

* rightttt

* rename to toyota_lka_rx_checks, not default
2023-12-08 15:00:23 -08:00
Shane Smiskol 845658e169
Toyota LTA: set torque measurement (#1761)
* catch

* fix ramp test: round measurement since toyota's scale isn't round

* reorder

* can be in main PR
2023-12-06 17:46:48 -08:00
Shane Smiskol ea78657bef
Toyota: rename LTA torque wind down signal (#1757)
* rename setme_x64

* bump opendbc ref
2023-12-04 21:05:02 -08:00
Adeeb Shihadeh a9af9cbd74
run safety tests in parallel (#1756)
* run safety tests in parallel

* fix

* fix path
2023-12-04 20:50:43 -08:00
Shane Smiskol d070f6e7c9
Toyota tests: rx speed messages in correct scale (#1751)
because it's kph, safety works in m/s
2023-11-29 20:49:50 -08:00
Shane Smiskol 5884962372
Honda: fix alt brake address check race condition (#1746)
* common honda addr checks

* oohhhh

* rename RxCheck from merge

* more rename

* checked data and found 0x1A6 does not exist on any Bosch, so combining with 0x296 is safe

* formatting

* need this since refactor

* clean up

* fixup

* misra

* coverage caught another bug!

* another duplicate addr from multi tests

* proper base class

* formatting

* misra

* flat

* Revert "flat"

This reverts commit d5ea2adf26.

* forgot to specify bus (fuzzy test caught it, but whitelisting rx addrs
would so much quicker)
2023-11-27 00:18:24 -06:00
Shane Smiskol beffd7bcbf
Nissan: check bus for brake pressed msg (#1740)
* never checked bus!

* easy fix
2023-11-26 21:07:20 -06:00
Adeeb Shihadeh c67c973b99 Revert "Honda: fix alt brake address check race condition (#1723)"
This reverts commit 42a62936fb.
2023-11-24 16:49:55 -08:00
Adeeb Shihadeh aa6ea0772b Revert "safety: check interceptor msg counter (#1738)"
This reverts commit 83acc65743.
2023-11-24 16:49:26 -08:00
Adeeb Shihadeh f1cd12651c
safety: remove LIN hook (#1741)
* safety: remove LIN hook

* rm more
2023-11-23 16:30:20 -08:00
Shane Smiskol 83acc65743
safety: check interceptor msg counter (#1738)
* toyota: check interceptor counter

* add counters and check rx

* honda: check counter

* clean up
2023-11-21 17:23:37 -08:00
Shane Smiskol 8b068880d1
safety tests: common interceptor msg (#1737)
* common interceptor msg creation

* cnt not needed yet
2023-11-21 14:35:35 -08:00
Shane Smiskol 42a62936fb
Honda: fix alt brake address check race condition (#1723)
* common honda addr checks

* oohhhh

* rename RxCheck from merge

* more rename

* checked data and found 0x1A6 does not exist on any Bosch, so combining with 0x296 is safe

* formatting

* need this since refactor

* clean up

* fixup

* misra

* coverage caught another bug!

* another duplicate addr from multi tests

* proper base class

* formatting

* misra

* flat

* Revert "flat"

This reverts commit d5ea2adf26.
2023-11-20 19:27:18 -08:00
Adeeb Shihadeh c6248d6504
safety: cleanup ints that are bools (#1726)
* safety: cleanup ints that are bools

* update tests
2023-11-19 16:47:09 -08:00
Shane Smiskol 9fed95003e
Ford: fix possible standstill mismatch (#1725)
fix ford standstill mismatch
2023-11-18 00:04:34 -08:00
Shane Smiskol 3b165ed21b
Hyundai: fix brake pressed bitmask (#1724)
* fix

* test this
2023-11-17 19:58:53 -08:00
Shane Smiskol 5fe1d67b77
safety: test coverage (#1699)
* run in CI

* test

* make report optional

* 100% GM coverage

comments

* more coverage: these are unhittable lines

* vw mqb: convert switch to if, consistent with all other safety modes

* we don't check any of these yet

* rm

* ensure honda_fwd_brake is reset

* can rm this

* test honda brake latching

* honda: add rx brake function

* use loops for more coverage and more compact code

* other honda stuff

* remove car-specific stuff from init_tests

* don't need to have car safety modes reset interceptor detected (global init does)

* use get_bit

* ahh ford counter is unhittable: counter check disabled due to skipping

* misra

* test nooutput and alloutput

* required changes for that

* fix test

* more all/nooutput coverage

* start on lin

* rx coverage

* lin tx coverage

* some barebones body test

* double negative

* draft elm327 safety (git stash)

* fixes from merge

* clean up test cov

* add rm

* no body

* failed grep returns exit code 1

* more clear msgs
2023-11-10 19:37:41 -08:00
Shane Smiskol 57e280ad29
safety: add body safety tests (#1716)
* partial body safety tests

* cmt

* test this flasher msg

* move

* address check on can flashing msg

* no other test tests this, valid when we rx one

* this is more reflective on the current behavior

* better test

* clean up

* stash

* clean up

* revert

* Update board/safety/safety_body.h

* fix misra
2023-11-10 19:02:32 -08:00
Shane Smiskol 4383ac35f5
safety: add ELM327 safety test (#1715)
* elm safety test

* comment
2023-11-10 03:03:35 -08:00
Shane Smiskol 5e22e87cf6
Hyundai CAN: update driver braking signal (#1713)
* use DriverOverride

* Update board/safety/safety_hyundai.h
2023-11-10 01:03:33 -08:00
Jason Wen 3f25ccabd6
Subaru Pre-Global: Reverse driver torque signal for certain platforms (#1648)
* Subaru Pre-Global: Reverse driver torque signal for certain platforms

* added flag

* fix tests

* use dbc instead

* duplicate

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
Co-authored-by: Justin Newberry <jnewberry0502@gmail.com>
Co-authored-by: Justin Newberry <justin@comma.ai>
2023-11-08 15:27:20 -08:00
Justin Newberry 708303d613
Subaru: cleaner wrong safety mode checks (#1709)
cleaner
2023-11-08 12:03:39 -08:00
Shane Smiskol fa04f47600
safety tests: support multiple relay malfunction addresses (#1707)
* gm: test the other relay malfunction addr when using long with gmcam (ASCMGasRegenCmd)

* make it a dict

* might want to split these changes

* messy

* Revert "messy"

This reverts commit 25cd68fcab.

* some more

* ford: check longitudinal addr

* chrysler

* fix ford!

* gm and subaru

* common

* draft

* clean up

* clean up check

* rm line

* clean up

* add context

* apparently None isn't optional

* conventional test

* Revert "conventional test"

This reverts commit 4b265ad4ab.

* whoops, clean that up

* more clean up

* add a helpful cmt

* more hlpfl cmt

* can remove this test now

* hyundai cmts

* not really needed
2023-11-07 19:03:08 -08:00
Shane Smiskol 619f6f31b7 safety: _torque_driver_msg is used 2023-11-07 15:49:50 -08:00