Commit Graph

57 Commits

Author SHA1 Message Date
Shane Smiskol 2b96bcc456
CANParser: process all signals before updating values (#977)
* process all signals before ending early

* this is more clear

* this is more clear

* Revert "this is more clear"

This reverts commit 75511ec262c7a2c1b84a1e8cefe0d9f323a6834f.

* test!

* comment

* it would return false if any checksum or counter was invalid, not updating last_seen_nanos, so don't change behavior

* we can do this, but I don't like how it's reliant on last_seen_nanos (not explicit) to not break

* back to sanity

* cmt

* rename
2023-11-21 19:23:30 -08:00
Shane Smiskol 098fbe1b0e
CANParser: clip `counter_fail` to the max (#976)
* test

* fix

* clean up

* test

* fix

* clean up

* debug

* Revert "debug"

This reverts commit 3fc8cf5a2073d65cf1efa81515b420a29e8298a4.

* recover

* also can update at bottom since we don't break early

* changes

* Revert "changes"

This reverts commit a3b6fb5f6b38bb2f7ebd46c730487552bde8c6cb.

* don't need \n

* cmt

* no need to change print behavior here

* fix

fix

revert

* info needs \n
2023-11-17 23:53:13 -08:00
vanillagorillaa 23324b20e4
Honda: new EPS faulted value (#874)
* Honda: new EPS faulted value

* fix test

* fix
2023-09-20 00:13:48 -07:00
Adeeb Shihadeh 81aea1a7c3
pre-commit: autoupdate hooks (#931)
* Update pre-commit hook versions

* fix static analysis

---------

Co-authored-by: adeebshihadeh <adeebshihadeh@users.noreply.github.com>
Co-authored-by: Shane Smiskol <shane@smiskol.com>
2023-08-29 13:18:26 -07:00
Justin Newberry 034ca989bd
Parser: disallow duplicate message checks (#930) 2023-08-29 10:09:43 -07:00
Adeeb Shihadeh a1582f5e28
CANParser: parse all signals for given messages (#828)
* CANParser: parse all signals for a message

* update tests

* just use a pair

* rm enforce checks

* rm that

* spacing

* fix nonexistent message test

* message addr check should not have been deleted

* can be cleaned up more

* remove that too

* add comment back

* revert default bus behavior

revert default bus behavior

* can combine this loop

* unused map

* add all

* ensure we track all signals

* remove sanity check

* this wasn't tested before

* Revert "this wasn't tested before"

This reverts commit eb5e9209ebfeeb9a8856305d00ea6f6fcb4efbad.

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2023-08-10 18:49:14 -07:00
Kacper Rączy df9c11ddc1
parser: update_strings propagate cpp exceptions in py bindings (#912)
* Propagate cpp exceptions to py

* Add a test case

* Update can/tests/test_dbc_exceptions.py

Co-authored-by: Shane Smiskol <shane@smiskol.com>

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2023-08-10 13:03:55 -07:00
Adeeb Shihadeh 7d61776e2b disable parser perf test for now 2023-08-08 11:15:16 -07:00
Shane Smiskol 46b59dd99e 'test_dbc_parser: ensure we're running on real DBCs'
Split from https://github.com/commaai/opendbc/pull/828
2023-08-05 00:03:47 -07:00
Shane Smiskol 3ef35ed229
Revert "CANPacker: refactor to avoid undefined signals (#891)" (#899)
This reverts commit 3a0083b41e.
2023-07-17 22:17:11 -07:00
Dean Lee 3a0083b41e
CANPacker: refactor to avoid undefined signals (#891)
* refactor to avoid undefined signals

* add non-zero offset check

* Revert "add non-zero offset check"

This reverts commit bc0bb60f4fdd8ffdca7197ff6dbd3cb50b857c30.

* clean up

* use underscores, we haven't standardized one or the other yet

* use message name

* test it works

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2023-07-14 04:41:27 -07:00
Shane Smiskol f45946fecb
test parser: cleanup test (#894)
* test

* Revert "test"

This reverts commit 406505313cfd6f45569a99fd9546475cb8f65179.

* no partial
2023-07-13 21:59:14 -07:00
Shane Smiskol fe8d535a7f
CANDefine: test all DBCs (#888)
* change addr for ioniq 6

* add new msg

* a test for this

* add to test_dbc_exceptions

* cmt

* fix
2023-07-07 01:09:24 -07:00
Shane Smiskol 33940105be
tests: global constants (#889)
small clean up
2023-07-07 01:02:12 -07:00
Dean Lee 008104f940
CANParser: check if signals exist (#870)
* check if signals exist

* add failing test

* better args and test msg in checks

* also need to check message addrs

* fix up new_msg

* consistent

* check signals if msg addresses are used

* cleanup

* cleanup

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
2023-07-01 02:04:33 -07:00
Shane Smiskol ecd0613872
tests: rename CAN Parser performance test file (#872)
rename
2023-07-01 01:41:22 -07:00
Shane Smiskol 7a760a130a
CANParser: test missing messages in DBC (#871)
test
2023-06-30 15:29:46 -07:00
Dean Lee 8faada0494
refactor CANParser to improve performance (#795)
* reduce the const of copying signal values in CANParser::query_latest

* pass by reference

* use for range loop

* update_strings

* use assign

* track all signals

* use iterator & pointer to avoid copy SignalValue from vector

* use normal dict for vl_all

* update tests

* fix error in merge master

* change thresholds

reduce thresholds

* Trigger CI

* Trigger CI

* Trigger CI

* cleanup ctor

* reduce threshold

* revert changes to test_parser.py

* change thresholds

* remove update_string() from cython

* comment out test_performance_one_signal

* reduce thresholds

* test

* update

* update

* revert that for now

* update

* update

---------

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2023-04-22 17:54:36 -07:00
Adeeb Shihadeh 5adb62bf04
fix parser perf test (#827) 2023-04-21 13:11:53 -07:00
Adeeb Shihadeh 3c81860270
test parser: bump up one signal threshold 2023-04-08 15:36:23 -07:00
Dean Lee f01929f0b9
CANParser: improve cython performance (#802)
* improve cython performance

* change thresholds

* Trigger CI

* reduce threshold for test all signals

* change

* reduce min

* change

* Trigger CI

* Trigger CI

* Trigger CI

* Trigger CI

* change

* Trigger CI

* Trigger CI

* Trigger CI

* Trigger CI

* Trigger CI

* Trigger CI

* Trigger CI

* Trigger CI

* Trigger CI

* Trigger CI

* change

* Trigger CI

* Trigger CI

* Trigger CI

* Trigger CI

* Trigger CI

* Trigger CI

* Trigger CI

* Trigger CI
2023-04-02 07:45:51 -07:00
Dean Lee 0ff25034c4
CANParser: add performance test (#801)
* add benchmarks

* cleanup

* unittest

* thresholds

* add test for update_strings

* change thresholds

* increase to 50000

* trigger ci

* update thresholds

* trigger ci

---------

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2023-03-31 13:50:03 -07:00
Shane Smiskol 21457f0b46
CANParser: ts_nanos test (#785)
* ts_nanos tests

* check set is length 1

* same style as below
2023-02-20 15:19:05 -08:00
martinl e95ed311c1
Add test for Subaru Brake_Status Signal1 large value (#702)
* Add test for Subaru Brake_Status Signal1 large value

* fix

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-09-07 20:37:36 -07:00
Adeeb Shihadeh d9a55f4f7c remove one more duplicate 2022-07-29 15:31:08 -07:00
Adeeb Shihadeh 387dcf9628
teach the packer how to count (#669)
* teach the packer how to count

* fix tests

* same as checksum

* little test
2022-07-21 17:51:49 -07:00
Adeeb Shihadeh e2465cc701
Subaru: Counter -> COUNTER (#666)
* Subaru: Counter -> COUNTER

* run generator

* update tests

* revert that
2022-07-19 16:55:59 -07:00
Adeeb Shihadeh 82be71072c
CANParser: invalid until valid (#648)
* CANParser: invalid until valid

* small test
2022-06-22 15:13:59 -07:00
Adeeb Shihadeh f4b182dae4 Support arbitrary DBC paths 2022-06-22 14:17:22 -07:00
Shane Smiskol fbd2e71c4a
tests: remove DBC parsing timing test (#626)
* instead test parsing all DBCs

* remove print

* add comment for what this tests

* Welcome back, guys. Only adjust good torque if maxLatAccel is set
2022-06-02 16:46:38 -07:00
Shane Smiskol b302f6934e
Dynamically parse DBCs (#602)
* initial commit, bring over from deanlee's PR based on newer commit

Co-authored-by: Shane Smiskol <shane@smiskol.com>

* fix msb, lsb, size

* fix lsb

* clean up

* need this for CI

* add missing body checksum/counter

* get dir from BASEDIR first, then $HOME

* fix CI

* doesn't work

* just hardcode when compiling

* remove process_dbc

* add test for startup time

* test can parsing

* fix

* better

* bye bye dbc.py

* fix startswith

* add function to get dbc names for plotjuggler

* check DBC_FILE_PATH

* revert

* rename

* slightly more consistent at ~0.57 seconds

* make sure the tests make sense

* test ms per line

* use ctre

* Revert "use ctre"

This reverts commit 5e1a4440e465c901403a9717bbdef5b573e9838e.

* compile regex at import time

* add debug print and lower test time

* add comment

* 0.02 ms per line max

* better error messages

* only include what we need, and make it explicit

* check total time

check total time

* no global

* always a list

* not a c loop any more

* default to list

* use hex

* make static (only calculate path once)

* seems to be more consistent now (30-38 ms)

Co-authored-by: Dean Lee <deanlee3@gmail.com>
2022-05-12 17:59:33 -07:00
Adeeb Shihadeh 004db342a8
CANParser: add flag for bus timeout (#586)
* CANParser: add flag for bus timeout

* bump to 500ms

* 10x most frequent msg

* little test

* per bus

* Update can/parser.cc
2022-04-12 22:34:27 -07:00
Chris Souers 5a51aa7dde
Fix Honda checksum for extended CAN IDs. Add test function. (#585)
* Fix checksum for Honda extended CAN. Add test.

* revert packer_parser test

* begin test_checksum

* todo and comments

* convention

* unused

* forgot the s

* again

* cleanup

* remove that too

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-04-06 21:33:57 -07:00
Adeeb Shihadeh 859fea7ded
CAN FD support in packer + parser (#568)
* can fd support in packer + parser

* don't need these anymore

* fix pedal crc

* fix dynamic parsing

* cleanup

* packer test
2022-02-28 09:10:34 -08:00
Adeeb Shihadeh 298c830739
Cleanup dead code in CAN parser + packer (#573)
* remove duplicate implementation

* Cleanup dead code in CAN parser + packer

* little more
2022-02-24 22:58:37 -08:00
Shane Smiskol c3d3c71aa7
CANParser: fix missing updated values (#561)
* test to make sure we don't throw away updated values if we get multiple can frames from boardd

* call cpp's update_string from update_strings

* fix test

* split in half

fix
2022-02-10 14:40:15 -08:00
Shane Smiskol 053a761244
CANParser: add field for all values from a cycle (#558)
* could work

* should be light-speed

* clean up

* clean up

* make sure updated is empty if nothing is updated

updating without a msg is undefined behavior

* should be fast enough

* more test

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2022-02-10 13:01:30 -08:00
Adeeb Shihadeh f74f93629b
CANParser: minor speedup (#560) 2022-02-09 22:46:28 -08:00
Adeeb Shihadeh 24538ceb04 Revert "CANParser: add field for all updated values (#548)"
This reverts commit da47fe5e45.
2022-02-09 22:01:25 -08:00
Shane Smiskol da47fe5e45
CANParser: add field for all updated values (#548)
* add updated field

* rename to updated

* draft

* clean up

* function for resetting

* *minor* refactor

* clean up names

* keep track of updated vals in the cc parser

* remove extra lines

* remove ts

* match parser_pyx

* cleaner to just call the cpp function as we don't need to aggregate updated values

* draft

* some tests

* fix test

* clean up

clean up

* test clean up

* add clarifying comments

* Revert "remove ts"

This reverts commit fd4558289d6667a42ab41c4511b0d8fe54eb7fc8.

* fix order

* use vals

* fix dup
2022-02-07 15:36:00 -08:00
Shane Smiskol 60a246c0a8
tests: remove CANParser default values (#550)
* remove default vals

* remove default vals
2022-02-03 00:24:45 -08:00
Adeeb Shihadeh 51e327947a update test 2022-01-27 08:58:43 -08:00
Marc Wimmershoff 8a62233a83
Python DBC CAN encoder, fix scale/offset (#428)
* Bugfix in dbc CAN encoder

While encoding, we need to subtract the offset first before we apply the factor.

* Update dbc.py

* Forgot to add import for assert_almost_equal

* test against C++ can packer

* turn into unittest

Co-authored-by: Willem Melching <willem.melching@gmail.com>
2021-10-20 16:05:43 +02:00
Willem Melching c7caba4a5c
C++ CAN Packer, add test for scale/offset (#455) 2021-10-20 15:48:15 +02:00
Adeeb Shihadeh 79530d3038
CANParser: add option to enforce message checks (#385)
* CANParser: add option to enforce message checks

* fix testss

* nice error msg

* fix tests
2021-04-24 23:09:56 -07:00
Adeeb Shihadeh 652348a3be
fix generator test and linter (#323)
* fix generator test

* generator cleanup
2020-12-03 13:07:09 -08:00
Adeeb Shihadeh c072d9e8df remove redundant linter checks 2020-11-26 11:36:10 -08:00
Adeeb Shihadeh 244e8807df
ubuntu 16.04 -> 20.04 (#309) 2020-10-29 13:53:48 -07:00
vanillagorillaa fb90ff7a46
Fix all typos in opendbc (#299) 2020-09-29 11:59:26 -07:00
grekiki ccd7d3e438
Fix 222 (#296)
* Added exceptions to packer and parser

* added exception tests

* improve style

* linter is annoying

* static analysis fix

* static analysis fix2

* static analysis fix3

* clean up the code

* update exceptions

* style1

* style2
2020-09-10 15:01:34 +02:00