forked from commaai/openpilot
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
panda safety test that replays drives of saved CAN messages (commaai#151
) * panda safety test that replays drives of saved CAN messages * utility to trim Cabana CSV logs to just messages relevant for panda safety testing * when trimming, only output the same line once even if it matches both criteria
- Loading branch information
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env python2 | ||
|
||
# This trims CAN message CSV files to just the messages relevant for Panda testing. | ||
# Usage: | ||
# cat input.csv | ./trim_csv.py > output.csv | ||
import fileinput | ||
|
||
addr_to_keep = [544, 0x1f4, 0x292] # For Chrysler, update to the addresses that matter for you. | ||
|
||
for line in fileinput.input(): | ||
line = line.strip() | ||
cols = line.split(',') | ||
if len(cols) != 4: | ||
continue # malformed, such as at the end or every 60s. | ||
(_, addr, bus, _) = cols | ||
if (addr == 'addr'): | ||
continue | ||
if (int(bus) == 128): # Keep all messages sent by OpenPilot. | ||
print line | ||
elif (int(addr) in addr_to_keep): | ||
print line |