v-ivanyshyn / parse_can_logs

Parse CAN logs and visualize data streams on plot
MIT License
50 stars 9 forks source link

Enchancement of supporting input formats #1

Open iDoka opened 3 years ago

iDoka commented 3 years ago

Hi and thanks for that great work. My points are:

The format

0xC2,4871,183,0,0,0,128,80,172,248
0x540,4873,160,0,255,0,255,0,32,0

seems like custom.

The most tools generate and accepts SocketCAN formats as industry standard. Many variants of CAN log formats can be converted to each other in CLI (sed, awk, etc), but not yours.

At least it have two issues:

  1. Mixed digit representation: ID in hex and payload in decimal: SocketCAN-format use hex for both ID and data
  2. Untrivial data order: timestamp in middle of CAN frame body: SocketCAN-format use timestamp at the top of string

For reference here of two possible (from many others) example of SocketCAN logs:

  1. absolute time:

    (1605793322.823716) can0 07A#6294400000108000 R
    (1605793322.823924) can1 120#0000AA9D51FF0090 R
    (1605793322.824380) can1 094#0DF3000080000339 R
    (1605793322.827396) can1 070#18000001070FFFFF R
  2. relative time:

    (000.000000)  can1  RX - -  083   [8]  10 32 70 64 E0 F8 02 6D
    (000.000194)  can0  RX - -  07A   [8]  62 94 40 00 00 10 80 00
    (000.000193)  can1  RX - -  117   [8]  03 CF 04 54 C7 FF 20 00
    (000.000415)  can1  RX - -  340   [8]  AB 86 5F 14 9F 00 40 88
    (000.000655)  can1  RX - -  4A3   [8]  00 6A 77 00 AE 02 40 00
    (000.002030)  can0  RX - -  0A3   [8]  00 00 00 C1 11 00 00 00

The both allows to convert in CSV format, but dec->hex convert and reordering hard to proceed in CLI.

Happy hacking!