Sarvesh
One thing I'd recommend is using depthai-viewer instead of depthai-demo which is deprecated.
Also try manually specifying the IP in depthai.DeviceInfo().

Thanks,
Jaka

Sarvesh
Whatever script you use to run the pipeline.

eg:

#!/usr/bin/env python3

import cv2
import depthai as dai

# 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(1920, 1080)

xoutVideo.input.setBlocking(False)
xoutVideo.input.setQueueSize(1)

# Linking
camRgb.video.link(xoutVideo.input)

device_info = dai.DeviceInfo("10.12.118.101") # set you device's IP
# Connect to device and start pipeline
with dai.Device(pipeline, deviceInfo=device_info) as device:

    video = device.getOutputQueue(name="video", maxSize=1, blocking=False)

    while True:
        videoIn = video.get()

        # Get BGR frame from NV12 encoded video frame to show with opencv
        # Visualizing the frame on slower hosts might have overhead
        cv2.imshow("video", videoIn.getCvFrame())

        if cv2.waitKey(1) == ord('q'):
            break

Thanks,
Jaka

  • Edited

@jakaskerl Right now, i am running

python3 -m depthai_viewer

So should i edit the init.py or main script?

BTW, when i create a new file, copy the above code and run it separately, i get the following output:

python manual_ip_program.py

Traceback (most recent call last):

File "/home/sarvesh/Desktop/depthai/manual_ip_program.py", line 28, in <module>

with dai.Device(pipeline, deviceInfo=device_info) as device:

     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

TypeError: init(): incompatible constructor arguments. The following argument types are supported:

1\. depthai.Device(pipeline: depthai.Pipeline)

2\. depthai.Device(pipeline: depthai.Pipeline, usb2Mode: bool)

3\. depthai.Device(pipeline: depthai.Pipeline, maxUsbSpeed: depthai.UsbSpeed)

4\. depthai.Device(pipeline: depthai.Pipeline, pathToCmd: Path)

5\. depthai.Device(pipeline: depthai.Pipeline, devInfo: depthai.DeviceInfo, usb2Mode: bool = False)

6\. depthai.Device(pipeline: depthai.Pipeline, deviceInfo: depthai.DeviceInfo, maxUsbSpeed: depthai.UsbSpeed)

7\. depthai.Device(pipeline: depthai.Pipeline, devInfo: depthai.DeviceInfo, pathToCmd: Path)

8\. depthai.Device(version: depthai.OpenVINO.Version = <Version.???: 7>)

9\. depthai.Device(version: depthai.OpenVINO.Version, usb2Mode: bool = False)

10\. depthai.Device(version: depthai.OpenVINO.Version, maxUsbSpeed: depthai.UsbSpeed)

11\. depthai.Device(version: depthai.OpenVINO.Version, pathToCmd: Path)

12\. depthai.Device(version: depthai.OpenVINO.Version, deviceInfo: depthai.DeviceInfo, usb2Mode: bool = False)

13\. depthai.Device(version: depthai.OpenVINO.Version, deviceInfo: depthai.DeviceInfo, maxUsbSpeed: depthai.UsbSpeed)

14\. depthai.Device(version: depthai.OpenVINO.Version, deviceDesc: depthai.DeviceInfo, pathToCmd: Path)

15\. depthai.Device(config: depthai.Device.Config)

16\. depthai.Device(config: depthai.Device.Config, deviceInfo: depthai.DeviceInfo)

17\. depthai.Device(deviceInfo: depthai.DeviceInfo)

18\. depthai.Device(deviceInfo: depthai.DeviceInfo, maxUsbSpeed: depthai.UsbSpeed)

19\. depthai.Device(nameOrDeviceId: str)

20\. depthai.Device(nameOrDeviceId: str, maxUsbSpeed: depthai.UsbSpeed)

Invoked with: <depthai.Pipeline object at 0x7fff27bd3530>; kwargs: deviceInfo=DeviceInfo(name=169.254.1.222, mxid=, X_LINK_ANY_STATE, X_LINK_ANY_PROTOCOL, X_LINK_ANY_PLATFORM, X_LINK_SUCCESS)

    Sarvesh
    Not in viewer program. Try the script I have sent. You seem to have multiple network interfaces which interfere with eachother. Manually specifying IP as in the script i sent above should solve the issues.

    Thanks,
    Jaka

    @jakaskerl

    #!/usr/bin/env python3

    import cv2

    import depthai as dai

    # 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(1920, 1080)

    xoutVideo.input.setBlocking(False)

    xoutVideo.input.setQueueSize(1)

    # Linking

    camRgb.video.link(xoutVideo.input)

    device_info = dai.DeviceInfo("169.254.1.222") # set you device's IP

    # Connect to device and start pipeline

    with dai.Device(pipeline, deviceInfo=device_info) as device:

    video = device.getOutputQueue(name="video", maxSize=1, blocking=False)
    
    while True:
    
        videoIn = video.get()
    
        # Get BGR frame from NV12 encoded video frame to show with opencv
    
        # Visualizing the frame on slower hosts might have overhead
    
        cv2.imshow("video", videoIn.getCvFrame())
    
        if cv2.waitKey(1) == ord('q'):
    
            break

    The above is the script that i copied from your above suggestion and changed the ip to 169.254.1.222. But i get the above error. what do you think i did wrong?

      Sarvesh
      You seem to be using an older depthai version. The constructor args for pipeline and deviceInfo were added in 2.26 I think. Please update to 2.29.0

      Thanks,
      Jaka

      @jakaskerl
      after i upgraded the depthai version and ran the script , I am getting the following error

      [2025-02-15 22:57:08.995] [depthai] [warning] [1844301091159D0F00] [169.254.1.222] Flashed bootloader version 0.0.22, less than 0.0.28 is susceptible to bootup/restart failure. Upgrading is advised, flashing main/factory (not user) bootloader. Available: 0.0.28

      Traceback (most recent call last):

      File "/home/sarvesh/Desktop/depthai/manual_ip_program.py", line 28, in <module>

      with dai.Device(pipeline, deviceInfo=device_info) as device:
      
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

      RuntimeError: Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND

      Update:

      I also updated the bootloader version. But still showing same error:

      RuntimeError: Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND

        Sarvesh
        Ok, now it does sound like a power issue. Please check you have enough power delivery through the POE switch.

        Thanks,
        Jaka

        How do I check if it's receiving power? Is their a script to read the current and voltage recieved?

          Sarvesh
          Unfortunately no. What are you using to power on the device? Make sure it supports POE 802.3af.

          Thanks,
          Jaka

          The green cable is going to the raspberrypi

          What is the difference between 802.3at vs 802.3af?

          @jakaskerl
          Command:

          DEPTHAI_LEVEL=debug python3 -c "import depthai as dai; dai.Device()"

          Output:

          [2025-02-19 14:17:48.545] [depthai] [debug] Python bindings - version: 2.29.0.0 from build: 2024-11-24 11:10:53 +0000

          [2025-02-19 14:17:48.545] [depthai] [debug] Library information - version: 2.29.0, commit: from , build: 2024-11-24 09:23:54 +0000, libusb enabled: true

          [2025-02-19 14:17:48.552] [depthai] [debug] Initialize - finished

          [2025-02-19 14:17:48.705] [depthai] [debug] Resources - Archive 'depthai-bootloader-fwp-0.0.28.tar.xz' open: 3ms, archive read: 152ms

          [2025-02-19 14:17:49.214] [depthai] [debug] Resources - Archive 'depthai-device-fwp-4d360b5c56225f23e9a3d3a3999ce46c90cfdeaf.tar.xz' open: 7ms, archive read: 660ms

          Traceback (most recent call last):

          File "<string>", line 1, in <module>

          RuntimeError: No available devices

          @jakaskerl

          dmesg | grep -i usb

          [ 0.031212] usbcore: registered new interface driver usbfs

          [ 0.031220] usbcore: registered new interface driver hub

          [ 0.031230] usbcore: registered new device driver usb

          [ 0.463165] usbcore: registered new device driver r8152-cfgselector

          [ 0.463173] usbcore: registered new interface driver r8152

          [ 0.463186] usbcore: registered new interface driver lan78xx

          [ 0.463193] usbcore: registered new interface driver smsc95xx

          [ 0.463411] usbcore: registered new interface driver uas

          [ 0.463418] usbcore: registered new interface driver usb-storage

          [ 0.476347] usbcore: registered new interface driver usbhid

          [ 0.476348] usbhid: USB HID core driver

          [ 0.633312] xhci-hcd xhci-hcd.0: new USB bus registered, assigned bus number 1

          [ 0.633841] xhci-hcd xhci-hcd.0: new USB bus registered, assigned bus number 2

          [ 0.633844] xhci-hcd xhci-hcd.0: Host supports USB 3.0 SuperSpeed

          [ 0.633896] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 6.06

          [ 0.633900] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1

          [ 0.633903] usb usb1: Product: xHCI Host Controller

          [ 0.633905] usb usb1: Manufacturer: Linux 6.6.51+rpt-rpi-2712 xhci-hcd

          [ 0.633908] usb usb1: SerialNumber: xhci-hcd.0

          [ 0.634030] hub 1-0:1.0: USB hub found

          [ 0.634179] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 6.06

          [ 0.634182] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1

          [ 0.634184] usb usb2: Product: xHCI Host Controller

          [ 0.634187] usb usb2: Manufacturer: Linux 6.6.51+rpt-rpi-2712 xhci-hcd

          [ 0.634189] usb usb2: SerialNumber: xhci-hcd.0

          [ 0.634278] hub 2-0:1.0: USB hub found

          [ 0.634576] xhci-hcd xhci-hcd.1: new USB bus registered, assigned bus number 3

          [ 0.635101] xhci-hcd xhci-hcd.1: new USB bus registered, assigned bus number 4

          [ 0.635104] xhci-hcd xhci-hcd.1: Host supports USB 3.0 SuperSpeed

          [ 0.635145] usb usb3: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 6.06

          [ 0.635148] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1

          [ 0.635151] usb usb3: Product: xHCI Host Controller

          [ 0.635153] usb usb3: Manufacturer: Linux 6.6.51+rpt-rpi-2712 xhci-hcd

          [ 0.635156] usb usb3: SerialNumber: xhci-hcd.1

          [ 0.635249] hub 3-0:1.0: USB hub found

          [ 0.635389] usb usb4: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 6.06

          [ 0.635392] usb usb4: New USB device strings: Mfr=3, Product=2, SerialNumber=1

          [ 0.635394] usb usb4: Product: xHCI Host Controller

          [ 0.635397] usb usb4: Manufacturer: Linux 6.6.51+rpt-rpi-2712 xhci-hcd

          [ 0.635399] usb usb4: SerialNumber: xhci-hcd.1

          [ 0.635491] hub 4-0:1.0: USB hub found

          [ 0.887832] usb 1-1: new high-speed USB device number 2 using xhci-hcd

          [ 1.044274] usb 1-1: New USB device found, idVendor=0fe6, idProduct=9900, bcdDevice=20.00

          [ 1.044281] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3

          [ 1.044285] usb 1-1: Product: USB 10/100 LAN

          [ 1.044287] usb 1-1: Manufacturer: CoreChips

          [ 1.044290] usb 1-1: SerialNumber: 00E0940A0C02

          [ 1.069911] cdc_ether 1-1:2.0 eth1: register 'cdc_ether' at usb-xhci-hcd.0-1, CDC Ethernet Device, 00:e0:94:0a:0c:02

          [ 1.069946] usbcore: registered new interface driver cdc_ether

          [ 3.074015] usbcore: registered new interface driver brcmfmac

            Sarvesh
            I found that a bunch of injector suffer from this issue.. I'll check if I can repro this and debug.
            Do you have a switch to check?

            Thanks,
            Jaka

            What do you mean by you'll repro ?

            What is a switch? What do you mean?

            Could you also share what is happening in the above error?

              Sarvesh
              I will try to reproduce the issue with a similar injector to see if there is some intrinsic issue regarding how injectors work with POE devices.
              Switch -- network switch (that supports POE)

              Sarvesh Could you also share what is happening in the above error?

              Either not enough power is delivered or the TCP communication doesn't go through.

              Thanks,
              Jaka

              Sarvesh
              From what I gathered ... Ubuntu does find your device on 169.254.1.222 and sets its own IP appropriately to the same range. Issue is that this takes a few moments.
              When running a script the OAK device first shuts down and boots into a different state. When using an injector this means the connection to your PC drops and interface link is closed. Device then boots back up to same 1.222 ip, but the PC is not there anymore and takes about 10s to re-instantiate the interface link.
              In that time the connection times out - resulting in "Failed to find device after booting".

              How to fix - Try to manually set the IP for you ETH interface to the 169.254.x.x range on your RPI. This way the interface is back up much faster and the connection is reestablished in time.

              Switches don't suffer from the same issue since they keep the link alive even if the device is disconnected. Hence the difference.

              LMK if that helps.

              Thanks,
              Jaka

              @jakaskerl

              i have been manually setting the eth1 ip to 169.254.1.10 but it is not working.

              3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000

              link/ether 00:e0:94:0a:0c:02 brd ff:ff:ff:ff:ff:ff
              
              inet 169.254.1.10/24 scope global eth1
              
                 valid_lft forever preferred_lft forever

              Another Question:
              why would the oak device shut down when running a script?