jakaskerl Yes, it was the problem of the electrical supply, when I powered independently, everything was solved
ManuelDeUrquijo

- Jul 8, 2024
- Joined Mar 15, 2024
- 0 best answers
To test the power supply I'm going to have to gut the cable to be able to power on one side and send data on the other, I'll report the results when I'm done.
the depthai version: 2.27.0.0
jakaskerl No, The code that I try to run that does not work is exactly the same that can be obtained from the link (https://docs.luxonis.com/software/depthai/examples/tiny_yolo/), I have already made this same code work on the PC, the script is fine and nothing is missing. It is evident that it has to do with a dependency or drivers or something similar
- Edited
I ran the tiny yolo code available at the league (https://docs.luxonis.com/software/depthai/examples/tiny_yolo/) on my computer with Ubuntu 22.04.4 LTS using the OAK-1 LITE and it worked correctly.
Then I tried to run exactly the same code on a raspberry pi 4 with Ubuntu server 22.04.4 LTS and it returned the following error:
File "/home/qsm/depthai-python/examples/Yolo/tiny_yolo.py", line 123, in <module>inRgb = qRgb.get()
RuntimeError: Communication exception - possible device error/misconfiguration. Original message 'Couldn't read data from stream: 'rgb' (X_LINK_ERROR)'
I'm sure it's not the fault of the cable or the camera because it works fine on the computer and I made sure to connect it to USB 3 (the blue one).
I don't know what to do, I thank you in advance to everyone who answers.Note:
The following code runs correctly inside the raspberry without any problem (the program sends a video signal through the socket library and I receive the video in a flutter app that works correctly):import sys
sys.path.append('/home/qsm/.local/lib/python3.10/site-packages')
import socket
import cv2
import depthai as dai
import time
import struct
import netifaces
import threadingwifi_ip =''
for interface in netifaces.interfaces():
if interface.startswith('w'):Obtener la dirección IP de la interfaz WiFi
wifi_ip = netifaces.ifaddresses(interface)[netifaces.AF_INET][0]['addr']
print(wifi_ip)
Create pipeline
pipeline = dai.Pipeline()
Define source and output
camRgb = pipeline.create(dai.node.ColorCamera)
xoutVideo = pipeline.create(dai.node.XLinkOut)xoutVideo.setStreamName("video")
Properties
camRgb.setBoardSocket(dai.CameraBoardSocket.CAM_A)
camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
camRgb.setVideoSize(1280,720)
camRgb.setFps(30)xoutVideo.input.setBlocking(False)
xoutVideo.input.setQueueSize(1)Linking
camRgb.video.link(xoutVideo.input)
Crear un socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
Establecer la dirección y el puerto del servidor
server_address = (wifi_ip, 5000)
Conectar al servidor
sock.bind(server_address)
sock.listen(1)print('Servidor de video iniciado')
def Rx(connection):
while True:
try:
data = connection.recv(1024)
if not data:
break
print(data.decode())
except ConnectionResetError:
print('Conexión cerrada')
break
except Exception as error:
print(f'Error: {error}')
breakConnect to device and start pipeline
with dai.Device(pipeline) as device:
video = device.getOutputQueue(name="video", maxSize=1, blocking=False)
while True:
try:Aceptar una conexión
connection, client_address = sock.accept()
print(f'Conexión establecida con {client_address}')
thread = threading.Thread(target=Rx, args=[connection])
thread.daemon = True # El hilo muere cuando el programa principal termina
thread.start()Recibir la señal de video
while True:
videoIn = video.get()
frame = videoIn.getCvFrame()
_, buffer = cv2.imencode('.jpg', frame, [int(cv2.IMWRITE_JPEG_QUALITY), 50]) # Adjust JPEG quality to 50
data = buffer.tobytes()Enviar el tamaño del frame primero
connection.sendall(struct.pack("L", len(data)) + data)
time.sleep(0.03) # Reduce the sleep interval for smoother streamingCerrar la conexión
connection.close()
except Exception as error:
print(f'Error: {error}')I had problems running the "depthai-viewer" on mi Ubuntu 22.04.4 LTS computer after the instalation (https://docs.luxonis.com/en/latest/pages/tutorials/first_steps/#depthai-viewer). when I install it, the program run perfectly but after closing the program I try to run "depthai-viewer" and it returns "order not found". A person in a forum advice mi to run "sudo python3 -mpip install depthai", after running that the command "depthai-viewer" start working but when I try to change the AI model, the image stop working and the terminal display:
[20s] System information
----------------------------------------
Ddr used / total - 98.30 / 333.45 MiB
Cmx used / total - 2.49 / 2.50 MiB
LeonCss heap used / total - 24.10 / 82.46 MiB
LeonMss heap used / total - 5.01 / 40.66 MiB
Chip temperature - average: 47.58, css: 48.47, mss: 46.90, upa: 48.25, dss: 46.68
Cpu usage - Leon CSS: 47.52 %, Leon MSS: 28.05 %
Pipeline config: auto=False cameras=[CameraConfiguration(fps=30, resolution=<CameraSensorResolution.THE_1080_P: 'THE_1080_P'>, kind=<CameraSensorType.COLOR: 0>, board_socket=<CameraBoardSocket.CAM_A: 0>, stream_enabled=True, name='color')] depth=None ai_model=AiModelConfiguration(display_name='Age gender recognition', path='age-gender-recognition-retail-0013', camera=<CameraBoardSocket.CAM_A: 0>) imu=ImuConfiguration(report_rate=100, batch_report_threshold=5)
Updating pipeline...
Cam running, closing...
Usb speed: UsbSpeed.SUPER
Creating camera: fps=30 resolution=<CameraSensorResolution.THE_1080_P: 'THE_1080_P'> kind=<CameraSensorType.COLOR: 0> board_socket=<CameraBoardSocket.CAM_A: 0> stream_enabled=True name='color'
Connected cam doesn't have IMU, skipping IMU creation...
Starting pipeline
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/manuel/.local/lib/python3.10/site-packages/depthai_viewer/_backend/main.py", line 185, in <module>
DepthaiViewerBack(args.port, args.sdk_port)
File "/home/manuel/.local/lib/python3.10/site-packages/depthai_viewer/_backend/main.py", line 52, in init
self.run()
File "/home/manuel/.local/lib/python3.10/site-packages/depthai_viewer/_backend/main.py", line 158, in run
self.result_queue.put(self.handle_action(action, \*\*kwargs))
File "/home/manuel/.local/lib/python3.10/site-packages/depthai_viewer/_backend/main.py", line 112, in handle_action
message = self.on_update_pipeline(kwargs.get("runtime_only")) # type: ignore[arg-type]
File "/home/manuel/.local/lib/python3.10/site-packages/depthai_viewer/_backend/main.py", line 98, in on_update_pipeline
message = self._device.update_pipeline(runtime_only)
File "/home/manuel/.local/lib/python3.10/site-packages/depthai_viewer/_backend/device.py", line 590, in update_pipeline
self._oak.start(blocking=False)
File "/home/manuel/.local/lib/python3.10/site-packages/depthai_viewer/venv-0.1.8/lib/python3.10/site-packages/depthai_sdk/oak_camera.py", line 499, in start
handler.setup(self.pipeline, self.device, self._new_msg_callbacks)
File "/home/manuel/.local/lib/python3.10/site-packages/depthai_viewer/venv-0.1.8/lib/python3.10/site-packages/depthai_sdk/classes/packet_handlers.py", line 226, in setup
xout = output(device)
File "/home/manuel/.local/lib/python3.10/site-packages/depthai_viewer/venv-0.1.8/lib/python3.10/site-packages/depthai_sdk/components/nn_component.py", line 636, in call
return XoutTwoStage(det_nn=self._comp._input,
File "/home/manuel/.local/lib/python3.10/site-packages/depthai_viewer/venv-0.1.8/lib/python3.10/site-packages/depthai_sdk/oak_outputs/xout/xout_nn.py", line 194, in init
self.whitelist_labels: Optional[List[int]] = second_nn._multi_stage_nn.whitelist_labels
AttributeError: 'NoneType' object has no attribute 'whitelist_labels'
I thank you in advance to everyone who answers