Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic device discovery + support multiple ODrives #10

Merged
merged 8 commits into from
Sep 25, 2023

Conversation

dreusel
Copy link
Contributor

@dreusel dreusel commented Sep 3, 2023

This supports dynamic discovery of ODrives (ie devices connecting/disconnecting/reconnecting/rebooting while the program is running). It also adds support for interfacing with multiple ODrives simultaneously and adds a reboot button per ODrive.

This builds upon (but pretty much re-does) #9
This fixes #4

where 'uncalibrated' is abused as a proxy for 'disabled' or unused.
a) uncalibrated axi can't do much in this gui anyway
b) they are likely unused or even non-existent (on single-axis boards)
c) this allows for nicer rendering in case of multiple single-axis boards
@dreusel dreusel changed the title Feat/dynamic device discovery Dynamic device discovery + support multiple ODrives Sep 3, 2023
@dreusel
Copy link
Contributor Author

dreusel commented Sep 11, 2023

Any thoughts about this @falkoschindler @rodja?

@rodja
Copy link
Member

rodja commented Sep 12, 2023

@falkoschindler is currently not in the office. He will have a look early next week.

@falkoschindler
Copy link
Contributor

Hi @dreusel, thanks for this PR! I finally found the time for a review:

  • I thought I could catch the fibre.ObjectLostError directly (without the need for checking __name__). But it doesn't seem to work, so I'll change it back to your solution. Anyway, the ODrive doesn't re-appear when rebooting. Does it work for you?
  • I added a check for EmtpyInterface in update(). There are other places where the UI update can crash while rebooting the ODrive. But I guess that's not critical.
  • I simplified the discovery_loop() quite a bit. I guess you wanted to preserve the order of re-appearing ODrives. But as far as I can tell, your implementation didn't work, because new elements are always added as the last dictionary item. And I wasn't sure if the algorithm would glitch if multiple ODrives appear in the same loop cycle, e.g. when connected via a USB hub. So I changed it to a more general approach.

From my point of view we can merge this pull request. When disconnecting and reconnecting ODrives, the UI is updated correctly. I hope it's still working for you as well.
And improving the reboot behavior might be something for another PR...

@falkoschindler falkoschindler merged commit c46e324 into zauberzeug:main Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Breaks and never recovers when the odrive is disconnected
3 participants