SciKit-Surgery / scikit-surgerynditracker

Easy communication with NDI trackers (Polaris Vicra, Spectra, Vega, and Aurora)
https://github.com/SciKit-Surgery
Other
42 stars 11 forks source link

Simultaneously Probe Serial Ports for NDI devices #62

Open rajkundu opened 1 year ago

rajkundu commented 1 year ago

Currently, it takes about 5-10 seconds to initialize an NDI camera on my computer (16" Intel MacBook Pro, macOS 12.5). This is because of the following code, which sequentially probes serial ports for NDI devices: https://github.com/SciKit-Surgery/scikit-surgerynditracker/blob/26bd21b2e01c96df5444a019ae7149e5cf42b44c/sksurgerynditracker/nditracker.py#L57-L64 Therefore, on my computer, serial port 0 (/dev/cu.BLTH) is always unnecessarily probed before serial port 1 (/dev/cu.usbserial-144130, the NDI Camera).

The current best workaround is to set configuration['serial port'] = '/dev/cu.usbserial-144130'. This works fine, but it would be nice to have functionality which probes serial ports simultaneously and returns as soon as any NDI device is found.

rajkundu commented 1 year ago

Any thoughts on this?

thompson318 commented 1 year ago

It sounds sensible, I just left a comment on the pull request.