• DepthAI-v2
  • OAK-D_PoE on a different network than host

Target configuration: OAK-D-PoE getting IP address from DHCP from a local router (say 192.168.0.12), local router connected to the Internet with a cellular link that has a public IP. Router NATs incoming data on ports x,y,z to OAK ports x,y,z

Host is somewhere else, connecting to the OAK through the Internet

How do I set up the OAK so that "with dai.Device(pipeline) as device:" returns the device

What ports should I configure on the router

What can I do to avoid the "ping error" I sometimes get even locally with a bad Ethernet connection on startup (it seems the timeout is too short?)

    Thor How do I set up the OAK so that "with dai.Device(pipeline) as device:" returns the device

    Afaik, autodiscovery won't work outside your LAN. But you can specify the device IP when creating the dai.Device(). https://docs.luxonis.com/projects/hardware/en/latest/pages/guides/getting-started-with-poe/#manually-specify-device-ip. Though I think you will have to set the IP to your PUBLIC IP, then use port-forwarding to route traffic for port 11490 to your device IP. That means you will likely need to setup a static IP for the oak device as well.

    Thor What ports should I configure on the router

    https://docs.luxonis.com/projects/hardware/en/latest/pages/guides/getting-started-with-poe/#ports-and-firewall

    Thor What can I do to avoid the "ping error" I sometimes get even locally with a bad Ethernet connection on startup (it seems the timeout is too short?)

    Which ping error are you referring to? This error comes up when booting the device or during runtime?

    Thanks,
    Jaka

    • Thor replied to this.

      jakaskerl

      the ping error comes up (once in a while when I'm using a bad/slow wi-fi link between the oak and my pc) when discovering the oak with "with dai.Device(pipeline) as device:" It never showed up during runtime. I'm concerned that during device discovery there is a ping test with a short timeout, which might cause a problem once I have the oak remote. Is there anything I can do about it?

      This is the warning, that closes the program though:

      [warning] Monitor thread (device: 18443010C1245D1200 [192.168.1.12]) - ping was missed, closing the device connection

      Hi @Thor ,
      That can indeed happen if there's (very) poor connectivity. One option is to extend the "search" timeout;

      One option is to also specify the IP of the camera, so depthai skips the "discovery" mode, and tries to directly connect to the camera. Thoughts?

      Hi Erik,
      I extended the search timeout from 30000 to 50000 in the bootloader, which should have updated the boardconfig, and I'm specifying an IP. However, I still get the error which is due to network latency and the time it takes for the OAK to wakeup (initial ping to the device always take a lot longer to come back than the subsequent ones) and possibly a bug.
      Note that when the ping is missed, the OAK has already discovered the device and its IP:
      [warning] Monitor thread (device: 18443010C1245D1200 [5.89.104.99]) - ping was missed, closing the device connection
      Also, sometimes instead of the missed ping message there is a system crash. See below.
      Can you please let me know if it is a bug that can be fixed shortly or if there is something we can do?

      But before I attach the error messages, there is one more thing we need
      Autofocus changes focus once in a while during the day and often during the night, for some reason trying to "improve" the focus (however it doesn't get it right at night, it settles on a bad focus setting ignoring the good focus images it went through)
      So we are planning to give a user the option to manually set the focus at install time. To do that, we need a way to read the current focus value from a script, which is not directly supported it seems. Is there a way to do it? Jaka suggested to get the lens position and "infer" the focus value, but he didn't say how. Can you help?

      Here comes the crash dump:
      with dai.Device(pipeline, device_info) as device:
      libc++abi: terminating
      Stack trace (most recent call last):
      #31 Object "Python", at 0x1041550b3, in Py_RunMain + 1179
      #30 Object "Python", at 0x10415593b, in pymain_run_file + 71
      #29 Object "Python", at 0x104155bfb, in pymain_run_file_obj + 219
      #28 Object "Python", at 0x104127f7f, in _PyRun_AnyFileObject + 247
      #27 Object "Python", at 0x10412830f, in _PyRun_SimpleFileObject + 303
      #26 Object "Python", at 0x1041293ab, in pyrun_file + 147
      #25 Object "Python", at 0x10412a31b, in run_mod + 175
      #24 Object "Python", at 0x1040aa677, in PyEval_EvalCode + 303
      #23 Object "Python", at 0x1040b63ef, in _PyEval_EvalFrameDefault + 47711
      #22 Object "Python", at 0x103f44ecb, in _PyObject_MakeTpCall + 127
      #21 Object "depthai.cpython-312-darwin.so", at 0x1047f43df, in PyInit_depthai + 57287
      #20 Object "Python", at 0x103fd7007, in type_call + 147
      #19 Object "Python", at 0x103fe1e4b, in slot_tp_init + 479
      #18 Object "Python", at 0x103f49213, in method_vectorcall + 935
      #17 Object "Python", at 0x103f44ecb, in _PyObject_MakeTpCall + 127
      #16 Object "Python", at 0x103fb41e3, in cfunction_call + 71
      #15 Object "depthai.cpython-312-darwin.so", at 0x1047f04f7, in PyInit_depthai + 41183
      #14 Object "depthai.cpython-312-darwin.so", at 0x104841223, in PyInit_depthai + 372235
      #13 Object "depthai.cpython-312-darwin.so", at 0x104671baf, in dai:😃evice:😃evice<bool, true>(dai:😛ipeline const&, dai:😃eviceInfo const&, bool) + 291
      #12 Object "depthai.cpython-312-darwin.so", at 0x10467c067, in dai:😃eviceBase::tryStartPipeline(dai:😛ipeline const&) + 283
      #11 Object "depthai.cpython-312-darwin.so", at 0x1046742bb, in dai:😃evice::startPipelineImpl(dai:😛ipeline const&) + 1139
      #10 Object "depthai.cpython-312-darwin.so", at 0x10468bed3, in dai:😃eviceBase::startPipelineImpl(dai:😛ipeline const&) + 3999
      #9 Object "libc++.1.dylib", at 0x18ab96713, in std::1::thread::thread() + 31
      #8 Object "libc++abi.dylib", at 0x18ac13a2b, in std::terminate() + 35
      #7 Object "libc++abi.dylib", at 0x18ac13a9b, in std::
      terminate(void ()()) + 15
      #6 Object "libc++abi.dylib", at 0x18ac0469f, in demangling_terminate_handler() + 51
      #5 Object "libc++abi.dylib", at 0x18ac146d7, in abort_message + 131
      #4 Object "libsystem_c.dylib", at 0x18ab6ca3f, in abort + 179
      #3 Object "libsystem_pthread.dylib", at 0x18ac5ccbf, in pthread_kill + 287
      #2 Object "libsystem_platform.dylib", at 0x18ac8ba23, in _sigtramp + 55
      #1 Object "depthai.cpython-312-darwin.so", at 0x10475f5f3, in backward::SignalHandling::sig_handler(int, __siginfo
      , void) + 19
      #0 Object "depthai.cpython-312-darwin.so", at 0x10475f64b, in backward::SignalHandling::sig_handler(int, __siginfo
      , void*) + 107
      sh: line 1: 16080 Abort trap: 6 python3 depthai/main.py