hardbyte / hardbyte/python-can

Single millisecond send resolution with python-can, Vector

Offen
#1,777 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Python
Sterne
1.6k
Forks
697
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

python version: 3.9.13, python-can version: 4.0.0

I am trying to send a CAN message every millisecond using python-can to access Vector's CANalyzer software. Using the code below, I would expect to see a message every millisecond:
```
import can
import time
import logging

bus = can.interface.Bus(bustype="vector", channel=0, bitrate=500000, app_name='CANalyzer')

def periodic_send(msg, bus):
task = bus.send_periodic(msg, 0.001)
assert isinstance(task, can.CyclicSendTaskABC)

return task

tasks = []

msg = can.Message(arbitration_id=0xCE, data=[1, 1, 1, 1], is_extended_id=False)
tasks.append(periodic_send(msg,bus))

time.sleep(200)
```

However, when I look at the signal in CANalyzer, it shows the message being sent every 15ms or so (blue measurement cursor is first sample, orange is second):
![image](https://github.com/hardbyte/python-can/assets/24628662/d39b71c0-4363-4e38-8b8f-eaca33d075a3)

I have also tried managing timing directly and have similarly been unable to achieve single millisecond intervals. Is this possible with python-can?

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.