[BUG] Multiple OAK-D devices not closing properly
See original GitHub issueDescribe the bug When using multiple OAK-D devices when closing the devices with USB3 the final device will not close properly (meaning you can’t create a new Device from it). This is resolved by powercycling.
To Reproduce Steps to reproduce the behavior:
- Run script: https://github.com/luxonis/depthai-experiments/tree/master/gen2-multiple-devices
- Observe “Connected to XXXXXX” in the console twice
- Quit the script (press q, or CTRL+C, either results in the same issue)
- Re-run the script
- Observe “Connected to XXXXXX” in the console once - potentially followed by an error in the format: RuntimeError: Failed to find device (14442C1041A809D100-ma2480), error message: X_LINK_DEVICE_NOT_FOUND
Expected behavior Running the script multiple times works as the same every time without a need to power cycle.
Screenshots
Attach system log
{
"architecture": "64bit WindowsPE",
"machine": "AMD64",
"platform": "Windows-10-10.0.19041-SP0",
"processor": "AMD64 Family 25 Model 33 Stepping 0, AuthenticAMD",
"python_build": "tags/v3.9.4:1f2e308 Apr 6 2021 13:40:21",
"python_compiler": "MSC v.1928 64 bit (AMD64)",
"python_implementation": "CPython",
"python_version": "3.9.4",
"release": "10",
"system": "Windows",
"version": "10.0.19041",
"win32_ver": "10 10.0.19041 SP0 Multiprocessor Free",
"uname": "Windows Johns-New-PC 10 10.0.19041 AMD64 AMD64 Family 25 Model 33 Stepping 0, AuthenticAMD",
"packages": [
"depthai==2.2.1.0",
"numpy==1.20.2",
"opencv-contrib-python==4.5.1.48",
"pip==21.0.1",
"setuptools==49.2.1"
],
"usb": [
"No USB backend found"
]
}
Additional context The problem does not occur when usb2Mode=True
Issue Analytics
- State:
- Created 2 years ago
- Comments:18 (2 by maintainers)
Top Results From Across the Web
Troubleshooting - DepthAI documentation - Luxonis
For USB OAK cameras, DepthAI can throw an error code like X_LINK_COMMUNICATION_NOT_OPEN or X_LINK_ERROR , which is usually a sign of a bad...
Read more >Poison Oak Management Guidelines - UC IPM
UC home and landscape guidelines for control of Poison Oak.
Read more >Known Issues with Oracle Database Appliance in This Release
Do not create two DB systems concurrently. Instead, complete the creation of one DB system and then create the other. This issue is...
Read more >Follow Proper Pruning Techniques - Aggie Horticulture
Proper pruning enhances the beauty of almost any landscape tree and shrub, ... In most cases, it is better not to prune than...
Read more >Twin Oaks Dual Function Pellet Grill - Even Embers
MANUAL START-UP PROCEDURE (To be used is Hot Rod is not working properly):. Step 1 Ensure the control knob is in the “OFF”...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
From a mixture of AMD updates and latest DepthAI updates I can’t replicate this anymore - so for now I think this is safe to say is fixed, thanks for looking into this.
So after some cleanup of my code I have the following three python functions (it’s very similar to the https://github.com/luxonis/depthai-experiments/blob/master/gen2-multiple-devices/main.py code)
(Using
cv2
,depthai
andcontextlib
as imports)The
create_pipeline
function creates and returns a depthai pipeline that has colour and depth outputs calledrgb
anddepth
The
get_all_cameras
function takes a pipeline and returns a list of devices, a list of rgb source queues and a list of depth source queues.And finally the
close_cameras
function takes a list of devices and closes them (I was originally using thecontextlib.ExitStack()
approach described in the https://github.com/luxonis/depthai-experiments/blob/master/gen2-multiple-devices/main.py file, but I found this harder to troubleshoot which is why I swapped to this approach).Finally the wrapper code to run it all:
In total the file looks like this:
I can confirm that it is primarily occuring when using devices on different USB controllers.
In this screenshot the first 3 executions were taken on my front connector USB ports (ones connected via a USB 3 header). At the red line I swap one of the cameras to use a USB directly attached to the motherboard and I have issues (the 2nd camera isn’t connecting when it’s run again). If I move them both to the motherboard USB then there is no issue.
Ideally they would be connected via different streams to not run into bandwidth limitations on a USB controller (this is a common issue with SteamVR basestations and tracker dongles overwhelming USB controllers), but I can accept running them this way.