Hi all,
I am fairly new to the game of CAN and Cyphal. I did the pycyphal.com demo, which works like a charm for UDP as transport layer. Now, I would like to utilize CAN as transport layer, instead of UDP. To do this I changed the code accordingly:
export UAVCAN__NODE__ID=42                           # Set the local node-ID 42 (anonymous by default)
export UAVCAN__CAN__IFACE="socketcan:can0"           # Use CAN can0 as transport layer
export UAVCAN__CAN__BITRATE="500000 5000000"         # 500kbits
export UAVCAN__CAN__MTU=16                           # Maximum Transmission Unit (largest package size for a single frame)
export UAVCAN__SUB__TEMPERATURE_SETPOINT__ID=2345    # Subject "temperature_setpoint"    on ID 2345
export UAVCAN__SUB__TEMPERATURE_MEASUREMENT__ID=2346 # Subject "temperature_measurement" on ID 2346
export UAVCAN__PUB__HEATER_VOLTAGE__ID=2347          # Subject "heater_voltage"          on ID 2347
export UAVCAN__SRV__LEAST_SQUARES__ID=123            # Service "least_squares"           on ID 123
export UAVCAN__DIAGNOSTIC__SEVERITY=2 
based on scarcely scattered information on this forum. can0 of course exists, hence
sudo ip link set can0 up type can bitrate 500000
ifconfig
returns
can0: flags=193<UP,RUNNING,NOARP>  mtu 16
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 10  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
and then when running python3 demo_app.py simply returns Running. Press Ctrl+C to stop., as expected. But when aborting, it prints
CDiagnosticPublisher(Publisher(dtype=uavcan.diagnostic.Record.1.1, transport_session=BroadcastCANOutputSession(OutputSessionSpecifier
(data_specifier=MessageDataSpecifier(subject_id=8184), remote_node_id=None), PayloadMetadata(extent_bytes=300)))) TIMEOUT 
uavcan.diagnostic.Record.1.1(timestamp=uavcan.time.SynchronizedTimestamp.1.0(microsecond=0), 
severity=uavcan.diagnostic.Severity.1.0(value=2), text="pycyphal.transport.can.media.socketcan._socketcan: 
SocketCANMedia('can0', mtu=16) FIXME: acceptance filter configuration is not yet implemented; please submit patches! 
Requested configuration: ext:xxx1x0xxxxxxxxx0101010xxxxxxx, ext:xxxxx0xxxxxxxxxxxxxxxx0")
Traceback (most recent call last):
  File "$mypath/demo_app.py", line 159, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 603, in run_forever
    self._run_once()
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1871, in _run_once
    event_list = self._selector.select(timeout)
  File "/usr/lib/python3.10/selectors.py", line 469, in select
    fd_event_list = self._selector.poll(timeout, max_ev)
KeyboardInterrupt
tells me this has not yet been implemented (FIXME: acceptance filter configuration is not yet implemented; please submit patches!), and yakut cannot echo the heartbeat as intended, doing:
export UAVCAN__CAN__IFACE="socketcan:can0"
yakut sub --with-metadata uavcan.node.heartbeat uavcan.diagnostic.record
returns nothing. ifconfig also tells me there’s nothing happening on the BUS (aka RX/TX-packets are 0). Any advice?
— Nice to Know—
When switching between UDP and CAN as transport layer, one must delete the demo_app.db, otherwise things go boomboom.
— Nice to Know —