Is there a way to communicate with multiple ODrives using one PC at the same time? Is it using find_all, which returns a generator? I have tried change the code in find_any, but that won’t work. Since I have a project needs to control multiple motors and make them work cooperatively, is there a way to do it by just using one PC? What is the code should be like?
I’m sure you can use the existing python interface to do the same. They should have a function to find one by serial number (or /dev/ttyACM* if on native-stream)
Yes you can use find_all, it returns a generator. If you are uncomfortable using generators in Python, you can simply cast it to a list and use the list. So like:
keep in mind that connecting multiple devices to a USB hub doesn’t let you talk to them at the same time, you are talking to them sequentially.
for most things this is ‘good enough’, but if you are needing to have close coordination of movement across axis that are on different boards, this probably will fall out of ‘good enough’ pretty quickly
Just in case anyone stumbles upon this post; the above implementation has changed. The new implementation (currently on the development branch as of December 2019) uses find_any with an additional argument called find_multiple and will return a list containing the connected odrives. See the example below which will look for two odrives connected by USB.
odrives = odrive.find_any(find_multiple=2)
print('found {} ODrives'.format(len(odrives)))
for odrv in odrives:
print(odrv.serial_number)
when run will output
$ ipython find_multiple.py
found 2 ODrives
35606208918856
62093270660151
Im not a Python coder so i might be doing things wrong - i took some code from the fibre library and changed it. with this it will return a list of odrives after 30 seconds. I put it on a timer because i still need to figure out how to make it block right. the file is Odriver.py
How to get this? I’m on latest 0.5.3 odrive and this find_all is still not recognized…
Also I get this ACKN issue via this code:
odrv0 = odrive.find_any(serial_number = “serial number 1 in hex”)
odrv1 = odrive.find_any(serial_number = “serial number 2 in hex”)