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 -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:
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 …
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?
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:
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 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).
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: