Hi!
According to specification at https://uavcan.org/Implementations/Pyuavcan/Tutorials/2._Basic_usage/
pyuavcen loads vendor specific DSDLs when loaded (import uavcan).
I have places my own definitions at this location:
~/uavcan_vendor_specific_types/mydefs/
# contains 20001.broadcast_type_test.uavcan
Then in my python script I try to load them like this:
import uavcan
node_info = uavcan.protocol.GetNodeInfo.Response()
node_info.name = 'TestNode'
node_info.software_version.major = 1
node = uavcan.make_node('vcan0', node_id=123, bitrate=125000, node_info=node_info)
node.mode = uavcan.protocol.NodeStatus().MODE_OPERATIONAL
def do_publish():
msg = mydefs.broadcast_type_test(value=47)
node.broadcast(msg, priority=uavcan.TRANSFER_PRIORITY_LOWEST)
handle = node.periodic(1, do_publish)
while True:
node.spin(1) # Spin for 1 second or until an exception is thrown
node.close()
However, I det errors when running the script with
python3 myscript.py
...
File "myscript.py", line 19, in do_publish
msg = mydefs.broadcast_type_test(value=47)
NameError: name 'mydefs' is not defined
Sorry for my poor python knowledge, but what am I missing here?
Kind regards