Hello,

i am trying to implement code inside my project that tries to reconnect to the camera without powering off the camera. Is there a way to achieve this. i have tried below code but it doesnt work:

try:

         `Coords_list, frame, cameradata = self.Camera.processImage()  # This is the luxonis camera`

except RuntimeError as e:

       print(f"Camera error: {e}")

      time.sleep(5)

      try:

          self.Camera = Objectdetection()

          print("Camera reconnected")

      except Exception as reconnection_error:

          print(f"Failed to reconnect: {reconnection_error}")

And i get the following error when running this code, is there a way to reconnect to the camera?

qt.qpa.xcb: QXcbConnection: XCB error: 148 (Unknown), sequence: 186, resource id: 0, major code: 140 (Unknown), minor code: 20 Camera error: Device already closed or disconnected: Input/output error [2023-11-23 16:06:07.757] [depthai] [warning] skipping X_LINK_BOOTED device having name "1.1.1.1" [2023-11-23 16:06:08.305] [depthai] [warning] skipping X_LINK_BOOTED device having name "1.1.1.1" Failed to reconnect: No available devices Camera error: Device already closed or disconnected: Input/output error [1944301011C91D1300] [1.1.1.1] [1.758] [SpatialDetectionNetwork(1)] [warning] Network compiled for 6 shaves, maximum available 10, compiling for 5 shaves likely will yield in better performance

  • jakaskerl replied to this.
  • Hi KoenvanWijlick
    You can use this logic to reconnect to a device.

    device.startPipeline(pipeline)
    # random host side code/loop
    
    device.close()

    then just use startpipeline() to reconnect to it again. Without first closing the device, it is not possible to reconnect to it since only one pipeline can run on it at a time.
    Not sure why you would need that anyway.

    Thanks,
    Jaka

    Hi KoenvanWijlick
    You can use this logic to reconnect to a device.

    device.startPipeline(pipeline)
    # random host side code/loop
    
    device.close()

    then just use startpipeline() to reconnect to it again. Without first closing the device, it is not possible to reconnect to it since only one pipeline can run on it at a time.
    Not sure why you would need that anyway.

    Thanks,
    Jaka