Homepage GitHub

Unknown directive 'sealed' error when trying to generate from DSDL

I am getting started with UAVCAN, and I read the guide here: The UAVCAN Guide

I’m trying to follow along with the guide, but I am having issues trying to generate python packages from DSDL:

  $ pyuavcan dsdl-gen-pkg https://github.com/UAVCAN/public_regulated_data_types/archive/master.zip .
Error: InvalidDirectiveError: /tmp/pyuavcan-cli-dsdl_bh8zclg/public_regulated_data_types-master/uavcan/time/SynchronizedTimestamp.1.0.uavcan:19: Unknown directive 'sealed'

I have the same issue if I clone public_regulated_data_types and try to generate from there (master branch)

  $ pyuavcan dsdl-gen-pkg ../public_regulated_data_types/uavcan/ .
Error: InvalidDirectiveError: /home/sdo91/example/public_regulated_data_types/uavcan/time/SynchronizedTimestamp.1.0.uavcan:19: Unknown directive 'sealed'

It looks like sealed was added in a recent commit to public_regulated_data_types (~ 7 days ago), so I’m wondering if that is a new feature and maybe I just have the wrong version of pyuavcan?

  $ pyuavcan --version
pyuavcan 1.1.0.dev1

Any help would be appreciated. Thanks!

Sorry, we are in the transitory phase where we just added a new capability to DSDL but PyUAVCAN is not yet updated. Please use this revision instead:


I will be updating PyUAVCAN once this PR is merged:

1 Like

I try

$ pyuavcan dsdl-generate-packages https://github.com/UAVCAN/public_regulated_data_types/archive/1647e666b0df041a4775364f3fd8faae349b154e.zip
$ pyuavcan -v sub --transport 'pyuavcan.transport.serial.SerialTransport("/dev/ttyUSB0", None, baudrate=115200)' uavcan.node.Heartbeat.1.0
2020-10-20 08:40:20,937  6372 INFO     pyuavcan._cli._main: Consider installing "coloredlogs" from PyPI to make log messages look better
2020-10-20 08:40:20,964  6372 INFO     pyuavcan._cli.commands._subsystems.transport: Expression 'pyuavcan.transport.serial.SerialTransport("/dev/ttyUSB0", None, baudrate=115200)' yields SerialTransport('<serial baudrate="115200" srv_mult="2">/dev/ttyUSB0</serial>', ProtocolParameters(transfer_id_modulo=18446744073709551616, max_nodes=4096, mtu=1073741824), local_node_id=None)
Error: ValueError: The data spec string specifies a non-existent short type name: 'uavcan.node.Heartbeat.1.0'
2020-10-20 08:40:21,233  6372 INFO     pyuavcan._cli._main: Unhandled exception: The data spec string specifies a non-existent short type name: 'uavcan.node.Heartbeat.1.0'
Traceback (most recent call last):
  File "/home/pat1/compilazioni/pyuavcan-v1/lib/python3.7/site-packages/pyuavcan/_cli/_main.py", line 24, in main
  File "/home/pat1/compilazioni/pyuavcan-v1/lib/python3.7/site-packages/pyuavcan/_cli/_main.py", line 50, in _main_impl
    result = args.func(args)
  File "/home/pat1/compilazioni/pyuavcan-v1/lib/python3.7/site-packages/pyuavcan/_cli/_main.py", line 149, in execute
    return cmd.execute(args, subsystems)
  File "/home/pat1/compilazioni/pyuavcan-v1/lib/python3.7/site-packages/pyuavcan/_cli/commands/subscribe.py", line 90, in execute
    subject_specs = [_util.construct_port_id_and_type(ds) for ds in args.subject_spec]
  File "/home/pat1/compilazioni/pyuavcan-v1/lib/python3.7/site-packages/pyuavcan/_cli/commands/subscribe.py", line 90, in <listcomp>
    subject_specs = [_util.construct_port_id_and_type(ds) for ds in args.subject_spec]
  File "/home/pat1/compilazioni/pyuavcan-v1/lib/python3.7/site-packages/pyuavcan/_cli/commands/_util.py", line 61, in construct_port_id_and_type
    raise ValueError(f'The data spec string specifies a non-existent short type name: {spec!r}') from None
ValueError: The data spec string specifies a non-existent short type name: 'uavcan.node.Heartbeat.1.0'
$ pyuavcan --version
pyuavcan 1.1.0.dev1

I am wrong ? We have to wait pyuavcan 1.6 will be released?

You did everything right except for one bit: you forgot to tell Python where to look for your generated package uavcan. You can do that by exporting the environment variable PYTHONPATH like:

$ export PYTHONPATH=/path/to/directory/

Replace the directory as necessary.

I just reproduced this verbatim successfully on my machine to be sure:

$ pyuavcan dsdl-generate-packages https://github.com/UAVCAN/public_regulated_data_types/archive/1647e666b0df041a4775364f3fd8faae349b154e.zip
$ export PYTHONPATH=.
$ pyuavcan -v sub --transport 'pyuavcan.transport.serial.SerialTransport("/dev/ttyUSB0", None, baudrate=115200)' uavcan.node.Heartbeat.1.0

Many users have stumbled upon this, so we will be improving the user experience:

PyUAVCAN v1.1.dev2 will support the new DSDL features and it will be compatible with UAVCAN Spec v1.0-beta. It will happen soon.

Perfect, thank you, I have lost this information, excuse me.
So if I cannot see any output using my test uavcan v1 (using stm32, platformio, stm32duino, licanard) and pyuavcan, it’s because I have to wait for PyUAVCAN v1.1.dev2 or I have to looking for a bug on my side?

pyuavcan -v sub --transport ‘pyuavcan.transport.serial.SerialTransport("/dev/ttyUSB0", None, baudrate=115200)’ uavcan.node.Heartbeat.1.0
2020-10-20 19:34:09 14907 INFO pyuavcan._cli.commands._subsystems.transport: Expression ‘pyuavcan.transport.serial.SerialTransport("/dev/ttyUSB0", None, baudrate=115200)’ yields SerialTransport(’/dev/ttyUSB0’, ProtocolParameters(transfer_id_modulo=18446744073709551616, max_nodes=4096, mtu=1073741824), local_node_id=None)
… no output …

thanks for your support

I am not sure how this should work. You seem to be using UAVCAN/CAN in the embedded application and UAVCAN/serial on your PC. Which part is doing the translation between UAVCAN/serial and UAVCAN/CAN?

I am using two bluepill STM32board with two MCP2551 CAN transceiver connected by CAN bus.
One with the test firmware with libcanard and the other with my own very simple slcan adapter for CAN-USB https://github.com/r-map/rmap/blob/master/platformio/test/slcan/src/slcan.ino

The same configuration I have used to test uavcan v0 with this firmware https://github.com/r-map/rmap/tree/master/platformio/test/uavcan-v0/src and gui_tool https://github.com/UAVCAN/gui_tool getting somethings to work and starting to exercise with uavcan

The main idea you should understand is that UAVCAN works on top of many different transports, not just CAN. If you are using UAVCAN/CAN, you should configure the appropriate transport in PyUAVCAN. Right now you are using UAVCAN/serial instead of UAVCAN/CAN, so it won’t work because these transports are completely unrelated.

When invoking the CLI tool, replace your SerialTransport("/dev/ttyUSB0", None, baudrate=115200) with something like CAN(can.media.socketcan.SocketCANMedia('vcan0',8),None). You will need to set up vcan0 using slcand.

We also have this yet-unmerged PR contributed by @polaris where the support for PythonCAN is added (it is functionally complete but the tests are missing); you may consider using it as an alternative because it doesn’t require tinkering with slcand:

Now I am having a different issue.

This command you gave above works on my ubuntu 16.04 system:
pyuavcan dsdl-gen-pkg https://github.com/UAVCAN/public_regulated_data_types/archive/1647e666b0df041a4775364f3fd8faae349b154e.zip

but the exact same command fails if I run on a different system (which happens to be ubuntu 18.04):

$ pyuavcan dsdl-gen-pkg https://github.com/UAVCAN/public_regulated_data_types/archive/1647e666b0df041a4775364f3fd8faae349b154e.zip
Error: AssertionCheckFailureError: /tmp/pyuavcan-cli-dsdli5yttmx_/public_regulated_data_types-1647e666b0df041a4775364f3fd8faae349b154e/uavcan/diagnostic/32760.Record.1.0.uavcan:15: Assertion check has failed

I am using pyuavcan 1.1.0.dev1 on both systems. Any ideas how I can resolve this AssertionCheckFailureError? Thanks.

Please run pip install pydsdl==1.4. We will start freezing the requirements starting with v1.1.dev2, I suppose.

1 Like

Looks like that works, thanks.

Sounds like that might be a good idea

Thanks for your support.
Using slcand and SocketCAN with the right transport get better results:

$ pyuavcan sub --transport "pyuavcan.transport.can.CANTransport(can.media.socketcan.SocketCANMedia('can0',8),None)" uavcan.node.Heartbeat.1.0
  uptime: 102001
  health: 0
  mode: 0
  vendor_specific_status_code: 0

  uptime: 103001
  health: 0
  mode: 0
  vendor_specific_status_code: 0

  uptime: 104001
  health: 0
  mode: 0
  vendor_specific_status_code: 0

a good starting point!

1 Like