DSDL compilation error

Hello, I have just tried to compile a DSDL libryry from https://github.com/UAVCAN/public_regulated_data_types/archive/master.zip according the manual from https://pyuavcan.readthedocs.io/en/latest/pages/usage.html, but there is an error:

Error: UndefinedDataTypeError: c:\work\public_regulated_data_types\regulated\zubax\actuator\esc\AngVelSetpoint.0.1.uavcan:6: Data type uavcan.si.unit.angular_velocity.Scalar.1.0 could not be found in the following root namespaces: {'public_regulated_data_types'}

I have checked the structure of directories and could find the file uavcan/si/unit/angular_velocity/Scalar.1.0.uavcan
I also have tested the dsdl structure with a test.py, no errors were shown there.

What is the reason for this error?

P.S. I have removed the whole regulated directory from the DSDL structure, but couldn’t compile it again with a similar error message:
Error: UndefinedDataTypeError: c:\work\public_regulated_data_types\uavcan\diagnostic\32760.Record.1.0.uavcan:4: Data type uavcan.time.SynchronizedTimestamp.1.0 could not be found in the following root namespaces: {'public_regulated_data_types'}

The hint is right here:

could not be found in the following root namespaces: {‘public_regulated_data_types’}

What the tool is trying to say is that the root namespace is configured to be public_regulated_data_types, which should alert the user about the problem because it actually should be uavcan. To invoke the tool correctly, pass the path of the uavcan directory instead of public_regulated_data_types.

P.S. tracking here: https://github.com/UAVCAN/pydsdl/issues/42

Thank you for your reply, it really helps always.
One more thing: how could it work with an instruction from the manual:
uvc dsdl-gen-pkg ../dsdl/namespaces/sirius_cyber_corp/ https://github.com/UAVCAN/public_regulated_data_types/archive/master.zip
As I see, the master.zip from the command has the same internal structure with public_regulated_data_types directory inside.

I could compile it successfully, but there is another issue with the compiled dsdl structure, it was stored locally, but I couldn’t start any action with it from the same working directory, I had to move the compiled structure to the python directory with site-packages. Probably uvc can’t work with data from any other directory?

The tool tries to be clever about this: it picks the top-level directories in the archive and uses them as the root namespace directories. The documentation actually says just that:

[pavel@deep-thought demo]$ uvc dsdl-gen-pkg --help
usage: uvc dsdl-generate-packages [-h] [--lookup LOOKUP_PATH_OR_URI] [--output OUTPUT] [--allow-unregulated-fixed-port-id]
                                  INPUT_PATH_OR_URI [INPUT_PATH_OR_URI ...]

positional arguments:
  INPUT_PATH_OR_URI     Either a local path or an URI pointing to the source DSDL root namespace(s).
                        Can be specified more than once to process multiple namespaces at once.
                        If the value is a local path, it must point to a local DSDL root namespace
                        directory or to a local archive containing DSDL root namespace directories
                        at the top level. If the value is an URI, it must point to an archive
                        containing DSDL root namespace directories at the top level (this is
                        convenient for generating packages from namespaces hosted in public
                        repositories, e.g., on GitHub).

You need to export PYTHONPATH=. or whatever directory you want.

  --output OUTPUT, -O OUTPUT
                        Path to the directory where the generated packages will be stored.
                        If not specified, defaults to the current working directory.
                        Existing packages will be overwritten entirely.
                        The destination directory should be in PYTHONPATH to use the generated

May be I understand it wrong, but this phrase from the manuak was very confusing:

This is the command:

uvc dsdl-gen-pkg …/dsdl/namespaces/sirius_cyber_corp/ https://github.com/UAVCAN/public_regulated_data_types/archive/master.zip

That’s it. The DSDL-generated packages have been stored in the current working directory, so now we can use them. If you decided to change the working directory, please make sure to update the PYTHONPATH environment variable to include the path where the generated packages are stored, otherwise you won’t be able to import them. Alternatively, you can just move the generated packages to a new location (they are location-invariant) or just generate them anew where needed.

It means for me you can use the structure from the working directory and have to redefine the PYTHONPATH only if it’s stored anywhere else.

I see. At any rate, the doc need not updating because this will be addressed by https://github.com/UAVCAN/pyuavcan/issues/118.