Homepage GitHub

How to get raw data from transport?

Hi there!
How can I get raw (or almost raw) data from transport?
I’ve added seeedstudio support but I’m not ready yet to make PR because I want to test my changes.
I do not need nodes. DSDL or something like that. It would be great if a simple way to work with data exists. Actually I need PyUAVCAN in order to have long messages sending/receiving.
So I have:
media = PythonCANMedia(‘seeedstudio:/dev/ttyUSB0’, 500000)
tr = pyuavcan.transport.can.CANTransport(media, 111)

And I want to get all data from the bus and output it.

Sounds like you’re looking for advanced network diagnostics, specifically pyuavcan.transport.Transport.begin_capture(). A simple demo is also available in the docs:

from pyuavcan.transport import Capture
from pyuavcan.transport.loopback import LoopbackTransport

captured_events = []
def on_capture(cap: Capture) -> None:
    captured_events.append(cap)

tr = LoopbackTransport(None)
tr.begin_capture(on_capture)

For CAN specifically, see pyuavcan.transport.can.CANCapture

Pavel, thanks a lot, it works.