DepthAI 库会查找同一 LAN 内的所有可用设备。如果摄像头不在同一 LAN 中,您可以手动指定设备的 IP 地址。如果没有 DHCP 服务器,摄像头会回退到静态 IP 169.254.1.222。测试设备的最佳方法是运行 OAK 查看器。这是一个图形界面应用程序,可通过实时可视化输出来轻松评估摄像头。如果它找到了设备并开始流式传输帧,则说明连接正常。
调试
如果您遇到类似 RuntimeError: No available devices 的错误,说明 DepthAI 无法在同一子网中找到任何 PoE 设备。请确保摄像头已通电并连接到与您的计算机相同的网络。请参阅下方选项卡中的调试步骤。我们建议在进行任何故障排除之前使用最新的 depthai 版本。
Different Subnet
DepthAI 库仅在同一子网内搜索可用的 OAK PoE 相机。您仍然可以 ping 相机,但自动发现功能不会找到设备。如果相机不在同一子网,可以手动指定设备 IP,如下代码所示。
Python
Py
1import depthai as dai
2pipeline = dai.Pipeline()3# ... Populate pipeline ...45# 定义设备的 IP 地址6device_info = dai.DeviceInfo("169.254.1.222")78with dai.Device(device_info)as device:9# Define queues, get messages...
C++
C++
1#include"depthai/depthai.hpp"23intmain(int argc,char** argv){4 dai::Pipeline pipeline;5// ... Populate pipeline ...67// 定义设备的 IP 地址8auto deviceInfo = dai::DeviceInfo("169.254.1.222");910 dai::Devicedevice(deviceInfo);1112// Define queues, get messages...13return0;14}
Multiple interfaces
当使用PoE设备且PC同时连接到WiFi和以太网时,需要调整网络路由以避免连接问题。 一个常见问题是系统检测到同一个PoE设备两次,导致初始化错误 (RuntimeError: Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND)。快速修复:断开WiFi连接以避免重复设备发现。您也可以手动配置网络路由,确保DepthAI 设备通过PoE通信,同时通过WiFi保持互联网访问:
By default, PoE devices will try to get a dynamic IP address from DHCP server. However, if there's no DHCP server on the network, devices will fall back to their static IP 169.254.1.222. In this case, you can either:
Connect the switch to a router, to get a dynamic IP address from the DHCP server.
Set static IP of your computer (eg. 169.254.1.10, netmask: 255.255.0.0) to be in the same subnet as the PoE device, and then connect to your device.
Manually specify device IP address when connect to it, you can use either IP address or MxId:
Python
Py
1import depthai as dai
2pipeline = dai.Pipeline()3# ... Populate pipeline ...4device_info = dai.DeviceInfo("169.254.1.222")5# device_info = depthai.DeviceInfo("14442C108144F1D000") # MXID6# device_info = depthai.DeviceInfo("3.3.3") # USB port name78with dai.Device(device_info)as device:9# Define queues, get messages...
C++
C++
1#include"depthai/depthai.hpp"2intmain(int argc,char** argv){3 dai::Pipeline pipeline;4// ... Populate pipeline ...5auto deviceInfo = dai::DeviceInfo("169.254.1.222");6// auto deviceInfo = dai::DeviceInfo("14442C108144F1D000");7// auto deviceInfo = dai::DeviceInfo("3.3.3");8 dai::Devicedevice(deviceInfo);9// Define queues, get messages...10return0;11}
Multiple devices
If you are using multiple PoE devices, option 2 and 3 won't work, as all devices will try to use the same IP address. If that is the case, you will need to assign static IP addresses to your PoE devices, see set static IP.
OAK Latency test - Should be below 10ms, but it depends on your network
If you get lower bandwidth/latency as expected, you should check debugging steps below. We also have non-PoE-related Low Latency documentation.
Slow networking equipment
If your PoE link speed is below 1000 Mbps, there may be a bottleneck in your setup:
Ethernet Cable: Use Cat5e or higher. While Cat5e supports 1 Gbps, Cat5 is limited to 100 Mbps. It might also be that your cable is damaged, and only 2 pairs are working (up to 100Mbps)
PoE Switch: Ensure it supports 1 Gbps speeds. Such switches are usually labeled 10/100/1000 Mbps.
Router: If applicable, ensure it can handle 1 Gbps. Some routers might have limited ports with this capability.
PoE Injector: Ensure it supports 1 Gbps. Some models are limited to 100 Mbps.
Cable Length: Keep your Ethernet cable under 100 meters (328 feet). For longer distances, use a PoE extender.
Host Network Card: Ensure it supports 1 Gbps. Older cards might be capped at 100 Mbps. If necessary, upgrade your network card.
Do not use WiFi to connect to the PoE device. WiFi is not designed for high bandwidth applications, and will likely result in a bottleneck. If you must use it, use WiFi standards supporting at least 1 Gbps such as 802.11ac (WiFi 5), 802.11ax (WiFi 6), or 802.11ay (WiFi 6E). Note that bandwidth diminishes with distance and obstructions between the router and host.
NIC settings
Some default Network Interface Card (NIC) settings on Linux might not be ideal for communication with OAK POE cameras, which can result in slow FPS, high latency, and/or high OAK CPU usage. You can use ethtool to configure these settings.ethtool settings that provided better performance for usIn one case configuring sudo ethtool -C NAME rx-usecs 1022 (where NAME was enp59s0f1) improved FPS from 12 to 20.
Advance network settings
For advance users only! Luxonis does not provide support for these settings.
For more advance users we have exposed some network settings that allows you to fine-tune the system for better performance. You can configure them with the device config object.For RVC2sysctl configuration, see available settings here (note that some settings are read-only, and some might crash the system). Please refer to FreeBSD's documentation (12.0) for more information on sysctl settings.
Py
1config = dai.Device.Config()2config.board.network.mtu =9000# Jumbo frames. Default 15003config.board.network.xlinkTcpNoDelay =False# Default True4config.board.sysctl.append("net.inet.tcp.delayed_ack=1")# configure sysctl settings. 0 by default.56with dai.Device(config)as device:7# Your code here