diff --git a/CMakeLists.txt b/CMakeLists.txt index ad1730e14..1ebca983b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,6 +157,7 @@ target_link_libraries(${TARGET_NAME} pybind11::pybind11 depthai::core # Use non-opencv target as we use opencv-python in bindings hedley + pybind11_json ) # Find Git diff --git a/depthai-core b/depthai-core index 19deade0c..35e163a99 160000 --- a/depthai-core +++ b/depthai-core @@ -1 +1 @@ -Subproject commit 19deade0cdb1834b1722e3a426ebaacd4804e6d9 +Subproject commit 35e163a9951badae16541f012f37bc5e2fe2c02c diff --git a/docs/source/components/nodes/script.rst b/docs/source/components/nodes/script.rst index 1e8bc1f0a..a5b5123e2 100644 --- a/docs/source/components/nodes/script.rst +++ b/docs/source/components/nodes/script.rst @@ -91,15 +91,34 @@ Usage Interfacing with GPIOs ###################### -In the script node you can interface with GPIOs of the VPU. Currently supported functions are: +In the script node you can interface with GPIOs of the VPU using module GPIO. Currently supported functions are: .. code-block:: python - import GPIO # module - GPIO.read(pin) - GPIO.write(pin, value) - GPIO.setPwm(pin, highCount, lowCount, repeat=0) # repeat == 0 means indefinite - GPIO.enablePwm(pin, enable) + # Module + import GPIO + + # General + GPIO.setup(gpio, dir, pud, exclusive) + GPIO.release(gpio) + GPIO.write(gpio, value) + GPIO.read(gpio) + + # Interrupts + GPIO.waitInterruptEvent(gpio = -1) # blocks until any interrupt or interrupt by specified gpio is fired. Interrupts with callbacks are ignored here + GPIO.hasInterruptEvent(gpio = -1) # returns whether interrupt happened on any or specfied gpio. Interrupts with callbacks are ignored here + GPIO.setInterrupt(gpio, edge, priority, callback = None) # adds interrupt to specified pin + GPIO.clearInterrupt(gpio) # clears interrupt of specified pin + + # PWM + GPIO.setPwm(gpio, highCount, lowCount, repeat=0) # repeat == 0 means indefinite + GPIO.enablePwm(gpio, enable) + + # Enumerations + GPIO.Direction: GPIO.IN, GPIO.OUT + GPIO.State: GPIO.LOW, GPIO.HIGH + GPIO.PullDownUp: GPIO.PULL_NONE, GPIO.PULL_DOWN, GPIO.PULL_UP + GPIO.Edge: GPIO.RISING, GPIO.FALLING, GPIO.LEVEL_HIGH, GPIO.LEVEL_LOW Using DepthAI :ref:`Messages ` ################################################### diff --git a/examples/bootloader_config.py b/examples/bootloader_config.py new file mode 100755 index 000000000..17c7d0d24 --- /dev/null +++ b/examples/bootloader_config.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 + +import depthai as dai +import sys + +usage = False +read = True +clear = False +path = '' +if len(sys.argv) >= 2: + op = sys.argv[1] + if op == 'read': + read = True + elif op == 'flash': + read = False + if len(sys.argv) >= 3: + path = sys.argv[2] + elif op == 'clear': + clear = True + read = False + else: + usage = True +else: + usage = True + +if usage: + print(f'Usage: {sys.argv[0]} [read/flash/clear] [flash: path/to/config/json]') + exit(-1) + +(res, info) = dai.DeviceBootloader.getFirstAvailableDevice() + +if res: + print(f'Found device with name: {info.desc.name}'); + with dai.DeviceBootloader(info) as bl: + if read: + print('Current flashed configuration') + print(f'{bl.readConfigData()}') + else: + success = None + error = None + if clear: + (success, error) = bl.flashConfigClear() + else: + if path == '': + (success, error) = bl.flashConfig(dai.DeviceBootloader.Config()) + else: + (success, error) = bl.flashConfigFile(path) + if success: + print('Successfully flashed bootloader configuration') + else: + print(f'Error flashing bootloader configuration: {error}') +else: + print('No devices found') diff --git a/examples/flash_bootloader.py b/examples/flash_bootloader.py new file mode 100755 index 000000000..3ea3e6077 --- /dev/null +++ b/examples/flash_bootloader.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 + +import depthai as dai +import sys +import time + +blType = dai.DeviceBootloader.Type.AUTO +if len(sys.argv) > 1: + if sys.argv[1] == 'usb': + blType = dai.DeviceBootloader.Type.USB + elif sys.argv[1] == 'network': + blType = dai.DeviceBootloader.Type.NETWORK + else: + print("Specify either 'usb' or 'network' bootloader type") + exit() + +print("Warning! Flashing bootloader can potentially soft brick your device and should be done with caution.") +print("Do not unplug your device while the bootloader is flashing.") +print("Type 'y' and press enter to proceed, otherwise exits: ") +if input() != 'y': + print("Prompt declined, exiting...") + exit(-1) + +(found, info) = dai.DeviceBootloader.getFirstAvailableDevice() +if not found: + print("No device found to flash. Exiting.") + exit(-1) + +# Open DeviceBootloader and allow flashing bootloader +print(f"Booting latest bootloader first, will take a tad longer...") +with dai.DeviceBootloader(info, allowFlashingBootloader=True) as bl: + currentBlType = bl.getType() + + # Check if bootloader type is the same + if blType != dai.DeviceBootloader.Type.AUTO and currentBlType != blType: + print(f"Are you sure you want to flash '{blType.name}' bootloader over current '{currentBlType.name}' bootloader?") + print(f"Type 'y' and press enter to proceed, otherwise exits: ") + if input() != 'y': + print("Prompt declined, exiting...") + exit(-1); + + # Create a progress callback lambda + progress = lambda p : print(f'Flashing progress: {p*100:.1f}%') + + print(f"Flashing {currentBlType.name} bootloader...") + startTime = time.monotonic() + (res, message) = bl.flashBootloader(dai.DeviceBootloader.Memory.FLASH, currentBlType, progress) + if res: + print("Flashing successful. Took", time.monotonic() - startTime, "seconds") + else: + print("Flashing failed:", message) diff --git a/examples/rgb_preview.py b/examples/rgb_preview.py index 45eea1a10..8484547a9 100755 --- a/examples/rgb_preview.py +++ b/examples/rgb_preview.py @@ -20,9 +20,9 @@ # Linking camRgb.preview.link(xoutRgb.input) -# Connect to device and start pipeline -with dai.Device(pipeline) as device: - +# Connect to the device +with dai.Device(pipeline, dai.UsbSpeed.SUPER) as device: + # Print out available cameras print('Connected cameras: ', device.getConnectedCameras()) # Print out usb speed print('Usb speed: ', device.getUsbSpeed().name) @@ -31,7 +31,7 @@ qRgb = device.getOutputQueue(name="rgb", maxSize=4, blocking=False) while True: - inRgb = qRgb.get() # blocking call, will wait until a new data has arrived + inRgb = qRgb.get() # blocking call, will wait until a new data has arrived # Retrieve 'bgr' (opencv format) frame cv2.imshow("rgb", inRgb.getCvFrame()) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index ebc46f957..c0e240707 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -1,2 +1,4 @@ # Add 'hedley' library -add_subdirectory(hedley) \ No newline at end of file +add_subdirectory(hedley) +# Add 'pybind11_json' library +add_subdirectory(pybind11_json) \ No newline at end of file diff --git a/external/pybind11_json/CMakeLists.txt b/external/pybind11_json/CMakeLists.txt new file mode 100644 index 000000000..1e2842c70 --- /dev/null +++ b/external/pybind11_json/CMakeLists.txt @@ -0,0 +1,3 @@ +# pybind11_json library +add_library(pybind11_json INTERFACE) +target_include_directories(pybind11_json INTERFACE "${CMAKE_CURRENT_LIST_DIR}/include") diff --git a/external/pybind11_json/include/pybind11_json/pybind11_json.hpp b/external/pybind11_json/include/pybind11_json/pybind11_json.hpp new file mode 100644 index 000000000..773a30cf4 --- /dev/null +++ b/external/pybind11_json/include/pybind11_json/pybind11_json.hpp @@ -0,0 +1,223 @@ +/*************************************************************************** +* Copyright (c) 2019, Martin Renou * +* * +* Distributed under the terms of the BSD 3-Clause License. * +* * +* The full license is in the file LICENSE, distributed with this software. * +****************************************************************************/ + +#ifndef PYBIND11_JSON_HPP +#define PYBIND11_JSON_HPP + +#include +#include + +#include "nlohmann/json.hpp" + +#include "pybind11/pybind11.h" + +namespace py = pybind11; +namespace nl = nlohmann; + +namespace pyjson +{ + inline py::object from_json(const nl::json& j) + { + if (j.is_null()) + { + return py::none(); + } + else if (j.is_boolean()) + { + return py::bool_(j.get()); + } + else if (j.is_number_integer()) + { + return py::int_(j.get()); + } + else if (j.is_number_unsigned()) + { + return py::int_(j.get()); + } + else if (j.is_number_float()) + { + return py::float_(j.get()); + } + else if (j.is_string()) + { + return py::str(j.get()); + } + else if (j.is_array()) + { + py::list obj; + for (const auto& el : j) + { + obj.append(from_json(el)); + } + return std::move(obj); + } + else // Object + { + py::dict obj; + for (nl::json::const_iterator it = j.cbegin(); it != j.cend(); ++it) + { + obj[py::str(it.key())] = from_json(it.value()); + } + return std::move(obj); + } + } + + inline nl::json to_json(const py::handle& obj) + { + if (obj.ptr() == nullptr || obj.is_none()) + { + return nullptr; + } + if (py::isinstance(obj)) + { + return obj.cast(); + } + if (py::isinstance(obj)) + { + try + { + nl::json::number_integer_t s = obj.cast(); + if (py::int_(s).equal(obj)) + { + return s; + } + } + catch (...) + { + } + try + { + nl::json::number_unsigned_t u = obj.cast(); + if (py::int_(u).equal(obj)) + { + return u; + } + } + catch (...) + { + } + throw std::runtime_error("to_json received an integer out of range for both nl::json::number_integer_t and nl::json::number_unsigned_t type: " + py::repr(obj).cast()); + } + if (py::isinstance(obj)) + { + return obj.cast(); + } + if (py::isinstance(obj)) + { + py::module base64 = py::module::import("base64"); + return base64.attr("b64encode")(obj).attr("decode")("utf-8").cast(); + } + if (py::isinstance(obj)) + { + return obj.cast(); + } + if (py::isinstance(obj) || py::isinstance(obj)) + { + auto out = nl::json::array(); + for (const py::handle value : obj) + { + out.push_back(to_json(value)); + } + return out; + } + if (py::isinstance(obj)) + { + auto out = nl::json::object(); + for (const py::handle key : obj) + { + out[py::str(key).cast()] = to_json(obj[key]); + } + return out; + } + throw std::runtime_error("to_json not implemented for this type of object: " + py::repr(obj).cast()); + } +} + +// nlohmann_json serializers +namespace nlohmann +{ + #define MAKE_NLJSON_SERIALIZER_DESERIALIZER(T) \ + template <> \ + struct adl_serializer \ + { \ + inline static void to_json(json& j, const T& obj) \ + { \ + j = pyjson::to_json(obj); \ + } \ + \ + inline static T from_json(const json& j) \ + { \ + return pyjson::from_json(j); \ + } \ + } + + #define MAKE_NLJSON_SERIALIZER_ONLY(T) \ + template <> \ + struct adl_serializer \ + { \ + inline static void to_json(json& j, const T& obj) \ + { \ + j = pyjson::to_json(obj); \ + } \ + } + + MAKE_NLJSON_SERIALIZER_DESERIALIZER(py::object); + + MAKE_NLJSON_SERIALIZER_DESERIALIZER(py::bool_); + MAKE_NLJSON_SERIALIZER_DESERIALIZER(py::int_); + MAKE_NLJSON_SERIALIZER_DESERIALIZER(py::float_); + MAKE_NLJSON_SERIALIZER_DESERIALIZER(py::str); + + MAKE_NLJSON_SERIALIZER_DESERIALIZER(py::list); + MAKE_NLJSON_SERIALIZER_DESERIALIZER(py::tuple); + MAKE_NLJSON_SERIALIZER_DESERIALIZER(py::dict); + + MAKE_NLJSON_SERIALIZER_ONLY(py::handle); + MAKE_NLJSON_SERIALIZER_ONLY(py::detail::item_accessor); + MAKE_NLJSON_SERIALIZER_ONLY(py::detail::list_accessor); + MAKE_NLJSON_SERIALIZER_ONLY(py::detail::tuple_accessor); + MAKE_NLJSON_SERIALIZER_ONLY(py::detail::sequence_accessor); + MAKE_NLJSON_SERIALIZER_ONLY(py::detail::str_attr_accessor); + MAKE_NLJSON_SERIALIZER_ONLY(py::detail::obj_attr_accessor); + + #undef MAKE_NLJSON_SERIALIZER + #undef MAKE_NLJSON_SERIALIZER_ONLY +} + +// pybind11 caster +namespace pybind11 +{ + namespace detail + { + template <> struct type_caster + { + public: + PYBIND11_TYPE_CASTER(nl::json, _("json")); + + bool load(handle src, bool) + { + try { + value = pyjson::to_json(src); + return true; + } + catch (...) + { + return false; + } + } + + static handle cast(nl::json src, return_value_policy /* policy */, handle /* parent */) + { + object obj = pyjson::from_json(src); + return obj.release(); + } + }; + } +} + +#endif diff --git a/src/DeviceBindings.cpp b/src/DeviceBindings.cpp index 9f96a43cc..d10b1e94c 100644 --- a/src/DeviceBindings.cpp +++ b/src/DeviceBindings.cpp @@ -2,6 +2,7 @@ // depthai #include "depthai/device/Device.hpp" +#include "depthai/pipeline/Pipeline.hpp" // std::chrono bindings #include @@ -10,11 +11,13 @@ // hedley #include + // Searches for available devices (as Device constructor) // but pooling, to check for python interrupts, and releases GIL in between -template -static std::unique_ptr deviceConstructorHelper(const ARG1& arg, const std::string& pathToCmd = "", bool usb2Mode = false){ +template +static auto deviceSearchHelper(Args&&... args){ + auto startTime = std::chrono::steady_clock::now(); bool found; dai::DeviceInfo deviceInfo = {}; @@ -42,17 +45,11 @@ static std::unique_ptr deviceConstructorHelper(const ARG1& arg, const st // if no devices found, then throw if(!found) throw std::runtime_error("No available devices"); - // Check if pathToCmd supplied - if(pathToCmd.empty()){ - return std::make_unique(arg, deviceInfo, usb2Mode); - } else { - return std::make_unique(arg, deviceInfo, pathToCmd); - } - return nullptr; + return deviceInfo; } -std::vector deviceGetQueueEventsHelper(dai::Device& d, const std::vector& queueNames, std::size_t maxNumEvents, std::chrono::microseconds timeout){ +static std::vector deviceGetQueueEventsHelper(dai::Device& d, const std::vector& queueNames, std::size_t maxNumEvents, std::chrono::microseconds timeout){ using namespace std::chrono; // if timeout < 0, unlimited timeout @@ -75,6 +72,92 @@ std::vector deviceGetQueueEventsHelper(dai::Device& d, const std::v } +template +static void bindConstructors(ARG& arg){ + using namespace dai; + + arg + .def(py::init([](const Pipeline& pipeline){ + auto dev = deviceSearchHelper(); + py::gil_scoped_release release; + return std::make_unique(pipeline, dev); + }), py::arg("pipeline"), DOC(dai, DeviceBase, DeviceBase)) + .def(py::init([](const Pipeline& pipeline, bool usb2Mode){ + auto dev = deviceSearchHelper(); + py::gil_scoped_release release; + return std::make_unique(pipeline, dev, usb2Mode); + }), py::arg("pipeline"), py::arg("usb2Mode"), DOC(dai, DeviceBase, DeviceBase, 2)) + .def(py::init([](const Pipeline& pipeline, UsbSpeed maxUsbSpeed){ + auto dev = deviceSearchHelper(); + py::gil_scoped_release release; + return std::make_unique(pipeline, dev, maxUsbSpeed); + }), py::arg("pipeline"), py::arg("maxUsbSpeed"), DOC(dai, DeviceBase, DeviceBase, 3)) + .def(py::init([](const Pipeline& pipeline, const std::string& pathToCmd){ + auto dev = deviceSearchHelper(); + py::gil_scoped_release release; + return std::make_unique(pipeline, dev, pathToCmd); + }), py::arg("pipeline"), py::arg("pathToCmd"), DOC(dai, DeviceBase, DeviceBase, 4)) + .def(py::init([](const Pipeline& pipeline, const DeviceInfo& deviceInfo, bool usb2Mode){ + py::gil_scoped_release release; + return std::make_unique(pipeline, deviceInfo, usb2Mode); + }), py::arg("pipeline"), py::arg("devInfo"), py::arg("usb2Mode") = false, DOC(dai, DeviceBase, DeviceBase, 7)) + .def(py::init([](const Pipeline& pipeline, const DeviceInfo& deviceInfo, UsbSpeed maxUsbSpeed){ + py::gil_scoped_release release; + return std::make_unique(pipeline, deviceInfo, maxUsbSpeed); + }), py::arg("pipeline"), py::arg("deviceInfo"), py::arg("maxUsbSpeed"), DOC(dai, DeviceBase, DeviceBase, 8)) + .def(py::init([](const Pipeline& pipeline, const DeviceInfo& deviceInfo, std::string pathToCmd){ + py::gil_scoped_release release; + return std::make_unique(pipeline, deviceInfo, pathToCmd); + }), py::arg("pipeline"), py::arg("devInfo"), py::arg("pathToCmd"), DOC(dai, DeviceBase, DeviceBase, 9)) + + // DeviceBase constructor - OpenVINO version + .def(py::init([](OpenVINO::Version version){ + auto dev = deviceSearchHelper(); + py::gil_scoped_release release; + return std::make_unique(version, dev); + }), py::arg("version") = OpenVINO::DEFAULT_VERSION, DOC(dai, DeviceBase, DeviceBase, 11)) + .def(py::init([](OpenVINO::Version version, bool usb2Mode){ + auto dev = deviceSearchHelper(); + py::gil_scoped_release release; + return std::make_unique(version, dev, usb2Mode); + }), py::arg("version"), py::arg("usb2Mode") = false, DOC(dai, DeviceBase, DeviceBase, 13)) + .def(py::init([](OpenVINO::Version version, UsbSpeed maxUsbSpeed){ + auto dev = deviceSearchHelper(); + py::gil_scoped_release release; + return std::make_unique(version, dev, maxUsbSpeed); + }), py::arg("version"), py::arg("maxUsbSpeed"), DOC(dai, DeviceBase, DeviceBase, 14)) + .def(py::init([](OpenVINO::Version version, const std::string& pathToCmd){ + auto dev = deviceSearchHelper(); + py::gil_scoped_release release; + return std::make_unique(version, dev, pathToCmd); + }), py::arg("version"), py::arg("pathToCmd"), DOC(dai, DeviceBase, DeviceBase, 15)) + .def(py::init([](OpenVINO::Version version, const DeviceInfo& deviceInfo, bool usb2Mode){ + py::gil_scoped_release release; + return std::make_unique(version, deviceInfo, usb2Mode); + }), py::arg("version"), py::arg("deviceDesc"), py::arg("usb2Mode") = false, DOC(dai, DeviceBase, DeviceBase, 18)) + .def(py::init([](OpenVINO::Version version, const DeviceInfo& deviceInfo, UsbSpeed maxUsbSpeed){ + py::gil_scoped_release release; + return std::make_unique(version, deviceInfo, maxUsbSpeed); + }), py::arg("version"), py::arg("deviceInfo"), py::arg("maxUsbSpeed"), DOC(dai, DeviceBase, DeviceBase, 19)) + .def(py::init([](OpenVINO::Version version, const DeviceInfo& deviceInfo, std::string pathToCmd){ + py::gil_scoped_release release; + return std::make_unique(version, deviceInfo, pathToCmd); + }), py::arg("version"), py::arg("deviceDesc"), py::arg("pathToCmd"), DOC(dai, DeviceBase, DeviceBase, 20)) + .def(py::init([](typename D::Config config){ + auto dev = deviceSearchHelper(); + py::gil_scoped_release release; + return std::make_unique(config, dev); + }), py::arg("config"), DOC(dai, DeviceBase, DeviceBase, 22)) + .def(py::init([](typename D::Config config, const DeviceInfo& deviceInfo){ + py::gil_scoped_release release; + return std::make_unique(config, deviceInfo); + }), py::arg("config"), py::arg("deviceInfo"), DOC(dai, DeviceBase, DeviceBase, 23)) + ; + +} + + + void DeviceBindings::bind(pybind11::module& m, void* pCallstack){ using namespace dai; @@ -82,6 +165,9 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){ // Type definitions py::class_ deviceBase(m, "DeviceBase", DOC(dai, DeviceBase)); py::class_ device(m, "Device", DOC(dai, Device)); + py::class_ deviceConfig(device, "Config", DOC(dai, DeviceBase, Config)); + py::class_ prebootConfig(m, "PrebootConfig", DOC(dai, PrebootConfig)); + py::class_ prebootConfigUsb(prebootConfig, "USB", DOC(dai, PrebootConfig, USB)); /////////////////////////////////////////////////////////////////////// @@ -97,8 +183,33 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){ /////////////////////////////////////////////////////////////////////// + // Bind PrebootConfig::USB + prebootConfigUsb + .def(py::init<>()) + .def_readwrite("vid", &PrebootConfig::USB::vid) + .def_readwrite("pid", &PrebootConfig::USB::pid) + .def_readwrite("flashBootedVid", &PrebootConfig::USB::flashBootedVid) + .def_readwrite("flashBootedPid", &PrebootConfig::USB::flashBootedPid) + .def_readwrite("maxSpeed", &PrebootConfig::USB::maxSpeed) + ; + + // Bind PrebootConfig + prebootConfig + .def(py::init<>()) + .def_readwrite("usb", &PrebootConfig::usb) + .def_readwrite("watchdogTimeoutMs", &PrebootConfig::watchdogTimeoutMs) + ; + + // Bind Device::Config + deviceConfig + .def(py::init<>()) + .def_readwrite("version", &Device::Config::version) + .def_readwrite("preboot", &Device::Config::preboot) + ; - // Bind Device, using DeviceWrapper to be able to destruct the object by calling close() + // Bind constructors + bindConstructors(deviceBase); + // Bind the rest deviceBase // Python only methods .def("__enter__", [](py::object obj){ return obj; }) @@ -115,53 +226,11 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){ .def_static("getAnyAvailableDevice", [](){ return DeviceBase::getAnyAvailableDevice(); }, DOC(dai, DeviceBase, getAnyAvailableDevice, 2)) .def_static("getFirstAvailableDevice", &DeviceBase::getFirstAvailableDevice, DOC(dai, DeviceBase, getFirstAvailableDevice)) .def_static("getAllAvailableDevices", &DeviceBase::getAllAvailableDevices, DOC(dai, DeviceBase, getAllAvailableDevices)) - .def_static("getEmbeddedDeviceBinary", &DeviceBase::getEmbeddedDeviceBinary, py::arg("usb2Mode"), py::arg("version") = Pipeline::DEFAULT_OPENVINO_VERSION, DOC(dai, DeviceBase, getEmbeddedDeviceBinary)) + .def_static("getEmbeddedDeviceBinary", py::overload_cast(&DeviceBase::getEmbeddedDeviceBinary), py::arg("usb2Mode"), py::arg("version") = OpenVINO::DEFAULT_VERSION, DOC(dai, DeviceBase, getEmbeddedDeviceBinary)) + .def_static("getEmbeddedDeviceBinary", py::overload_cast(&DeviceBase::getEmbeddedDeviceBinary), py::arg("config"), DOC(dai, DeviceBase, getEmbeddedDeviceBinary, 2)) .def_static("getDeviceByMxId", &DeviceBase::getDeviceByMxId, py::arg("mxId"), DOC(dai, DeviceBase, getDeviceByMxId)) // methods - - // Device constructor - Pipeline - .def(py::init([](const Pipeline& pipeline){ return deviceConstructorHelper(pipeline); }), py::arg("pipeline"), DOC(dai, DeviceBase, DeviceBase)) - .def(py::init([](const Pipeline& pipeline, bool usb2Mode){ - // Blocking constructor - return deviceConstructorHelper(pipeline, std::string(""), usb2Mode); - }), py::arg("pipeline"), py::arg("usb2Mode"), DOC(dai, DeviceBase, DeviceBase, 2)) - .def(py::init([](const Pipeline& pipeline, const std::string& pathToCmd){ - // Blocking constructor - return deviceConstructorHelper(pipeline, pathToCmd); - }), py::arg("pipeline"), py::arg("pathToCmd"), DOC(dai, DeviceBase, DeviceBase, 3)) - .def(py::init([](const Pipeline& pipeline, const DeviceInfo& deviceInfo, bool usb2Mode){ - // Non blocking constructor - py::gil_scoped_release release; - return std::make_unique(pipeline, deviceInfo, usb2Mode); - }), py::arg("pipeline"), py::arg("devInfo"), py::arg("usb2Mode") = false, DOC(dai, DeviceBase, DeviceBase, 6)) - .def(py::init([](const Pipeline& pipeline, const DeviceInfo& deviceInfo, std::string pathToCmd){ - // Non blocking constructor - py::gil_scoped_release release; - return std::make_unique(pipeline, deviceInfo, pathToCmd); - }), py::arg("pipeline"), py::arg("devInfo"), py::arg("pathToCmd"), DOC(dai, DeviceBase, DeviceBase, 7)) - - // DeviceBase constructor - OpenVINO version - .def(py::init([](OpenVINO::Version version){ return deviceConstructorHelper(version); }), py::arg("version") = Pipeline::DEFAULT_OPENVINO_VERSION, DOC(dai, DeviceBase, DeviceBase, 10)) - .def(py::init([](OpenVINO::Version version, bool usb2Mode){ - // Blocking constructor - return deviceConstructorHelper(version, std::string(""), usb2Mode); - }), py::arg("version"), py::arg("usb2Mode"), DOC(dai, DeviceBase, DeviceBase, 11)) - .def(py::init([](OpenVINO::Version version, const std::string& pathToCmd){ - // Blocking constructor - return deviceConstructorHelper(version, pathToCmd); - }), py::arg("version"), py::arg("pathToCmd"), DOC(dai, DeviceBase, DeviceBase, 12)) - .def(py::init([](OpenVINO::Version version, const DeviceInfo& deviceInfo, bool usb2Mode){ - // Non blocking constructor - py::gil_scoped_release release; - return std::make_unique(version, deviceInfo, usb2Mode); - }), py::arg("version"), py::arg("deviceDesc"), py::arg("usb2Mode") = false, DOC(dai, DeviceBase, DeviceBase, 15)) - .def(py::init([](OpenVINO::Version version, const DeviceInfo& deviceInfo, std::string pathToCmd){ - // Non blocking constructor - py::gil_scoped_release release; - return std::make_unique(version, deviceInfo, pathToCmd); - }), py::arg("version"), py::arg("deviceDesc"), py::arg("pathToCmd"), DOC(dai, DeviceBase, DeviceBase, 16)) - .def("isPipelineRunning", [](DeviceBase& d) { py::gil_scoped_release release; return d.isPipelineRunning(); }, DOC(dai, DeviceBase, isPipelineRunning)) .def("startPipeline", [](DeviceBase& d){ // Issue an deprecation warning @@ -201,27 +270,10 @@ void DeviceBindings::bind(pybind11::module& m, void* pCallstack){ ; + // Bind constructors + bindConstructors(device); + // Bind the rest device - .def(py::init([](const Pipeline& pipeline){ return deviceConstructorHelper(pipeline); }), py::arg("pipeline"), DOC(dai, Device, Device)) - .def(py::init([](const Pipeline& pipeline, bool usb2Mode){ - // Blocking constructor - return deviceConstructorHelper(pipeline, std::string(""), usb2Mode); - }), py::arg("pipeline"), py::arg("usb2Mode"), DOC(dai, Device, Device, 2)) - .def(py::init([](const Pipeline& pipeline, const std::string& pathToCmd){ - // Blocking constructor - return deviceConstructorHelper(pipeline, pathToCmd); - }), py::arg("pipeline"), py::arg("pathToCmd"), DOC(dai, Device, Device, 3)) - .def(py::init([](const Pipeline& pipeline, const DeviceInfo& deviceInfo, bool usb2Mode){ - // Non blocking constructor - py::gil_scoped_release release; - return std::make_unique(pipeline, deviceInfo, usb2Mode); - }), py::arg("pipeline"), py::arg("devInfo"), py::arg("usb2Mode") = false, DOC(dai, Device, Device, 6)) - .def(py::init([](const Pipeline& pipeline, const DeviceInfo& deviceInfo, std::string pathToCmd){ - // Non blocking constructor - py::gil_scoped_release release; - return std::make_unique(pipeline, deviceInfo, pathToCmd); - }), py::arg("pipeline"), py::arg("devInfo"), py::arg("pathToCmd"), DOC(dai, Device, Device, 7)) - .def("getOutputQueue", static_cast(Device::*)(const std::string&)>(&Device::getOutputQueue), py::arg("name"), DOC(dai, Device, getOutputQueue)) .def("getOutputQueue", static_cast(Device::*)(const std::string&, unsigned int, bool)>(&Device::getOutputQueue), py::arg("name"), py::arg("maxSize"), py::arg("blocking") = true, DOC(dai, Device, getOutputQueue, 2)) .def("getOutputQueueNames", &Device::getOutputQueueNames, DOC(dai, Device, getOutputQueueNames)) diff --git a/src/DeviceBootloaderBindings.cpp b/src/DeviceBootloaderBindings.cpp index 890364a30..a975bc10b 100644 --- a/src/DeviceBootloaderBindings.cpp +++ b/src/DeviceBootloaderBindings.cpp @@ -13,6 +13,9 @@ void DeviceBootloaderBindings::bind(pybind11::module& m, void* pCallstack){ py::enum_ deviceBootloaderType(deviceBootloader, "Type"); py::enum_ deviceBootloaderMemory(deviceBootloader, "Memory"); py::enum_ deviceBootloaderSection(deviceBootloader, "Section"); + py::class_ deviceBootlaoderUsbConfig(deviceBootloader, "UsbConfig"); + py::class_ deviceBootlaoderNetworkConfig(deviceBootloader, "NetworkConfig"); + py::class_ deviceBootloderConfig(deviceBootloader, "Config"); /////////////////////////////////////////////////////////////////////// @@ -39,20 +42,72 @@ void DeviceBootloaderBindings::bind(pybind11::module& m, void* pCallstack){ ; deviceBootloaderType + .value("AUTO", DeviceBootloader::Type::AUTO) .value("USB", DeviceBootloader::Type::USB) .value("NETWORK", DeviceBootloader::Type::NETWORK) ; deviceBootloaderMemory + .value("AUTO", DeviceBootloader::Memory::AUTO) .value("FLASH", DeviceBootloader::Memory::FLASH) .value("EMMC", DeviceBootloader::Memory::EMMC) ; deviceBootloaderSection + .value("AUTO", DeviceBootloader::Section::AUTO) .value("HEADER", DeviceBootloader::Section::HEADER) .value("BOOTLOADER", DeviceBootloader::Section::BOOTLOADER) .value("BOOTLOADER_CONFIG", DeviceBootloader::Section::BOOTLOADER_CONFIG) .value("APPLICATION", DeviceBootloader::Section::APPLICATION) ; + deviceBootlaoderUsbConfig + .def(py::init<>()) + .def_readwrite("timeoutMs", &DeviceBootloader::UsbConfig::timeoutMs) + .def_readwrite("maxUsbSpeed", &DeviceBootloader::UsbConfig::maxUsbSpeed) + .def_readwrite("vid", &DeviceBootloader::UsbConfig::vid) + .def_readwrite("pid", &DeviceBootloader::UsbConfig::pid) + ; + deviceBootlaoderNetworkConfig + .def(py::init<>()) + .def_readwrite("timeoutMs", &DeviceBootloader::NetworkConfig::timeoutMs) + .def_readwrite("ipv4", &DeviceBootloader::NetworkConfig::ipv4) + .def_readwrite("ipv4Mask", &DeviceBootloader::NetworkConfig::ipv4Mask) + .def_readwrite("ipv4Gateway", &DeviceBootloader::NetworkConfig::ipv4Gateway) + .def_readwrite("ipv4Dns", &DeviceBootloader::NetworkConfig::ipv4Dns) + .def_readwrite("ipv4DnsAlt", &DeviceBootloader::NetworkConfig::ipv4DnsAlt) + .def_readwrite("staticIpv4", &DeviceBootloader::NetworkConfig::staticIpv4) + .def_readwrite("ipv6", &DeviceBootloader::NetworkConfig::ipv6) + .def_readwrite("ipv6Prefix", &DeviceBootloader::NetworkConfig::ipv6Prefix) + .def_readwrite("ipv6Gateway", &DeviceBootloader::NetworkConfig::ipv6Gateway) + .def_readwrite("ipv6Dns", &DeviceBootloader::NetworkConfig::ipv6Dns) + .def_readwrite("ipv6DnsAlt", &DeviceBootloader::NetworkConfig::ipv6DnsAlt) + .def_readwrite("staticIpv6", &DeviceBootloader::NetworkConfig::staticIpv6) + .def_readwrite("mac", &DeviceBootloader::NetworkConfig::mac) + ; + + deviceBootloderConfig + .def(py::init<>()) + .def_readwrite("appMem", &DeviceBootloader::Config::appMem) + .def_readwrite("usb", &DeviceBootloader::Config::usb) + .def_readwrite("network", &DeviceBootloader::Config::network) + .def("setStaticIPv4", &DeviceBootloader::Config::setStaticIPv4) + .def("setDynamicIPv4", &DeviceBootloader::Config::setDynamicIPv4) + .def("isStaticIPV4", &DeviceBootloader::Config::isStaticIPV4) + .def("getIPv4", &DeviceBootloader::Config::getIPv4) + .def("getIPv4Mask", &DeviceBootloader::Config::getIPv4Mask) + .def("getIPv4Gateway", &DeviceBootloader::Config::getIPv4Gateway) + .def("setDnsIPv4", &DeviceBootloader::Config::setDnsIPv4) + .def("getDnsIPv4", &DeviceBootloader::Config::getDnsIPv4) + .def("getDnsAltIPv4", &DeviceBootloader::Config::getDnsAltIPv4) + .def("setUsbTimeout", &DeviceBootloader::Config::setUsbTimeout) + .def("getUsbTimeout", &DeviceBootloader::Config::getUsbTimeout) + .def("setNetworkTimeout", &DeviceBootloader::Config::setNetworkTimeout) + .def("getNetworkTimeout", &DeviceBootloader::Config::getNetworkTimeout) + .def("setMacAddress", &DeviceBootloader::Config::setMacAddress) + .def("getMacAddress", &DeviceBootloader::Config::getMacAddress) + .def("setUsbMaxSpeed", &DeviceBootloader::Config::setUsbMaxSpeed) + .def("getUsbMaxSpeed", &DeviceBootloader::Config::getUsbMaxSpeed) + ; + deviceBootloader // Python only methods .def("__enter__", [](py::object obj){ return obj; }) @@ -61,21 +116,38 @@ void DeviceBootloaderBindings::bind(pybind11::module& m, void* pCallstack){ .def_static("getFirstAvailableDevice", &DeviceBootloader::getFirstAvailableDevice, DOC(dai, DeviceBootloader, getFirstAvailableDevice)) .def_static("getAllAvailableDevices", &DeviceBootloader::getAllAvailableDevices, DOC(dai, DeviceBootloader, getAllAvailableDevices)) - .def_static("saveDepthaiApplicationPackage", &DeviceBootloader::saveDepthaiApplicationPackage, py::arg("path"), py::arg("pipeline"), py::arg("pathToCmd") = "", DOC(dai, DeviceBootloader, saveDepthaiApplicationPackage)) - .def_static("createDepthaiApplicationPackage", &DeviceBootloader::createDepthaiApplicationPackage, py::arg("pipeline"), py::arg("pathToCmd") = "", DOC(dai, DeviceBootloader, createDepthaiApplicationPackage)) + .def_static("saveDepthaiApplicationPackage", py::overload_cast(&DeviceBootloader::saveDepthaiApplicationPackage), py::arg("path"), py::arg("pipeline"), py::arg("pathToCmd") = "", py::arg("compress") = false, DOC(dai, DeviceBootloader, saveDepthaiApplicationPackage)) + .def_static("saveDepthaiApplicationPackage", py::overload_cast(&DeviceBootloader::saveDepthaiApplicationPackage), py::arg("path"), py::arg("pipeline"), py::arg("compress") = false, DOC(dai, DeviceBootloader, saveDepthaiApplicationPackage, 2)) + .def_static("createDepthaiApplicationPackage", py::overload_cast(&DeviceBootloader::createDepthaiApplicationPackage), py::arg("pipeline"), py::arg("pathToCmd") = "", py::arg("compress") = false, DOC(dai, DeviceBootloader, createDepthaiApplicationPackage)) + .def_static("createDepthaiApplicationPackage", py::overload_cast(&DeviceBootloader::createDepthaiApplicationPackage), py::arg("pipeline"), py::arg("compress"), DOC(dai, DeviceBootloader, createDepthaiApplicationPackage, 2)) .def_static("getEmbeddedBootloaderVersion", &DeviceBootloader::getEmbeddedBootloaderVersion, DOC(dai, DeviceBootloader, getEmbeddedBootloaderVersion)) .def_static("getEmbeddedBootloaderBinary", &DeviceBootloader::getEmbeddedBootloaderBinary, DOC(dai, DeviceBootloader, getEmbeddedBootloaderBinary)) - .def(py::init(), py::arg("deviceDesc"), DOC(dai, DeviceBootloader, DeviceBootloader)) - .def(py::init(), py::arg("deviceDesc"), py::arg("pathToCmd"), DOC(dai, DeviceBootloader, DeviceBootloader, 2)) - .def("flash", [](DeviceBootloader& db, std::function progressCallback, Pipeline& pipeline) { py::gil_scoped_release release; return db.flash(progressCallback, pipeline); }, py::arg("progressCallback"), py::arg("pipeline"), DOC(dai, DeviceBootloader, flash)) + .def(py::init(), py::arg("devInfo"), py::arg("allowFlashingBootloader") = false, DOC(dai, DeviceBootloader, DeviceBootloader)) + .def(py::init(), py::arg("devInfo"), py::arg("pathToCmd"), py::arg("allowFlashingBootloader") = false, DOC(dai, DeviceBootloader, DeviceBootloader, 2)) + .def("flash", [](DeviceBootloader& db, std::function progressCallback, const Pipeline& pipeline, bool compress) { py::gil_scoped_release release; return db.flash(progressCallback, pipeline, compress); }, py::arg("progressCallback"), py::arg("pipeline"), py::arg("compress") = false, DOC(dai, DeviceBootloader, flash)) + .def("flash", [](DeviceBootloader& db, const Pipeline& pipeline, bool compress) { py::gil_scoped_release release; return db.flash(pipeline, compress); }, py::arg("pipeline"), py::arg("compress") = false, DOC(dai, DeviceBootloader, flash, 2)) .def("flashDepthaiApplicationPackage", [](DeviceBootloader& db, std::function progressCallback, std::vector package) { py::gil_scoped_release release; return db.flashDepthaiApplicationPackage(progressCallback, package); }, py::arg("progressCallback"), py::arg("package"), DOC(dai, DeviceBootloader, flashDepthaiApplicationPackage)) + .def("flashDepthaiApplicationPackage", [](DeviceBootloader& db, std::vector package) { py::gil_scoped_release release; return db.flashDepthaiApplicationPackage(package); }, py::arg("package"), DOC(dai, DeviceBootloader, flashDepthaiApplicationPackage, 2)) .def("flashBootloader", [](DeviceBootloader& db, std::function progressCallback, std::string path) { py::gil_scoped_release release; return db.flashBootloader(progressCallback, path); }, py::arg("progressCallback"), py::arg("path") = "", DOC(dai, DeviceBootloader, flashBootloader)) .def("flashBootloader", [](DeviceBootloader& db, DeviceBootloader::Memory memory, DeviceBootloader::Type type, std::function progressCallback, std::string path) { py::gil_scoped_release release; return db.flashBootloader(memory, type, progressCallback, path); }, py::arg("memory"), py::arg("type"), py::arg("progressCallback"), py::arg("path") = "", DOC(dai, DeviceBootloader, flashBootloader, 2)) + + .def("readConfigData", [](DeviceBootloader& db, DeviceBootloader::Memory memory, DeviceBootloader::Type type) { py::gil_scoped_release release; return db.readConfigData(memory, type); }, py::arg("memory") = DeviceBootloader::Memory::AUTO, py::arg("type") = DeviceBootloader::Type::AUTO, DOC(dai, DeviceBootloader, readConfigData)) + .def("flashConfigData", [](DeviceBootloader& db, nlohmann::json configData, DeviceBootloader::Memory memory, DeviceBootloader::Type type) { py::gil_scoped_release release; return db.flashConfigData(configData, memory, type); }, py::arg("configData"), py::arg("memory") = DeviceBootloader::Memory::AUTO, py::arg("type") = DeviceBootloader::Type::AUTO, DOC(dai, DeviceBootloader, flashConfigData)) + .def("flashConfigFile", [](DeviceBootloader& db, std::string configPath, DeviceBootloader::Memory memory, DeviceBootloader::Type type) { py::gil_scoped_release release; return db.flashConfigFile(configPath, memory, type); }, py::arg("configData"), py::arg("memory") = DeviceBootloader::Memory::AUTO, py::arg("type") = DeviceBootloader::Type::AUTO, DOC(dai, DeviceBootloader, flashConfigFile)) + .def("flashConfigClear", [](DeviceBootloader& db, DeviceBootloader::Memory memory, DeviceBootloader::Type type) { py::gil_scoped_release release; return db.flashConfigClear(memory, type); }, py::arg("memory") = DeviceBootloader::Memory::AUTO, py::arg("type") = DeviceBootloader::Type::AUTO, DOC(dai, DeviceBootloader, flashConfigClear)) + .def("readConfig", [](DeviceBootloader& db, DeviceBootloader::Memory memory, DeviceBootloader::Type type) { py::gil_scoped_release release; return db.readConfig(memory, type); }, py::arg("memory") = DeviceBootloader::Memory::AUTO, py::arg("type") = DeviceBootloader::Type::AUTO, DOC(dai, DeviceBootloader, readConfig)) + .def("flashConfig", [](DeviceBootloader& db, const DeviceBootloader::Config& config, DeviceBootloader::Memory memory, DeviceBootloader::Type type) { py::gil_scoped_release release; return db.flashConfig(config, memory, type); }, py::arg("config"), py::arg("memory") = DeviceBootloader::Memory::AUTO, py::arg("type") = DeviceBootloader::Type::AUTO, DOC(dai, DeviceBootloader, flashConfig)) + + .def("bootMemory", [](DeviceBootloader& db, const std::vector& fw) { py::gil_scoped_release release; return db.bootMemory(fw); }, py::arg("fw"), DOC(dai, DeviceBootloader, bootMemory)) + .def("bootUsbRomBootloader", [](DeviceBootloader& db) { py::gil_scoped_release release; return db.bootUsbRomBootloader(); }, DOC(dai, DeviceBootloader, bootUsbRomBootloader)) + //.def("flashCustom", &DeviceBootloader::flashCustom, py::arg("memory"), py::arg("offset"), py::arg("progressCallback"), py::arg("data"), DOC(dai, DeviceBootloader, flashCustom)) .def("getVersion", [](DeviceBootloader& db) { py::gil_scoped_release release; return db.getVersion(); }, DOC(dai, DeviceBootloader, getVersion)) .def("isEmbeddedVersion", &DeviceBootloader::isEmbeddedVersion, DOC(dai, DeviceBootloader, isEmbeddedVersion)) + .def("getType", &DeviceBootloader::getType, DOC(dai, DeviceBootloader, getType)) + .def("isAllowedFlashingBootloader", &DeviceBootloader::isAllowedFlashingBootloader, DOC(dai, DeviceBootloader, isAllowedFlashingBootloader)) ; } diff --git a/src/XLinkConnectionBindings.cpp b/src/XLinkConnectionBindings.cpp index 07b9d37cf..9a74bd9f6 100644 --- a/src/XLinkConnectionBindings.cpp +++ b/src/XLinkConnectionBindings.cpp @@ -83,7 +83,7 @@ void XLinkConnectionBindings::bind(pybind11::module& m, void* pCallstack){ .def_static("getAllConnectedDevices", &XLinkConnection::getAllConnectedDevices, py::arg("state") = X_LINK_ANY_STATE) .def_static("getFirstDevice", &XLinkConnection::getFirstDevice, py::arg("state") = X_LINK_ANY_STATE) .def_static("getDeviceByMxId", &XLinkConnection::getDeviceByMxId, py::arg("mxId"), py::arg("state") = X_LINK_ANY_STATE) + .def_static("bootBootloader", &XLinkConnection::bootBootloader, py::arg("devInfo")) ; - } \ No newline at end of file diff --git a/src/pipeline/PipelineBindings.cpp b/src/pipeline/PipelineBindings.cpp index f530caf8f..c1899b0a3 100644 --- a/src/pipeline/PipelineBindings.cpp +++ b/src/pipeline/PipelineBindings.cpp @@ -92,11 +92,13 @@ void PipelineBindings::bind(pybind11::module& m, void* pCallstack){ .def("unlink", &Pipeline::unlink, DOC(dai, Pipeline, unlink), DOC(dai, Pipeline, unlink)) .def("getAssetManager", static_cast(&Pipeline::getAssetManager), py::return_value_policy::reference_internal, DOC(dai, Pipeline, getAssetManager)) .def("getAssetManager", static_cast(&Pipeline::getAssetManager), py::return_value_policy::reference_internal, DOC(dai, Pipeline, getAssetManager)) - .def("setOpenVINOVersion", &Pipeline::setOpenVINOVersion, py::arg("version") = Pipeline::DEFAULT_OPENVINO_VERSION, DOC(dai, Pipeline, setOpenVINOVersion)) + .def("setOpenVINOVersion", &Pipeline::setOpenVINOVersion, py::arg("version") = OpenVINO::DEFAULT_VERSION, DOC(dai, Pipeline, setOpenVINOVersion)) .def("getOpenVINOVersion", &Pipeline::getOpenVINOVersion, DOC(dai, Pipeline, getOpenVINOVersion)) + .def("getRequiredOpenVINOVersion", &Pipeline::getRequiredOpenVINOVersion, DOC(dai, Pipeline, getRequiredOpenVINOVersion)) .def("setCameraTuningBlobPath", &Pipeline::setCameraTuningBlobPath, py::arg("path"), DOC(dai, Pipeline, setCameraTuningBlobPath)) .def("setCalibrationData", &Pipeline::setCalibrationData, py::arg("calibrationDataHandler"), DOC(dai, Pipeline, setCalibrationData)) .def("getCalibrationData", &Pipeline::getCalibrationData, DOC(dai, Pipeline, getCalibrationData)) + .def("getDeviceConfig", &Pipeline::getDeviceConfig, DOC(dai, Pipeline, getDeviceConfig)) // 'Template' create function .def("create", [](dai::Pipeline& p, py::object class_) { auto node = createNode(p, class_); diff --git a/src/py_bindings.cpp b/src/py_bindings.cpp index 75bcf9ec7..7679692aa 100644 --- a/src/py_bindings.cpp +++ b/src/py_bindings.cpp @@ -59,8 +59,28 @@ PYBIND11_MODULE(depthai,m) // Initial call CommonBindings::bind(m, &callstackAdapter); + // Install signal handler option + bool installSignalHandler = true; + constexpr static const char* signalHandlerKey = "DEPTHAI_INSTALL_SIGNAL_HANDLER"; + try { + auto sysModule = py::module_::import("sys"); + if(py::hasattr(sysModule, signalHandlerKey)){ + installSignalHandler = installSignalHandler && sysModule.attr(signalHandlerKey).cast(); + } + } catch (...) { + // ignore + } + try { + auto builtinsModule = py::module_::import("builtins"); + if(py::hasattr(builtinsModule, signalHandlerKey)){ + installSignalHandler = installSignalHandler && builtinsModule.attr(signalHandlerKey).cast(); + } + } catch (...){ + // ignore + } + // Call dai::initialize on 'import depthai' to initialize asap with additional information to print - dai::initialize(std::string("Python bindings - version: ") + DEPTHAI_PYTHON_VERSION + " from " + DEPTHAI_PYTHON_COMMIT_DATETIME + " build: " + DEPTHAI_PYTHON_BUILD_DATETIME); + dai::initialize(std::string("Python bindings - version: ") + DEPTHAI_PYTHON_VERSION + " from " + DEPTHAI_PYTHON_COMMIT_DATETIME + " build: " + DEPTHAI_PYTHON_BUILD_DATETIME, installSignalHandler); } diff --git a/src/pybind11_common.hpp b/src/pybind11_common.hpp index 8fbab8dd8..1669cdf40 100644 --- a/src/pybind11_common.hpp +++ b/src/pybind11_common.hpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include