Commit Graph

50 Commits (596344e48b2db750c88f2167f4d3f11b41de656e)

Author SHA1 Message Date
Adeeb Shihadeh 596344e48b
build libpandasafety with scons (#639)
* build libpandasafety with scons

* remove makefile

* fix that
2021-03-31 18:35:47 -07:00
martinl b2c86eb66b
Subaru safety refactoring (#532)
* Update subaru safety tx messages

* Add Subaru preglobal driver torque limits

* fix preglobal desired_torque

* fix subaru preglobal torque rate limit and tx messages

* readability update for desired_torque

* fix preglobal tests

* Subaru safety refactoring, added missing legacy checks and updated test

* Remove subaru_global check from tests

* Reorder legacy constants, remove subaru_init

* Update Subaru legacy safety and tests to match dbc scaling factors

* remove scaling factor from torque_driver

* Change preglobal driver torque scaling factor

* Change driver torque factor to 10

* Fix preglobal dbc name

* Fix Subaru legacy safety test

* update openpilot commit

* init valid with one line
2020-06-11 15:51:05 -07:00
Adeeb 9ebde2535c
Reset state on safety mode init (#542)
* reset state on safety mode init

* more global state

* reset message seen too

* misra
2020-05-26 14:23:39 -07:00
Greg Hogan c31b899a58 honda bosch longitudinal safety 2020-05-14 15:44:38 -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 8cc3a35700
remove cadillac (#496) 2020-04-13 14:43:46 -07:00
Jason Young 51e0a55d6d
Support code for unsafe mode unit tests (#478)
* Support code for unsafe mode tests

* Fix pre-existing MISRA warning while I'm here
2020-04-01 10:17:51 -07:00
rbiasini 0f21b19bb3
Cleanup pedal nomenclature (#467)
* consolidate gas and brake nomenclature

* fixes in code and tests
2020-03-08 23:48:00 -07:00
rbiasini 4368748851
WIP: Toyota brake check. (#459)
* Toyota brake check with safety tests
2020-03-05 00:16:03 -08:00
rbiasini b2dbb504dc
remove toyota ipas safety code and tests (#460) 2020-03-04 10:54:13 -08:00
rbiasini 11ef24bc16
Improve tests (#456)
* much more thorough Honda-Bosch tests and better test inheritance. Also fix counter test bug

* Fixed other counters too

* remove unnecessary function
2020-02-29 09:00:29 -08:00
rbiasini 9a44499879
Fix Subaru Legacy Torque driver bug (#454)
* Fix Subaru Legacy Torque driver bug
2020-02-27 17:20:58 -08:00
rbiasini dfa6b079de
separating subary legacy safety mode from global (#452)
* separating subary legacy safety mode from global

* added explicit tests for subaru legacy, which were absent before
2020-02-27 15:28:24 -08:00
Andre Volmensky db94a5b813
Added Nissan safety (#244)
* Added Nissan safety
2020-02-26 11:11:56 -08:00
Jason Young 598074c192
Volkswagen safety updates: Phase 2 (#445)
* CRC and counter checks, standstill/brake checks

* Clean up a tsk_06 that snuck through

* Be consistent about how we call _msg_esp_05

* Reduce scope: haunted by the ghost of MISRA future

* Improved check/test for in-motion braking

* MISRA styling fix
2020-02-20 13:57:07 -08:00
Jason Young ccf75c456f
Volkswagen safety updates: Phase 1 (#444)
* Checkpoint Panda refactoring updates

* Rename MQB safety tests in preparation for PQ

* Refactor MQB tests, add missing torque test

* Bring in MQB init without CRC LUT setup

* Fix to ACC_06 test case

* Fix to ACC_06 test case

* Tweak comment for clarity

* Drop superfluous return
2020-02-19 12:37:38 -08:00
rbiasini d301a59d64
WIP: Checksum checks (#403)
* add lag message check for all supported cars
* add checksum and counter checks for toyota and honda
* add rx hook regression tests
2019-12-21 10:25:54 +01:00
Riccardo c08b480cea separate between bosch giraffe and harness hooks. Make tests more thorough 2019-12-20 23:18:20 -08:00
Riccardo 110ca03160 remove long_controls_allowed unused param and reduce technical debt 2019-12-20 16:17:37 -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 48d0d0c782
VW button spam: fix safety and add tests (#306)
* VW button spam: fix safety and add tests

* button spam is actually sent on bus 2

* Fix safety test. Still need to add gas safety test

* added gas safety test to VW and using consistent nomenclature

* style fixes
2019-10-29 15:11:42 -07:00
rbiasini a12a148d5f Uno (#274)
* Added uno

* Added usb switch support

* Added PWM and IR power functions

* Implemented bootkick

* Added uno as a new hw type

* Bumped version

* Added fan control and tach readout

* WIP: RTC support

* Working RTC

* Fixed python

* Misra compliance

* Added USB control messages for fan/IR power

* Added USB commands + tests for fan & IR control. Fixed bootstub and pedal compilation

* Added IR and fan to power saving mode

* Changed defaults

* Fix safety considering uno

* passing safety now

* Minor UNO tweaks

* Fixed version

* More minor temporary tweaks

* Removed usb load switch from uno

* Added power control for shutting down the fan completely

* Disable IR LEDs by default

* Fixed linter issue

* Linter fix #2
2019-10-25 16:22:42 -07:00
Jason Young 2f9e076289 Panda safety code for Volkswagen, Audi, SEAT, and Škoda (#293)
* Panda safety code for Volkswagen, Audi, SEAT, and Škoda.

* First pass at MISRA compliance.

* Second pass at MISRA compliance.

* Fix scope of violation boolean.

* MISRA doesn't care for implicit cast of unsigned int to boolean.

* Remove superfluous newline.

* Remove unused VW ignition hook code, preserve commentary.

* Add 50% padding to max delta check.

* Add 50% padding to max delta check.

* Add clarity around the origin of our safety constants.

* Update test RT delta to match safety.
2019-10-09 13:54:22 -07:00
rbiasini d68356b924
Honda Nidec: fwd stock AEB (#257)
* Honda Nidec: fwd stock AEB

* bug

* correct aeb bit

* typo

* Revert "typo"

This reverts commit d424198b1fbc5a783c39b5bdd7d034865ed61a83.

* typo

* bug fix

* don't have tx hook blocking aeb messages from stock system

* typo

* fwd stock brake even if they are the same

* only stop forwarding aeb when aeb flag clears

* Fix safety tests

* Added fwd safety tests

* tiny bit more readable
2019-08-30 20:15:03 -07:00
rbiasini 59f5813173
Black (#254)
* late usb

* Added type support for black panda

* Added harness presence and orientation detection

* harness relay driving code

* Added intercept support in black panda code. Switched around can0 and can2

* Disable ADCs after orientation detection. Ignition interrupts via harness

* WIP: Hardware abstraction layer + black panda bringup

* Fixed bootstub build

* Fixed bootstub for pedal

* Fixed infinite loops

* Got CAN buses working on white again

* Fixed pedal build and black can interfaces

* Got CAN buses working on black panda

* Finished loopback test for black panda

* Erase all flash sectors on the panda. Increased binary limit. Added extra python functions.

* Fixed python

* Made new code MISRA compliant

* Cleaned up ignition. Fixed build

* Fixed health packet

* Fixed CAN mode on black bug. Changed OBD to switch on ELM mode

* Fixes from Github review

* Fixed MISRA issue for pedal

* Fixed failing gmlan tests

* ELM327 safety: allow diagnostic on all buses

* Cleaned up EON relay code

* delete only 3 sectors instead of 11 to allow a new build to be flashed. Much faster to flash

* Removed CAN only can0 output mode. Does not make sense on black panda due to reversibility issues.

* Added heartbeat logic for EON code on panda. Go to NOOUTPUT if EON does not send a heartbeat for 5 seconds.

* Remove all CAN buses live on EON startup. Shouldn't be necessary to have this separate case

* Formatting

* Added file I forgot to push

* Added heartbeat to testing code to make sure EON tests don't fail. Should probably find a better way to do this though. Heartbeat thread didn't work, concurrent USB connection issues...

* Safety: support black panda for Honda Bosch

* Disable OBD2 if setting to NOOUTPUT mode

* Run safety tests for all hw_types

* Fail test if subtest fails

* fix safety tests
2019-07-23 15:07:06 -07:00
rbiasini 01072bec0b
Misra 11.x: pointer usage. (#250)
* RDLR, RDHR gone from safety

* back at not failing misra safety

* fix safety tests

* did not mean this

* Use get-bytes in pedal too

* Ignore Misra 11.5 and Fix 11.8 violaitons

* Fix 11.3 violations

* Neglect Misra 11.4, fix pointer issue in bootstub and rutn on Werror for pedal builds

* Fix Misra 11.6: can't assign number to void pointer

* Fix test after changing honda_moving name

* for loop is better

* Fix bugs from fbck
2019-07-10 20:56:03 -07:00
quillford 19d1e41eed WIP: enhance safety replay test (#211)
* safety replay: add msg length

* add support for individual segments to safety replay

* safety replay: extend segment support to rest of safety modes

* safety replay: add debug flag

* safety replay: return if no steering msgs in segment mode

* minor refactor of safety replay
2019-06-14 16:27:15 -07:00
rbiasini 78308c0bc5
All 14.4 violations are gone (#213) 2019-06-12 20:12:48 -07:00
Riccardo 133269a1a4 Added fwd test coverage for Toyota, Hyundai and Chrysler too. Removed replay tools for Chrysler, as a generic replay tool has been recently added 2019-06-11 19:24:08 -07:00
Riccardo a4653e2d7f Added fwd hook coverage to safety regression tests 2019-06-11 18:16:48 -07:00
quillford cd20d123c4 refactor tests/safety to use generic hooks (#208)
* refactor tests/safety to use generic hooks

* cleanup refactor

* removed dead code
2019-06-11 01:31:00 -07:00
quillford c381a470b1
replay test (#205)
replay drives to test for safety violations. fails if any messages are blocked while controls are allowed
2019-06-07 17:12:02 -07:00
Riccardo 6ce580a062 added function to get/set long_controls_allowed 2019-06-05 14:40:07 -07:00
rbiasini 09714e3a44
Toyota gas cancellation (#200)
* cancel on pedal press for toyota.
2019-06-05 13:38:59 -07:00
Riccardo 220cc8f4b5 Honda safety: this concludes the proper re-naming 2019-06-04 12:43:50 -07:00
Riccardo a00a50c622 Honda safety: better naming 2019-06-04 12:21:52 -07:00
Riccardo Biasini e437b9b4b1 Subaru: fixed bug and added safety tests 2019-03-11 02:12:22 -07:00
Riccardo be0061dccb Chrysler: safety now based on motor torque 2019-01-02 21:53:07 -08:00
Riccardo cf3ecd629d Chrysler safety: re-using hyundai framework 2018-12-28 19:20:57 -08:00
Drew Hintz 799c33868d Chrysler safety controls (#130)
* Chrysler safety model and tests.

* fix comments

* when ACC is canceled, disallow controls

* update SAFETY_CHRYSLER value in Python API and add other SAFETY values
2018-11-06 12:28:33 -08:00
Riccardo a91d7efad7 added hyundai regression test 2018-08-30 00:04:05 -07:00
Riccardo ba8762d5a3 Toyota safety: vars and consts need 'toyota_' prefix 2018-07-17 19:43:06 -07:00
rbiasini 38a9ea9ad9
added gm safety for steering (#123)
* added gm safety for steering
* safety tests done for safety_gm
2018-06-13 23:13:59 -07:00
Ted Slesinski 7caba241d0 Addition to Bosch safety to support Hatchback (#111)
* Addition to Bosch safety to support Hatchback

The computer brake is shown on 0x17c sensor on Accord and CR-V. We assumed all Bosch Hondas had the new 0x1be message which reports manual brake, but Civic Hatchback is not like this- It doesn't have this message and 0x17c works like the other Hondas so we are are passing a parameter from Openpilot for this.

* Renamed variable

* Make comment more descriptive

* Added safety check for cancel-only spamming

* Add regression test for brake on accord and crv

Init with bosch safety variables

Some more testing changes (still broken)

Make second test work

* Adds one more ttest

* Cannot implicitly convert type 'int' to 'bool '

* ok to spam resume if controls_allowed==true

* need to use current_controls_allowed. Still need to fix the message blocking

* checking for bus 0 on button spam

* better to use the car name in front of global vars

* even better name and fixed safety tests
2018-06-06 14:20:07 -07:00
rbiasini c7e2c2d696
Cadillac (#119)
* added some steer safety to Cadillac

* bug fixes

* added cadillac full steering safety. To be tested

* RT checks and max checks working. Need to test driver torque based limits

* cadillac steer safety should be done

* unneded lines
2018-06-01 19:45:29 -07:00
George Hotz e7a2b3a209 add ipas tests 2018-04-11 14:42:56 -07:00
Willem Melching 1c88caf917
Safety code testing (#104)
* inital infrastructure for panda safety testing

* add test for toyota acceleration

* test for non real time torque rate limits and refactoring

* add test for cruise disable

* fix toyota limit down

* add tests for realtime limits

* test for torque measurements

* fix toyota test setup

* honda button logic

* test for brake logic

* tests for gas logic

* test steer, gas and brake message contents

* add test script

* fix hardcoded limits
2018-04-02 20:41:52 +02:00