MatevzMorato That's wonderful to hear! I did end up just doing it locally after I posted this and ended up with a return of std::optional<std::reference_wrapper<const NNArchive>>
after discovering the joy of C++ type assertions not being included in IDE type hints when my first try was std::optional<const NNArchive&>
so I'll submit that momentarily.
For the Pybind PR - does this mean you can build a C++ app, which would then be able to delegate the pipelline building to Python for example? Sounds like a niche, but quite interesting. As long as it doesn't break any existing usecases, we're also open for a PR.
On this subject, yes that's exactly what this accomplishes, I actually ended up with a working solution for DepthAI V2 a long while back in this thread but I didn't take it far enough(because the embedded module wasn't included in the binary you had to include the whole DepthAI project inside your dependent project). When V3 was released I started pouring over the source code and various cmake settings and noticed that the team had already added a switch to build with DEPTHAI_PYTHON_EMBEDDED_MODULE, so I didn't have to change nearly as much this time around. What does the DepthAI team use the embedded module for? It feels worthless to anyone but me? Not complaining just very curious.
My thought would be to add a second switch after the first like the following:
cmake_dependent_option(DEPTHAI_PYTHON_EMBEDDED_MODULE_TARGET "Build an additional target which includes the embedded module" OFF DEPTHAI_PYTHON_EMBEDDED_MODULE OFF)
to disable it by default always, and make it dependent on DEPTHAI_PYTHON_EMBEDDED_MODULE
.
One major caveat that I've found for building the pipeline in python: you can't use depthai_nodes in your pipeline unless you plan on keeping the Python interpreter alive during the entire lifetime of your C++ pipeline. Looking back on it this seems fairly obvious considering depthai_nodes is python not pybind and pure python objects/subclasses would be torn down as the interpreter comes down, but at first the very quiet SIGSEGV occurring when I called pipeline.start() was very confusing.
I find myself replicating functionality from depthai nodes in C++.
And that brings us full circle to why I'm doing this.