I have a setup with an AGX Orin 64GB, Jetpack 6, 4x ZED X’s, a QUAD capture card, the QUAD Link driver, and ZED SDK 4.1.3
I have a custom C++ program that need to read from all 4 cameras. At the start of my program it spins up 4 background threads (one per camera) and runs the same thread body on each that opens every camera by serial number, then grabs frames. About 80% of the time I get some weird error, usually CAMERA_NOT_DETECTED (but sometimes other ones) on one or two of the cameras. If I retry enough times it will work eventually. It seems to be a race condition when calling “camera.open()” at once across different threads (even for different serial numbers in each thread).
I’ve tried this and seen the same behavior on different AGX Orins, different capture cards, and different cables (including directly to the quad cable). It’s definitely a software issue.
So my question: Are simultaneous calls to camera.open() in the same program expected to work in the latest SDK? Do I need to put a mutex around them or would that be unrelated? And if I do are there other SDK functions I should know about that aren’t “thread safe”?
This has been normal behaviour with both the USB and GMSL cameras since their release. The best solution until SL fix it is to just loop over the camera init thread with a small wait until it stops returning an error.
@multicore-manticore@Waelyn
The multi-threading simultaneous opening issue has been fixed starting from the ZED SDK v4.0.7.
@Waelyn can you check the power mode of your Jetson device? To use 4 ZED X simultaneously the MAXN power mode is highly recommended.
I also recommend running the jetson_clocks script.
Sorry for the late follow up, been trying to get reliable behavior from these cameras and have been hitting a bunch of confusing issues with 4 ZED Xs coming in through GMSL.
For this issue I can confirm that I have been using MAXN and jetson_clocks the whole time.
Adding a mutex around camera.open() and enable object detection/positional tracking, etc. for each camera let’s me open them reliably without any hacky retries or loops. So it definitely seems to be a race condition. I think it might actually be an issue when enabling tracking on one camera while trying to open another