-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Add ability to open multiple devices from different processes (libtm and t265) #4261
Comments
Hi @orshefi - Librealsense already has some ability to stream with multiple cameras / processes, though with some rules to follow. I hope the information in the link below will be a useful reference for your project goal. |
@MartyG-RealSense - Please read carefully. I want to stream two different t265 devices from two differet processes. As you can see from the ticket I attached this feature isn't supported in the current version. I want to add this feature. |
I am not certain why the systems described in the documentation do not meet your needs. It says that it allows you to "Stream from camera A in one process and from camera B in another process". Can you provide more details please about how this is different from streaming different T265 from two different processes, please. |
Hi @orshefi The way this should be solved, is by removing However, it's very likely a work-around can be implemented in less time, without changing the architecture. My thinking was to replace this code with a "lazy" version of itself. So basically the manager would identify a device, download firmware, but instead of creating actual |
Hi @dorodnic, About the second solution (DevicePlaceholder), I could not understand so far where does the locking happen and why does it effects the different processes, does it locks all the devices with the t265 vendor:product ID? About the first (and right solution from my point of view) solution (removing Manager):
As long as I port the libtm device class to implement the device abstract methods the architecture should support this new device type and the query mechanism should handle the new camera? |
Yes. IMHO
You understand the problem correctly. From my experience with the code base I can still advise that this is a sizable amount of work. Firmware download flow must be handled somewhere, also getting to libusb handle from context can require some hacking. Finally, getting two processes to play nice with each other without getting occasional resource busy errors (let's say when both are doing query_devices), requires extra work. There is refactoring already in progress to address some of these limitations. |
Hi @dorodnic First thing first, I want to start sharing my code changes in order to receive guidance and review from you guys, please send me a reference on how to do so. Here's what I have so far:
Next thing I'd like to do is to change the device creation method, but there is something I can't understand. What the difference between the TrackingDevice.h and the Device.h, here are my thoughts:
In another matter, I think that firmware update shouldn't be a part of the project build because it sets a constraint that forces the project to be built on an internet-enabled station and on top of that it couples the process of build and fw update which is decoupled by nature (f.e. the process of fw update in D415). |
The issue with persistent update is that Movidius does not store firmware image on-board, and was designed to receive new firmware upon every power-up. You can open pull-request to share and collaborate on this. I'm not entirely sure about Device.h. The listener in librealsense is generic, abstracted via device_watcher interface, plugging into the context. From there, the new detected device_info should trigger creation of a tm2_device / sensor that would get libusb handle from info and pass it to the constructor of TrackingDevice |
@dorodnic now I understand the complexity involved with the right solution, it is very complicated and demands a deep understanding of the different libraries. The other solution you suggested seems reasonable so before working my way through it I'd like to clarify some things I may not fully understand: The way I understood the flow (device_hub, pipeline, sensors, etc..) eventually it all comes down to the create function in tm-info.h before the actual query of the data from the camera. Do you agree? Do the libusb_ref_device is the only function that locks the device and blocking the query_device mechanism from discovering the devices from two processes? |
As far as I understand, yes, libusb_ref_device is the one that locks, but I'm not expert in this specific API (@matkatz ?) |
Thank you for highlighting the issue of not being able to open multiple devices with the T265. We have moved our focus to our next generation of products and consequently, we will not be addressing this issue in the T265. |
Hi guys,
As a followup to this issue #4163 on which I shared my application (and I believe many other users need) to open up multiple cameras from different processes (f.e. two different docker containers)
I would like to offer my and fellow workers help as contributors to accomplish the needed changes to support this ability with libtm.
#4163 (comment)
this comment in specific explains the issue I encountered.
I believe the issue occurs for the library registers a libusb event listener to identify usb attachments, I think somehow it performs system call futex (lock) on the usb bus which prevents other devices to be discovered.
Please guide us through this feature
The text was updated successfully, but these errors were encountered: