Homepage GitHub

Uavcan and raspberry pi

(Malis) #1


I was trying to set up my raspberry pi 3b to communicate to a device via pyuavcan.
Is there any tutorial on how to set it up and smoke testing?

Best regards,


(Pavel Kirienko) #2

This should be good to start with:


(Malis) #3

Hi Pavel,

Thanks a lot for your reply.
Here is the error I get when I try to run the create node basic usage script.
(I apologize in advance, I m a beginner)

Traceback (most recent call last):
File “create_no.py”, line 8, in
node_info.hardware_version.unique_id = b’12345’ # Setting first 5 bytes; rest will be kept zero
File “/home/pi/.local/lib/python2.7/site-packages/uavcan/transport.py”, line 589, in setattr
raise AttributeError(‘Array field could not be constructed from the provided value’, ex)
AttributeError: (u’Array field could not be constructed from the provided value’, ValueError(u’encode() can be used only with string-like arrays’,))

Any idea?

Side question, I’m trying to close and retrieve an exiting node, but cannot find a way to do it because I get:

closing(uavcan.driver.make_node('can0', bitrate=500000))

NameError: name ‘uavcan’ is not defined

if I run

import uavcan
from contextlib import closing
closing(uavcan.driver.make_node(‘can0’, bitrate=500000))

Best regards,


(Pavel Kirienko) #4

Wrong version of Python. The tutorial says:

This tutorial will walk you through the basic usage of Pyuavcan. It is intended for execution in an interactive shell of Python 3.4 or newer. While Pyuavcan supports Python 2.7, its use is strongly discouraged.

You shouldn’t see the error if you use Python 3. You should also beware that Python 2.7 will reach its end-of-life in 4 months so writing any new software in it is probably not a good idea.