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

Multiple cameras in pyrealsense2 #1089

Closed
holstenholsten opened this issue Jan 28, 2018 · 14 comments
Closed

Multiple cameras in pyrealsense2 #1089

holstenholsten opened this issue Jan 28, 2018 · 14 comments

Comments

@holstenholsten
Copy link

holstenholsten commented Jan 28, 2018

Required Info
Camera Model SR300
Firmware Version 3.15.0.0
Operating System & Version macOs 10.12.6
SDK Version 2.8.2

Hi! Is there any way to capture depth and rgb from multiple sensors, using the python wrapper?

@zivsha
Copy link
Contributor

zivsha commented Jan 28, 2018

Hi @holstenholsten ,
What do you mean by multiple sensors?
In general, anything you can do with the C/ C++ API, you can do with the python wrapper. Since all of our tools and example are using the C/C++ API , whatever you can do with them you can do with pyrealsense2

@holstenholsten
Copy link
Author

Thank you for your reply! I meant cameras. Do you know of any example code that is equivalent to the C++ rs-multicam example, but in python? https://github.com/IntelRealSense/librealsense/tree/master/examples/multicam

@zivsha
Copy link
Contributor

zivsha commented Jan 29, 2018

Unfortunately no. But the logic of rs-multicam could be easily converted to python.
I think that someone posted some code or link to code that does multicam in Python, so I suggest looking it up. Feel free to ask for help if you have any issue implementing such a script, and if you like what you've done, and feel like sharing,we can add it to our python examples.

@holstenholsten
Copy link
Author

Thank you, I have looked into it and it seems doable.
We have experienced some trouble with connecting more than one camera. Streaming of depth and colour works well for one camera. However, when we have two cameras connected, then only one shows up in device list in python. The same thing happens in C++.
In realsense-viewer, the connected camera disconnects when we plug in a new camera.
The new camera is then connected, and we can't see the first one anymore.
Is this a known problem?

@zivsha
Copy link
Contributor

zivsha commented Jan 31, 2018

This usually ends up being a USB port/cable issue, You can try to look up other issues with similar issues and try the suggested solutions. Some major points: are you using USB3? is your cable long (>2m)? is this a USB hub with no external power? does the same thing happen on a different machine?

@jlgarcia75
Copy link

Hello @holstenholsten,

Do you still need help with this issue?

Regards,
Jesus
Intel Customer Support

@holstenholsten
Copy link
Author

Hi @jlgarcia75,
Thank you for checking in. I tried with a powered usb 3.0 hub. The result turned out be be very unexpected and weird:
It does not work when we connect one camera to the hub with external power. But if I then pull out the external power cable, it works! I do not know why this is happening. Maybe there are some capacitors in the hub that makes the power supply even?
When we connect a second camera, none of the them work (with or with out external power).
To answer your previous questions:
we use usb 3.0,
the cable is about one meter,
we have tried on two machines: MacBook Pro (Early 2015) and a Mac Pro.

We think we have the code in python for multiple cameras, but due to the hardware issues, we have not gotten to test it out yet.

As far as I understand, there is only one usb bus in the macs. I also think the usb hub only has one chip-set. I am no expert in the usb-protocol, but could this be an issue? Do you have any ideas about what is happening?

Kind regards,
Fredrik

@RealSense-Customer-Engineering
Copy link
Collaborator

[Realsense Customer Engineering Team Comment]
Hi @holstenholstenyo

You can run below command to show the USB port capability on your MAC NB to us.

$ ioreg -p IOUSB -w0 -l

I suspect it could be the USB bandwidth issue once two D415 cameras both stream. If only one XHCI controller on MAC, it could be the case.
However, recently, just tried one D410 and one D415 both on two separate USB3 ports of one MacBook Air (Early 2014) and used the 2.10.1 realsense-viewer (Add Source option) with the default settings to enable all streams. D410 (IR and Depth) and D415 (IR, Depth, Color) all streams can work well.
Note: Both D410 and D415 firmware version is 5.8.15.

@holstenholsten
Copy link
Author

I have two sr300 connected to an active usb 3.0 hub. It's a lot, but here it is:

+-o AppleUSBXHCI Root Hub Simulation@14000000 <class AppleUSBRootHubDevice, id 0x100000352, registered, matched, active, busy 0 (6 ms), retain 11>
| {
| "iManufacturer" = 0
| "bNumConfigurations" = 1
| "idProduct" = 32775
| "bMaxPacketSize0" = 8
| "Built-In" = Yes
| "iProduct" = 0
| "USB Product Name" = "AppleUSBXHCI Root Hub Simulation"
| "iSerialNumber" = 0
| "bDeviceClass" = 9
| "IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=4,"CapabilityFlags"=32768,"MaxPowerState"=4,"DriverPowerState"=4}
| "IOUserClientClass" = "IOUSBDeviceUserClientV2"
| "locationID" = 335544320
| "bDeviceSubClass" = 255
| "bcdUSB" = 256
| "non-removable" = "yes"
| "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
| "bDeviceProtocol" = 3
| "USB Vendor Name" = "Apple Inc."
| "Device Speed" = 3
| "idVendor" = 1452
| "IOGeneralInterest" = "IOCommand is not serializable"
| "IOClassNameOverride" = "IOUSBRootHubDevice"
| }
|
+-o Bluetooth USB Host Controller@14300000 <class AppleUSBDevice, id 0x1000005b6, registered, matched, active, busy 0 (10 ms), retain 21>
| {
| "sessionID" = 10227604755
| "iManufacturer" = 1
| "bNumConfigurations" = 1
| "idProduct" = 33424
| "bcdDevice" = 339
| "Bus Power Available" = 250
| "USB Address" = 4
| "bMaxPacketSize0" = 64
| "iProduct" = 2
| "iSerialNumber" = 0
| "bDeviceClass" = 239
| "Built-In" = Yes
| "locationID" = 338690048
| "bDeviceSubClass" = 2
| "bcdUSB" = 513
| "USB Product Name" = "Bluetooth USB Host Controller"
| "PortNum" = 3
| "non-removable" = "yes"
| "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
| "bDeviceProtocol" = 1
| "IOUserClientClass" = "IOUSBDeviceUserClientV2"
| "IOPowerManagement" = {"DevicePowerState"=2,"CurrentPowerState"=3,"CapabilityFlags"=65536,"MaxPowerState"=4,"DriverPowerState"=3}
| "kUSBCurrentConfiguration" = 1
| "Device Speed" = 1
| "USB Vendor Name" = "Broadcom Corp."
| "idVendor" = 1452
| "IOGeneralInterest" = "IOCommand is not serializable"
| "IOClassNameOverride" = "IOUSBDevice"
| }
|
+-o USB2.0 Hub@14200000 <class AppleUSBDevice, id 0x10000151e, registered, matched, active, busy 0 (3 ms), retain 13>
| | {
| | "sessionID" = 18652721430821
| | "iManufacturer" = 1
| | "bNumConfigurations" = 1
| | "idProduct" = 1552
| | "bcdDevice" = 36914
| | "Bus Power Available" = 250
| | "USB Address" = 17
| | "bMaxPacketSize0" = 64
| | "iProduct" = 2
| | "iSerialNumber" = 0
| | "bDeviceClass" = 9
| | "Built-In" = No
| | "locationID" = 337641472
| | "bDeviceSubClass" = 0
| | "bcdUSB" = 512
| | "USB Product Name" = "USB2.0 Hub"
| | "PortNum" = 2
| | "non-removable" = "no"
| | "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
| | "bDeviceProtocol" = 2
| | "IOUserClientClass" = "IOUSBDeviceUserClientV2"
| | "IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=3,"CapabilityFlags"=65536,"MaxPowerState"=4,"DriverPowerState"=3}
| | "kUSBCurrentConfiguration" = 1
| | "Device Speed" = 2
| | "USB Vendor Name" = "GenesysLogic"
| | "idVendor" = 1507
| | "IOGeneralInterest" = "IOCommand is not serializable"
| | "IOClassNameOverride" = "IOUSBDevice"
| | }
| |
| +-o USB2.0 Hub@14210000 <class AppleUSBDevice, id 0x10000154c, registered, matched, active, busy 0 (3 ms), retain 12>
| | | {
| | | "sessionID" = 18653003338663
| | | "iManufacturer" = 1
| | | "bNumConfigurations" = 1
| | | "idProduct" = 1552
| | | "bcdDevice" = 17520
| | | "Bus Power Available" = 250
| | | "USB Address" = 19
| | | "bMaxPacketSize0" = 64
| | | "iProduct" = 2
| | | "iSerialNumber" = 0
| | | "bDeviceClass" = 9
| | | "Built-In" = No
| | | "locationID" = 337707008
| | | "bDeviceSubClass" = 0
| | | "bcdUSB" = 528
| | | "USB Product Name" = "USB2.0 Hub"
| | | "PortNum" = 1
| | | "non-removable" = "no"
| | | "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
| | | "bDeviceProtocol" = 2
| | | "IOUserClientClass" = "IOUSBDeviceUserClientV2"
| | | "IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=3,"CapabilityFlags"=65536,"MaxPowerState"=4,"DriverPowerState"=3}
| | | "kUSBCurrentConfiguration" = 1
| | | "Device Speed" = 2
| | | "USB Vendor Name" = "GenesysLogic"
| | | "idVendor" = 1507
| | | "IOGeneralInterest" = "IOCommand is not serializable"
| | | "IOClassNameOverride" = "IOUSBDevice"
| | | }
| | |
| | +-o BlasterX Senz3D VF0810@14212000 <class AppleUSBDevice, id 0x100001571, registered, matched, active, busy 0 (107 ms), retain 15>
| | {
| | "sessionID" = 18653815888730
| | "iManufacturer" = 1
| | "bNumConfigurations" = 1
| | "idProduct" = 16539
| | "bcdDevice" = 4096
| | "Bus Power Available" = 250
| | "USB Address" = 21
| | "bMaxPacketSize0" = 64
| | "iProduct" = 2
| | "iSerialNumber" = 3
| | "bDeviceClass" = 0
| | "Built-In" = No
| | "locationID" = 337715200
| | "bDeviceSubClass" = 0
| | "bcdUSB" = 512
| | "USB Product Name" = "BlasterX Senz3D VF0810"
| | "PortNum" = 2
| | "non-removable" = "yes"
| | "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
| | "bDeviceProtocol" = 0
| | "IOUserClientClass" = "IOUSBDeviceUserClientV2"
| | "IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=3,"CapabilityFlags"=65536,"MaxPowerState"=4,"DriverPowerState"=3}
| | "kUSBCurrentConfiguration" = 1
| | "Device Speed" = 1
| | "USB Vendor Name" = "Creative Technology Ltd"
| | "idVendor" = 1054
| | "IOGeneralInterest" = "IOCommand is not serializable"
| | "USB Serial Number" = "170424155716"
| | "IOClassNameOverride" = "IOUSBDevice"
| | }
| |
| +-o USB2.0 Hub@14240000 <class AppleUSBDevice, id 0x100001652, registered, matched, active, busy 0 (3 ms), retain 12>
| | {
| | "sessionID" = 19014453483927
| | "iManufacturer" = 1
| | "bNumConfigurations" = 1
| | "idProduct" = 1552
| | "bcdDevice" = 17520
| | "Bus Power Available" = 250
| | "USB Address" = 23
| | "bMaxPacketSize0" = 64
| | "iProduct" = 2
| | "iSerialNumber" = 0
| | "bDeviceClass" = 9
| | "Built-In" = No
| | "locationID" = 337903616
| | "bDeviceSubClass" = 0
| | "bcdUSB" = 528
| | "USB Product Name" = "USB2.0 Hub"
| | "PortNum" = 4
| | "non-removable" = "no"
| | "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
| | "bDeviceProtocol" = 2
| | "IOUserClientClass" = "IOUSBDeviceUserClientV2"
| | "IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=3,"CapabilityFlags"=65536,"MaxPowerState"=4,"DriverPowerState"=3}
| | "kUSBCurrentConfiguration" = 1
| | "Device Speed" = 2
| | "USB Vendor Name" = "GenesysLogic"
| | "idVendor" = 1507
| | "IOGeneralInterest" = "IOCommand is not serializable"
| | "IOClassNameOverride" = "IOUSBDevice"
| | }
| |
| +-o BlasterX Senz3D VF0810@14242000 <class AppleUSBDevice, id 0x100001677, registered, matched, active, busy 0 (104 ms), retain 15>
| {
| "sessionID" = 19015541970456
| "iManufacturer" = 1
| "bNumConfigurations" = 1
| "idProduct" = 16539
| "bcdDevice" = 4096
| "Bus Power Available" = 250
| "USB Address" = 25
| "bMaxPacketSize0" = 64
| "iProduct" = 2
| "iSerialNumber" = 3
| "bDeviceClass" = 0
| "Built-In" = No
| "locationID" = 337911808
| "bDeviceSubClass" = 0
| "bcdUSB" = 512
| "USB Product Name" = "BlasterX Senz3D VF0810"
| "PortNum" = 2
| "non-removable" = "yes"
| "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
| "bDeviceProtocol" = 0
| "IOUserClientClass" = "IOUSBDeviceUserClientV2"
| "IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=3,"CapabilityFlags"=65536,"MaxPowerState"=4,"DriverPowerState"=3}
| "kUSBCurrentConfiguration" = 1
| "Device Speed" = 1
| "USB Vendor Name" = "Creative Technology Ltd"
| "idVendor" = 1054
| "IOGeneralInterest" = "IOCommand is not serializable"
| "USB Serial Number" = "161009213712"
| "IOClassNameOverride" = "IOUSBDevice"
| }
|
+-o USB3.0 Hub@14500000 <class AppleUSBDevice, id 0x100001533, registered, matched, active, busy 0 (4 ms), retain 13>
| {
| "sessionID" = 18652775124919
| "iManufacturer" = 1
| "bNumConfigurations" = 1
| "idProduct" = 1554
| "bcdDevice" = 36914
| "Bus Power Available" = 450
| "USB Address" = 18
| "bMaxPacketSize0" = 9
| "iProduct" = 2
| "iSerialNumber" = 0
| "bDeviceClass" = 9
| "Built-In" = No
| "locationID" = 340787200
| "bDeviceSubClass" = 0
| "bcdUSB" = 768
| "USB Product Name" = "USB3.0 Hub"
| "PortNum" = 5
| "non-removable" = "no"
| "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
| "bDeviceProtocol" = 3
| "IOUserClientClass" = "IOUSBDeviceUserClientV2"
| "IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=3,"CapabilityFlags"=65536,"MaxPowerState"=4,"DriverPowerState"=3}
| "kUSBCurrentConfiguration" = 1
| "Device Speed" = 3
| "USB Vendor Name" = "GenesysLogic"
| "idVendor" = 1507
| "IOGeneralInterest" = "IOCommand is not serializable"
| "IOClassNameOverride" = "IOUSBDevice"
| }
|
+-o USB3.0 Hub@14510000 <class AppleUSBDevice, id 0x10000155d, registered, matched, active, busy 0 (3 ms), retain 12>
| | {
| | "sessionID" = 18653310055842
| | "iManufacturer" = 1
| | "bNumConfigurations" = 1
| | "idProduct" = 1558
| | "bcdDevice" = 17520
| | "Bus Power Available" = 450
| | "USB Address" = 20
| | "bMaxPacketSize0" = 9
| | "iProduct" = 2
| | "iSerialNumber" = 0
| | "bDeviceClass" = 9
| | "Built-In" = No
| | "locationID" = 340852736
| | "bDeviceSubClass" = 0
| | "bcdUSB" = 784
| | "USB Product Name" = "USB3.0 Hub"
| | "PortNum" = 1
| | "non-removable" = "no"
| | "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
| | "bDeviceProtocol" = 3
| | "IOUserClientClass" = "IOUSBDeviceUserClientV2"
| | "IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=3,"CapabilityFlags"=65536,"MaxPowerState"=4,"DriverPowerState"=3}
| | "kUSBCurrentConfiguration" = 1
| | "Device Speed" = 3
| | "USB Vendor Name" = "GenesysLogic"
| | "idVendor" = 1507
| | "IOGeneralInterest" = "IOCommand is not serializable"
| | "IOClassNameOverride" = "IOUSBDevice"
| | }
| |
| +-o Intel(R) RealSense(TM) Camera SR300@14511000 <class AppleUSBDevice, id 0x1000015a1, registered, matched, active, busy 0 (182 ms), retain 26>
| {
| "sessionID" = 18655154745830
| "iManufacturer" = 1
| "bNumConfigurations" = 1
| "idProduct" = 2725
| "bcdDevice" = 12528
| "Bus Power Available" = 450
| "USB Address" = 22
| "bMaxPacketSize0" = 9
| "iProduct" = 2
| "iSerialNumber" = 0
| "bDeviceClass" = 239
| "Built-In" = No
| "locationID" = 340856832
| "bDeviceSubClass" = 2
| "bcdUSB" = 768
| "USB Product Name" = "Intel(R) RealSense(TM) Camera SR300"
| "PortNum" = 1
| "non-removable" = "yes"
| "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
| "bDeviceProtocol" = 1
| "IOUserClientClass" = "IOUSBDeviceUserClientV2"
| "IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=3,"CapabilityFlags"=65536,"MaxPowerState"=4,"DriverPowerState"=3}
| "kUSBCurrentConfiguration" = 1
| "Device Speed" = 3
| "USB Vendor Name" = "Intel(R) RealSense(TM) Camera SR300"
| "idVendor" = 32902
| "IOGeneralInterest" = "IOCommand is not serializable"
| "IOClassNameOverride" = "IOUSBDevice"
| }
|
+-o USB3.0 Hub@14540000 <class AppleUSBDevice, id 0x100001663, registered, matched, active, busy 0 (2 ms), retain 12>
| {
| "sessionID" = 19014479742569
| "iManufacturer" = 1
| "bNumConfigurations" = 1
| "idProduct" = 1558
| "bcdDevice" = 17520
| "Bus Power Available" = 450
| "USB Address" = 24
| "bMaxPacketSize0" = 9
| "iProduct" = 2
| "iSerialNumber" = 0
| "bDeviceClass" = 9
| "Built-In" = No
| "locationID" = 341049344
| "bDeviceSubClass" = 0
| "bcdUSB" = 784
| "USB Product Name" = "USB3.0 Hub"
| "PortNum" = 4
| "non-removable" = "no"
| "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
| "bDeviceProtocol" = 3
| "IOUserClientClass" = "IOUSBDeviceUserClientV2"
| "IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=3,"CapabilityFlags"=65536,"MaxPowerState"=4,"DriverPowerState"=3}
| "kUSBCurrentConfiguration" = 1
| "Device Speed" = 3
| "USB Vendor Name" = "GenesysLogic"
| "idVendor" = 1507
| "IOGeneralInterest" = "IOCommand is not serializable"
| "IOClassNameOverride" = "IOUSBDevice"
| }
|
+-o Intel(R) RealSense(TM) Camera SR300@14541000 <class AppleUSBDevice, id 0x1000016a7, registered, matched, active, busy 0 (181 ms), retain 24>
{
"sessionID" = 19016883168674
"iManufacturer" = 1
"bNumConfigurations" = 1
"idProduct" = 2725
"bcdDevice" = 12528
"Bus Power Available" = 450
"USB Address" = 26
"bMaxPacketSize0" = 9
"iProduct" = 2
"iSerialNumber" = 0
"bDeviceClass" = 239
"Built-In" = No
"locationID" = 341053440
"bDeviceSubClass" = 2
"bcdUSB" = 768
"USB Product Name" = "Intel(R) RealSense(TM) Camera SR300"
"PortNum" = 1
"non-removable" = "yes"
"IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
"bDeviceProtocol" = 1
"IOUserClientClass" = "IOUSBDeviceUserClientV2"
"IOPowerManagement" = {"DevicePowerState"=0,"CurrentPowerState"=4,"CapabilityFlags"=32768,"MaxPowerState"=4,"DriverPowerState"=4}
"kUSBCurrentConfiguration" = 1
"Device Speed" = 3
"USB Vendor Name" = "Intel(R) RealSense(TM) Camera SR300"
"idVendor" = 32902
"IOGeneralInterest" = "IOCommand is not serializable"
"IOClassNameOverride" = "IOUSBDevice"
}

@RealSense-Customer-Engineering
Copy link
Collaborator

[Realsense Customer Engineering Team Comment]
This issue can be also reproduced for two SR300 cameras on MacBook Air. But, no this issue for two D400 cameras. Need to further track this issue internally.

@sharpriy
Copy link

Hi...
Is this issue resolved? Could you pls share the python script to capture frames parallely from multiple D415 using pyrealsense2
I have tried with one and it's fine with that

@RealSense-Customer-Engineering
Copy link
Collaborator

[Realsense Customer Engineering Team Comment]
Hi @sharpriy,

You can refer to below to see if this code resolves your issue.
#1735

@RealSense-Customer-Engineering
Copy link
Collaborator

[Realsense Customer Engineering Team Comment]
hi @sharpriy,

do you need more support on this topic?

@ivomarvan
Copy link

I wrote an example of connecting multiple Realsense cameras in Python:
https://github.com/ivomarvan/samples_and_experiments/tree/master/Multiple_realsense_cameras
Enjoy it if you find it useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants