Closed maksimdrachov closed 2 years ago
[]
as a glob pattern rather than a literal command, so you should use quotes:pip install 'pycyphal[transport-can-pythoncan,transport-serial,transport-udp]'
It is recommended to keep DSDL namespace directories inside a dedicated directory, such as custom_data_types
in this case, to ensure that the DSDL compiler does not attempt to compile directories that are not DSDL namespaces. It may not make much difference in this specific case but in general it is a good practice to follow.
I think it might be a regression in the demo caused by a recent change introduced in https://github.com/OpenCyphal/pycyphal/pull/236. Could you please check if exporting this fixes the problem:
export CYPHAL_PATH="$HOME/pycyphal-demo/custom_data_types:$HOME/pycyphal-demo/public_regulated_data_types"
This environment variable is supposed to contain a list of paths where the DSDL root namespace directories are to be found. When your Python interpreter encounters an import statement referring to a non-existent module, PyCyphal will go check if any of the paths listed in CYPHAL_PATH
contain a DSDL namespace named like the missing module. If one is found, it will (re)compile all available DSDL namespaces and import the resulting Python package.
This mechanism used to work differently until the recent PR I linked above; we updated the docs accordingly but apparently the demo still requires some work. If this solution fixes the problem, a pull request amending the demo would be very welcome.
So I have my demo_app.py
running:
But then trying to connect with yakut
, I'm getting the following error:
(sudo ifconfig lo0 alias 127.9.0.42 up
doesn't help)
From docs:
The transport could not be initialized or the operation could not be performed because the specified media configuration is invalid.
Error occurs here:
If I run with sudo
, the error changes:
With Yakut Orchestrator:
Please set the node-ID by exporting this:
export UAVCAN__NODE__ID=123 # Pick an arbitrary value in [0,4094]
In the future you can avoid the hassle of exporting env vars manually by simply sourcing something like this:
export UAVCAN__UDP__IFACE='127.9.0.0'
export UAVCAN__NODE__ID=$(yakut accommodate)
echo "Auto-selected node-ID for this session: $UAVCAN__NODE__ID"
If I run with sudo, the error changes
This is because sudo runs the command as a different user from a new session that does not inherit environment variables from the current session:
~ ❯ export ABC=123
~ ❯ bash -c 'echo $ABC'
123
~ ❯ sudo bash -c 'echo $ABC' # Prints nothing.
Can you please confirm that this suggestion worked for you:
- I think it might be a regression in the demo caused by a recent change introduced in https://github.com/OpenCyphal/pycyphal/pull/236. Could you please check if exporting this fixes the problem: <...>
If yes, would you mind helping us fix the guide?
I'm trying to run the PyCyphal demo (as discussed here).
I'm doing the following:
Issue 1: Installing
pycyphal
So instead I did: (which seems to work)
Issue 2: DSDL definitions path
The 2 files are created in path
~/pycyphal-demo/sirius_cyber_corp
initially.Then in the next section, this changes slightly:
I assume this
custom_data_types
folder is unnecessary?Issue 3: No module named
uavcan
Now, when I try to run
demo_app.py
, I'm getting the following error:Btw, I have the same issue in Ubuntu:
I tried running
git submodule update --init --recursive --force
, which didn't help.my code: maksimdrachov/pycyphal-demo