Failure on Zed camera's `.open()`

Hi there,

I have a system that runs with 3 cameras in production, all started in immediate succession. I am running the ZED SDK 5.2.3 on a Jetson Orin AGX 64 GB. My program is written in Python.

The issue I am facing is that one of the cameras (changes which one) often fails to start. The logs are usually:

[ZED][ERROR] [Init] Corrupted frames were detected. Please verify that your camera is properly connected.
[ERROR] FAILURE in sl::ERROR_CODE sl::Camera::open(sl::InitParameters)

The error comes after calling cam.open(init_params), where my init_params are defined like this:

def _init_params(self, sn: str) -> sl.InitParameters:
        init_params = sl.InitParameters()
        init_params.set_from_serial_number(sn)
        init_params.camera_image_flip = sl.FLIP_MODE.AUTO
        init_params.coordinate_units = sl.UNIT.METER
        init_params.depth_mode = sl.DEPTH_MODE.NEURAL_LIGHT
        init_params.camera_resolution = sl.RESOLUTION.SVGA
        init_params.coordinate_system = sl.COORDINATE_SYSTEM.RIGHT_HANDED_Y_UP
        init_params.camera_fps = 30
        init_params.depth_maximum_distance = 20
        return init_params

The interesting thing is that on each startup, it is generally a different camera which errors out (seems to be a random one of the three). I’d say about 50% of the time it’s one of the cameras, 50% it’s none of them. I’ve yet to see 2+ error on the same run.

The fact that each camera takes turns erroring on startup makes me think it is not a hardware/connection issue.

Is startup failure a known issue with the 5.2.3 SDK? Or is there something funky with my init parameters? Or do I need to wait longer before I start each camera?

Any insight is welcome.

Thanks!

I am having same issues with new cameras. I have cameras that we bought years ago and they don’t have these issues, yet I have cameras bought a month ago that do. They haven’t confirmed anything yet; I’m waiting for a reply, but I think there have been changes to the camera drivers and they’re causing a conflict.

Also, sometimes it starts up fine but then ends up crashing and can’t recover; I’d like Stereolabs to provide more information about these issues, which, from what I can see on this forum, are quite common

Hi @stripedapus
How are you opening the cameras?
Are you using a multi-threaded application?
Can you share the full opening code?

@CristianViSa please create a new thread to discuss your problem separately.

Hi @Myzhar

I am using a multi-threaded application, but each camera is opened on the main thread and then uses a background thread for grabs/retrievals. However, we are failing before we even get to the background thread. It looks something like this:

# Main thread:
cameras = []
for sn in serial_numbers:
  cam = MyZedCamera(sn)
  cam.start()
  cameras.append(cam)

class MyZedCamera
  def __init__(self, sn: str):
    params = self._init_params(sn)
    self.zed = sl.Camera()
    status = self.zed.open(init_params)

    if status != sl.ERROR_CODE.SUCCESS:
      print("THIS IS WHERE THE ERROR HAPPENS")


    self.zed.enable_positional_tracking(sl.PositionalTrackingParameters())
    obj = sl.ObjectDetectionParameters()
    obj.detection_model = sl.OBJECT_DETECTION_MODEL.CUSTOM_YOLOLIKE_BOX_OBJECTS
    obj.custom_onnx_file = "my_model.onnx"
    self.zed.enable_object_detection(obj)

    self.worker_thread = threading.Thread(target=self.loop)
    
  def _init_params(self, sn: str) -> sl.InitParameters:
        init_params = sl.InitParameters()
        init_params.set_from_serial_number(sn)
        init_params.camera_image_flip = sl.FLIP_MODE.AUTO
        init_params.coordinate_units = sl.UNIT.METER
        init_params.depth_mode = sl.DEPTH_MODE.NEURAL_LIGHT
        init_params.camera_resolution = sl.RESOLUTION.SVGA
        init_params.coordinate_system = sl.COORDINATE_SYSTEM.RIGHT_HANDED_Y_UP
        init_params.camera_fps = 30
        init_params.depth_maximum_distance = 20
        return init_params

  def loop(self):
    # This is run in a background thread
    self.zed.grab()
    # Retrieve images, data, etc and copy to output buffers

  def start(self):
    # Just starts the background thread
    self.worker_thread.start()

Please let me know if you need some more information.

Thanks!

I recommend you analyze the error to better understand what’s happening:

if status > sl.ERROR_CODE.SUCCESS: → Error
if status < sl.ERROR_CODE.SUCCESS: → Warning
if status == sl.ERROR_CODE.SUCCESS: → Good