hardbyte / hardbyte/python-can

Implement a configurable rate limit

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

Beschreibung

I am using python-can (more specifically canopen) to send out messages to a bunch or nodes.

Issues seem to arise when I send a lot of packets at the same time, my assumption is that the recipients can not keep up with the frame stream, and thus packets are dropped.

My Idea is to implement some sort of rate limiting, for example by passing messages to a queue and having the library send out all queued messages with an interval inbetween.

Something like
```
queue = queue.Queue()

while True:
msg = queue.get() # blocking
transmit(msg)
time.sleep(1 / self.max_messages_per_second)
```

Cheers!

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

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