Hello,
I have a problem with some OAK 1-PoE camera.
I have many cameras all running with the same code in standalone mode.
The cameras are working fine, but after many days, more then half had a problem in getting the images from the node.io queue.
here is a snippet of the pipeline and the retrieving functions:
def get_pipeline(self) -> dai.Pipeline:
pipeline = dai.Pipeline()
cam_rgb = pipeline.create(dai.node.ColorCamera)
cam_rgb.setPreviewKeepAspectRatio(False)
cam_rgb.setPreviewSize(self.config['width'], self.config['height'])
cam_rgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
cam_rgb.setInterleaved(False)
cam_rgb.setColorOrder(dai.ColorCameraProperties.ColorOrder.RGB)
cam_rgb.setFps(self.fps)
if self.angle == '180':
cam_rgb.setImageOrientation(dai.CameraImageOrientation.NORMAL)
video_encoder = pipeline.create(dai.node.VideoEncoder)
video_encoder.setDefaultProfilePreset(60, dai.VideoEncoderProperties.Profile.MJPEG)
cam_rgb.video.link(video_encoder.input)
nn = pipeline.create(dai.node.YoloDetectionNetwork)
nn.setConfidenceThreshold(self.config['conf_threshold'])
nn.setNumClasses(self.config['n_classes'])
nn.setCoordinateSize(self.config['coordinates'])
nn.setIouThreshold(self.config['iou_threshold'])
nn.setBlobPath(Path(self.nn_weights_path))
nn.setNumInferenceThreads(self.config['n_inference_threads'])
nn.input.setBlocking(False)
cam_rgb.preview.link(nn.input)
script = pipeline.create(dai.node.Script)
script.setProcessor(dai.ProcessorType.LEON_CSS)
script = self.set_script(script)
nn.out.link(script.inputs['detections'])
video_encoder.bitstream.link(script.inputs['frame'])
return pipeline`
` def elaboration_loop(self) -> None:
results = {}
while True:
try:
data_im = None
dets = None
counter = 0
if REQUESTS_RECEIVED.is_set():
while (data_im is None or not dets) and counter < 50:
dets = node.io['detections'].get()
pck = node.io['frame'].get()
if pck:
data_im = pck.getData()
if data_im is None or not dets:
counter += 1
time.sleep(0.2)
results['data_im'] = data_im if data_im else None
results['dets'] = dets if dets else []
threading.Thread(target=self.send_results, args=[results,]).start()
REQUESTS_RECEIVED.clear()
else:
node.io['detections'].get()
node.io['frame'].get()
except Exception as e:
self.udp_client.send_message(f"Exception in the elaboration loop: {e} - {traceback.print_exc()}")`
function "elaboration_loop" is started as a thread from the main part of the code, and the actual image retrieving is called setting the REQUESTS_RECEIVED event.
The problem is that when the issue appears, data_im remains "None" and does not recover (meaning calling again the function does not change the result) until the code is flashed again.
Do you have any suggestions?
Is it possible to reboot the camera from within the camera itself without flashing the code?
Thank you