debug: add logs

This commit is contained in:
Cyrille Nofficial 2022-01-28 12:02:24 +01:00
parent c8372239d3
commit 30cb017455

View File

@ -42,14 +42,14 @@ class FramePublisher:
return pipeline return pipeline
def run(self): def run(self):
logger.info("device %s", self._device_info) logger.debug("device %s", self._device_info)
# Connect to device and start pipeline # Connect to device and start pipeline
with dai.Device(self._pipeline, devInfo=self._device_info, usb2Mode=False) as device: with dai.Device(self._pipeline, devInfo=self._device_info, usb2Mode=False) as device:
logger.info('MxId: %s', device.getDeviceInfo().getMxId()) logger.info('MxId: %s', device.getDeviceInfo().getMxId())
logger.info('USB speed: %s', device.getUsbSpeed()) logger.info('USB speed: %s', device.getUsbSpeed())
logger.info('Connected cameras: %s', device.getConnectedCameras()) logger.info('Connected cameras: %s', device.getConnectedCameras())
logger.info("output queues found: %s",device.getOutputQueueNames()) logger.info("output queues found: %s", device.getOutputQueueNames())
device.startPipeline() device.startPipeline()
# Queues # Queues
@ -58,6 +58,7 @@ class FramePublisher:
while True: while True:
try: try:
logger.debug("wait for new frame")
inRgb = q_rgb.get() # blocking call, will wait until a new data has arrived inRgb = q_rgb.get() # blocking call, will wait until a new data has arrived
im_resize = inRgb.getCvFrame() im_resize = inRgb.getCvFrame()
@ -72,10 +73,11 @@ class FramePublisher:
frame_msg.id.created_at.FromMilliseconds(timestamp.ToMilliseconds()) frame_msg.id.created_at.FromMilliseconds(timestamp.ToMilliseconds())
frame_msg.frame = byte_im frame_msg.frame = byte_im
logger.debug("publish frame event to %s", self._frame_topic)
self._mqtt_client.publish(topic=self._frame_topic, self._mqtt_client.publish(topic=self._frame_topic,
payload=frame_msg.SerializeToString(), payload=frame_msg.SerializeToString(),
qos=0, qos=0,
retain=False) retain=False)
except Exception as e: except Exception as e:
logger.exception("unexpected error") logger.exception("unexpected error: %s", str(e))