Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripting support (Python 3.9) #316

Merged
merged 39 commits into from
Jul 23, 2021
Merged

Scripting support (Python 3.9) #316

merged 39 commits into from
Jul 23, 2021

Conversation

themarpe
Copy link
Collaborator

Related PR: luxonis/depthai-core#180
Adds device side support for scripting along with:

  • Added 'namespace' for nodes -> depthai.node.[Node]
  • Pipeline create mimics C++ now (pipeline.create(dai.node.[Node]))
  • Added necessary bindings

Jon Ngai and others added 30 commits February 19, 2021 09:17
# Conflicts:
#	depthai-core
#	examples/CMakeLists.txt
#	src/pipeline/NodeBindings.cpp
@themarpe themarpe requested a review from SzabolcsGergely July 19, 2021 20:03
img = device.getOutputQueue("still").get()
cv2.imshow('still', img.getCvFrame())
if cv2.waitKey(1) == ord('q'):
exit(0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

break instead exit so it's consistent with the rest of the examples

.def("addLogCallback", &Device::addLogCallback, py::arg("callback"), DOC(dai, Device, addLogCallback))
.def("removeLogCallback", &Device::removeLogCallback, py::arg("callbackId"), DOC(dai, Device, removeLogCallback))
;
.def("setLogLevel", [](Device& d, LogLevel l) { py::gil_scoped_release release; d.setLogLevel(l); }, py::arg("level"), DOC(dai, Device, setLogLevel))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why py::gil_scoped_release necessary ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all actually do, will fix. For others, its because those do blocking IO underneath, which can take "a while" -in the meantime other Python code can be executed.

@VanDavv
Copy link
Contributor

VanDavv commented Jul 20, 2021

TODO: Update gen2-triangulation experiment once merged and released (uses artifactory version from this branch)

@themarpe themarpe merged commit 9b04a43 into develop Jul 23, 2021
@themarpe themarpe deleted the gen2_scripting branch July 23, 2021 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants