Hello,
For a project we are using the OAK-D Pro PoE on, I would like to build a reconnection mechanism in case the controller loses connection to the OAK-D camera. To this end I have written the following code:
def update_frame(self):
try:
frame = self.video_queue.get().getCvFrame()
if frame is not None:
self.detect_cans(frame)
self.latest_frame = frame
except Exception as e:
self.camera_connected = False
print(f"[Camera Error] Frame capture failed: {str(e)}. Reinitializing camera...")
while True:
try:
self.setup_camera()
self.camera_connected = True
break
setup_camera() contains the coded that initializes the DepthAI pipeline, links up the nodes and instantiates the video queue.
However, when the controller loses connection to the camera (e.g. I pull out the Ethernet cable for 30 seconds or so) the device does not reconnect. It instead throws an error "XLINK_DEVICE_NOT_FOUND". The only way I can get the camera to reconnect is to restart the entire application. The bootloader version is 0.0.28.
Am I missing something? What is the recommended way to restore connection to the OAK-D camera after a device ping has been missed?
Thank you in advance.