Receiving heartbeat message with pyuavcan cli

Hi.

I am testing with pyuavcan on a raspberry pi and 107-Arduino-UAVCAN on an Arduino MKR. They are connected via CAN bus using MCP2515 on both ends.
I was able to set up pyuavcan and transmit messages using “pyuavcan publish …”. The Arduino is also at least transmitting heartbeat messages. And I can see all messages on the Arduino using candump.

Is it possible to receive the heartbeat messages of the Arduino and display them in pyuavcan cli? Maybe it is somewhere in the documentation but all my tries were not successful.
Is it possible to display all messages from the Arduino node using pyuavcan cli?

Thank you for your help.
Bernhard

Yes, using pyuavcan sub uavcan.node.Heartbeat.1.0. Don’t forget to configure the transport either via --tr=EXPRESSION or export PYUAVCAN_CLI_TRANSPORT=EXPRESSION. Read pyuavcan sub --help for more info.

Not yet, but this is what I am working on.

1 Like

Hi Pavel,

thank you for your answer.

I was able to send to send a heartbeat message with pyuavcan using

pyuavcan publish uavcan.node.Heartbeat.1.0  '{}' --tr='CAN(can.media.socketcan.SocketCANMedia("can0",8),59)'

and I am able to receive this message with pyuavcan using

pyuavcan sub uavcan.node.Heartbeat.1.0 --tr='CAN(can.media.socketcan.SocketCANMedia("can0",8),59)'

could you please verify that the commands used are correct?

Unfortunatelly I cannot decode the heartbeat messages of the arduino with the same commands.
Candump shows the CAN data from the arduino as followed:

 (1608454224.262488)  can0  RX - -       50D   [8]  52 03 00 00 00 00 00 EC   'R.......'
 (1608454225.264198)  can0  RX - -       50D   [8]  53 03 00 00 00 00 00 ED   'S.......'
 (1608454226.265899)  can0  RX - -       50D   [8]  54 03 00 00 00 00 00 EE   'T.......'
 (1608454227.267606)  can0  RX - -       50D   [8]  55 03 00 00 00 00 00 EF   'U.......'
 (1608454228.269286)  can0  RX - -       50D   [8]  56 03 00 00 00 00 00 F0   'V.......'
 (1608454229.270956)  can0  RX - -       50D   [8]  57 03 00 00 00 00 00 F1   'W.......'

what am I doing wrong? why is it not decoded?

Thank you
Bernhard

Notice that the documentation says that the publish command would always broadcast its own heartbeat so you shouldn’t specify it explicitly. Run pyuavcan pub --help to see it.

Other than the above they are correct.

Because the CAN ID is incorrect. UAVCAN uses extended 29-bit CAN IDs, but yours are 11-bit.

@aentinger your turn :wink:
Could you please change the CAN IDs to 29-bit. I will generate an issue on github.

Hi @pavel.kirienko
@aentinger fixed the library and now I am able to receive the messages with pyuavcan.
Here is my output:

---
7509:
  uptime: 55
  health:
    value: 0
  mode:
    value: 0
  vendor_specific_status_code: 0

---
7509:
  uptime: 56
  health:
    value: 0
  mode:
    value: 0
  vendor_specific_status_code: 0

Is it possible to see which node sent the heartbeat?
On a system with multiple nodes the output gets a little bit confusing.

Thank you
Bernhard

That’s what the flag --metadata / -M is for (or the docs in general).

perfect, thank you.

output:

7509:
  _metadata_:
    timestamp:
      system: 1608481566.548898
      monotonic: 4595.125536
    priority: nominal
    transfer_id: 10
    source_node_id: 13
  uptime: 1066
  health:
    value: 0
  mode:
    value: 0
  vendor_specific_status_code: 0
1 Like