0

I would like to replay (Like a Replay Block in CANalyzer) a log CAN through a vector Interface using Python-can.

import can

def bus_log():
    bus1 = can.interface.Bus(bustype='vector', app_name='CANalyzer', channel=1, bitrate=500000)
    bus2 = can.interface.Bus(bustype='vector', app_name='CANalyzer', channel=2, bitrate=500000)

    fileReplay = can.LogReader('*.asc', 'w')

I load the log file using can.LogReader but I don't know how to send it to the interface.

Thank you in advance.

  • `bus.send(...)`? There is a file `player.py` coming with python-can which does nothing else but reading a log file and replaying it on the bus. – MSpiller May 23 '22 at 11:30
  • I tried `for msg in can.LogReader('C:/Users/matthieu.benard/Documents/Vehicle Interface Team/Programmation/Python/AutoTermReplay/test.asc'): bus1.send_periodic(msg, 0.01)` but the console pul me up : xlCanTransmit failed (XL_ERR_QUEUE_IS_FULL) [Error Code 11] – Matthieu Benard May 23 '22 at 12:58
  • You try to send each and every can message you find in the log file 100-times per seconds? That seems to be too much for the bus interface – MSpiller May 23 '22 at 13:22
  • In the log CAN, you have some frame with 10ms period and CANalyzer can easily do a replay. That I want to do but with Python – Matthieu Benard May 23 '22 at 13:55
  • You do not provide much information, so this is all guesswork. In the log there is most likely like this: Frame A is sent, 10 ms later, frame A is sent again, and so on. What you do is sending Frame A, 10 ms later send Frame A twice, 10ms later, send Frame A three times. – MSpiller May 23 '22 at 14:49

0 Answers0