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:

https://github.com/UAVCAN/public_regulated_data_types/archive/1647e666b0df041a4775364f3fd8faae349b154e.zip

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
    exit(_main_impl())
  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
---
32085:
  uptime: 102001
  health: 0
  mode: 0
  vendor_specific_status_code: 0

---
32085:
  uptime: 103001
  health: 0
  mode: 0
  vendor_specific_status_code: 0

---
32085:
  uptime: 104001
  health: 0
  mode: 0
  vendor_specific_status_code: 0

a good starting point!

1 Like

PyUAVCAN v1.1.dev2 is now available. This version is compliant with Specification v1.0-beta and is on track to become the first stable release of PyUAVCAN soon (due to historical complications going back all the way to 2016, version 1.0 was never released; v1.1 will be the first stable one).

Install: pip install -U pyuavcan[transport_can_pythoncan,transport_serial,cli]

Read the docs: https://pyuavcan.readthedocs.io/en/latest/

after an upgrade to PyUAVCAN v1.1.dev2

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

pyuavcan dsdl-generate-packages https://github.com/UAVCAN/public_regulated_data_types/archive/1647e666b0df041a4775364f3fd8faae349b154e.zip
Error: TemplateAssertionError: no test named ‘DelimitedType’

Please do pip install -U pydsdl. This is because Nunavut is still pointing to PyDSDL v1.4, needs updating.

Thaks !
better

pyuavcan -v dsdl-gen-pkg https://github.com/UAVCAN/public_regulated_data_types/archive/master.zip

2020-11-02 19:28:39 23840 INFO pyuavcan.dsdl._compiler: Generated 40 types from the root namespace ‘reg’ in 6.786482.1 seconds
2020-11-02 19:28:39 23840 INFO pyuavcan._cli.commands.dsdl_generate_packages: Generating DSDL package PosixPath(’/home/pat1/compilazioni/pyuavcan-v1/.vscode’) from root namespace PosixPath(’/tmp/pyuavcan-cli-dsdl8gyxm0s8/public_regulated_data_types-master/.vscode’) with lookup dirs: [’/tmp/pyuavcan-cli-dsdl8gyxm0s8/public_regulated_data_types-master/reg’, ‘/tmp/pyuavcan-cli-dsdl8gyxm0s8/public_regulated_data_types-master/uavcan’, ‘/tmp/pyuavcan-cli-dsdl8gyxm0s8/public_regulated_data_types-master/.vscode’]
2020-11-02 19:28:39 23840 INFO pydsdl._namespace: The namespace at ‘/tmp/pyuavcan-cli-dsdl8gyxm0s8/public_regulated_data_types-master/.vscode’ is empty
Error: ValueError: not enough values to unpack (expected 1, got 0)
2020-11-02 19:28:39 23840 INFO pyuavcan._cli._main: Unhandled exception: not enough values to unpack (expected 1, got 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
exit(_main_impl())
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 146, in execute
return cmd.execute(args, subsystems)
File “/home/pat1/compilazioni/pyuavcan-v1/lib/python3.7/site-packages/pyuavcan/_cli/commands/dsdl_generate_packages.py”, line 114, in execute
allow_unregulated_fixed_port_id=allow_unregulated_fixed_port_id)
File “/home/pat1/compilazioni/pyuavcan-v1/lib/python3.7/site-packages/pyuavcan/_cli/commands/dsdl_generate_packages.py”, line 182, in _generate_dsdl_packages
allow_unregulated_fixed_port_id=allow_unregulated_fixed_port_id)
File “/home/pat1/compilazioni/pyuavcan-v1/lib/python3.7/site-packages/pyuavcan/dsdl/_compiler.py”, line 188, in generate_package
root_namespace_name, = set(map(lambda x: x.root_namespace, composite_types)) # type: str,
ValueError: not enough values to unpack (expected 1, got 0)

It’s a bug. Please clone the DSDL repository manually and generate packages from your local copy. I have registered this issue just now; a fix would be welcome: