Homepage GitHub

Uavcan and raspberry pi

Hi,

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,

Malis

This should be good to start with:

https://uavcan.org/Implementations/Pyuavcan/Tutorials/

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.
https://uavcan.org/Implementations/Pyuavcan/Tutorials/2._Basic_usage/
(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,

Malis

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.

you should check python3

apt-cache policy python3 python3-pip python3-numpy

and install

sudo apt-get install python3-pip python3-numpy
pip3 install pyuavcan[transport_can_pythoncan,transport_serial,cli]

OP seems to be using UAVCAN v0. The instructions you posted are for UAVCAN v1. I would recommend OP to consider switching to v1 though; for that, one should refer to pyuavcan.readthedocs.io.

pip is for python 2.7.
or need to set

alias python=’/usr/bin/python3.7’

~/.bashrc

I have a pyuavcan installed. I am running the script
./show_data_type_info.py
I get.
PyUAVCAN is not installed. Please install from PIP: sudo pip3 install uavcan
library https://github.com/UAVCAN/libcanard is not V1.0?

There are two Python packages related to PyUAVCAN, they cannot be used simultaneously: uavcan that implements v0, and pyuavcan that implements v1. From our earlier conversation I deduce that you need v0, so you should do pip uninstall pyuavcan -y && pip install uavcan.

Support for v1 is implemented in Libcanard in a separate branch, it is very experimental still. I should finalize it soon.

I do not want to use V0. V0 is leaving and will not be supported anymore. or? Where to discuss about new data types(DSDL). I am interested in the parameters for motors, RPM, etc. This is not standard V1.

We don’t yet have a well-defined date for its EOL, but you are correct in your view that new applications should be using v1. The first stage of the v0-v1 transition will begin in 2020Q1, as explained in UAVCAN 2019 roadmap. This is when we are going to update the website and all GitHub repositories to point to v1 by default. For the benefit of existing deployments, v0 will still be available and maintained for a few more years at least.

This forum is the right place for such discussions. If you have a piece of feedback or a proposal, please start a new topic in https://forum.uavcan.org/c/dev.

V1 does not and will not include any application-specific data types. Instead, they are relegated to the regulated namespace, which is outside of the scope of the Specification. Eventually, we will use that to define a set of application-specific profiles, but they are not going to be part of the core specification (think of it like USB device classes or CANopen profiles).

You can learn more about this decision here:

From the other thread:

All regulated data types will use SI, hence radian/second instead of RPM. We are unlikely to accept a data type using RPM because it does not follow the application recommendations outlined in the Specification and in the public regulated data types repository.

We can certainly add a new namespace for your company if it does not replicate the functionality available under existing namespaces and it follows the data type design recommendations. If you would like to go ahead, I recommend you to start a new thread in /c/dev with your proposal.

RPM is not in the si system?

I think this is a dead end. Almost all motor manufacturers use RMP. You do not plan to enter the market of industrial applications? Standards are made for relief, not inconvenience. Do you think that the company is Simems or Bosch, NXP and etc. will someone use a UVACAN with a type zubax? It would be more logical if the type of zubax or another manufacturer was on the Git of the manufacturer, and in the Git UAVCAN there were abstract types. as it is not logical for an advanced abstract protocol.

As explained in Data type regulation policy and membership fees, the idea is to enable vendors to collaborate on abstract, reusable interfaces in a well-regulated fashion. In the longer term, we will use regulated vendor namespaces (such as regulated.zubax) as a base to define standard vendor-agnostic profiles. Keeping such generic namespaces in one repository is necessary to reduce the risk of fragmentation and to simplify their maintenance.

I don’t think the name of a namespace could prevent other companies from using it in their systems or products.