Skip to content

Commit 00cffbf

Browse files
committed
Merge branch 'develop' of github.com:luxonis/depthai-python into device_name_improvements
2 parents cb7243e + d1c103e commit 00cffbf

15 files changed

+138
-35
lines changed

.github/workflows/main.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,18 @@ jobs:
154154
run: echo "BUILD_COMMIT_HASH=${{github.sha}}" >> $GITHUB_ENV
155155
- name: Building wheel
156156
run: python3 -m pip wheel . -w ./wheelhouse/ --verbose
157-
- name: Auditing wheel
158-
run: for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat linux_armv7l -w wheelhouse/audited/; done
159-
- name: Install tweaked auditwheel and add armv6l tag
157+
- name: Auditing wheels and adding armv6l tag (Running on RPi, binaries compiled as armv6l)
160158
run: |
161-
python3 -m pip install git+https://github.com/luxonis/auditwheel@main
162-
for whl in wheelhouse/*.whl; do python3 -m auditwheel addtag -t linux_armv7l linux_armv6l -w wheelhouse/postaudited/ "$whl"; done
159+
python3 -m pip install -U wheel auditwheel
160+
for whl in wheelhouse/*.whl; do auditwheel repair "$whl" --plat linux_armv7l -w wheelhouse/preaudited/; done
161+
for whl in wheelhouse/preaudited/*.whl; do python3 -m wheel tags --platform-tag +linux_armv6l "$whl"; done
162+
mkdir -p wheelhouse/audited/
163+
for whl in wheelhouse/preaudited/*linux_armv6l*.whl; do cp "$whl" wheelhouse/audited/$(basename $whl); done
163164
- name: Archive wheel artifacts
164165
uses: actions/upload-artifact@v3
165166
with:
166167
name: audited-wheels
167-
path: wheelhouse/postaudited/
168+
path: wheelhouse/audited/
168169
- name: Deploy wheels to artifactory (if not a release)
169170
if: startsWith(github.ref, 'refs/tags/v') != true
170171
run: bash ./ci/upload-artifactory.sh

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,9 @@ if(WIN32)
162162
set(depthai_dll_libraries "$<TARGET_RUNTIME_DLLS:${TARGET_NAME}>")
163163
endif()
164164
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD COMMAND
165-
${CMAKE_COMMAND} -E copy ${depthai_dll_libraries} $<TARGET_FILE_DIR:${TARGET_NAME}>
165+
"$<$<BOOL:${depthai_dll_libraries}>:${CMAKE_COMMAND};-E;copy_if_different;${depthai_dll_libraries};$<TARGET_FILE_DIR:${TARGET_NAME}>>"
166166
COMMAND_EXPAND_LISTS
167+
VERBATIM
167168
)
168169

169170
# Disable "d" postfix, so python can import the library as is
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import depthai as dai
2+
import zipfile
3+
from json import dump, JSONEncoder
4+
import io
5+
6+
class CustomEncoder(JSONEncoder):
7+
def default(self, obj):
8+
if hasattr(obj, '__str__'):
9+
return str(obj)
10+
return super().default(obj)
11+
12+
data = {}
13+
14+
with dai.Device() as device:
15+
data['BootloaderVersion'] = device.getBootloaderVersion()
16+
data['ConnectedIMU'] = device.getConnectedIMU()
17+
data['imuFirmwareVersion'] = device.getIMUFirmwareVersion()
18+
19+
filenames = [
20+
"metadata.json",
21+
"userCalib.json",
22+
"factoryCalib.json"
23+
]
24+
25+
# Create in-memory file-like objects
26+
metadata_io = io.StringIO()
27+
usercalib_io = io.StringIO()
28+
factcalib_io = io.StringIO()
29+
crashDump_io = io.StringIO()
30+
# Dump data into these in-memory files
31+
dump(data, metadata_io, indent=2, cls=CustomEncoder)
32+
33+
try:
34+
dump(device.readCalibration2().eepromToJson(), usercalib_io, indent=2)
35+
dump(device.readCalibrationRaw(), usercalib_io, indent=4)
36+
except Exception as ex:
37+
dump(str(ex), usercalib_io, indent=2)
38+
39+
try:
40+
dump(device.readFactoryCalibration().eepromToJson(), factcalib_io, indent=2)
41+
dump(device.readFactoryCalibrationRaw(), factcalib_io, indent=4)
42+
except Exception as ex:
43+
dump(str(ex), factcalib_io, indent=2)
44+
45+
in_memory_files = [metadata_io, usercalib_io, factcalib_io]
46+
47+
zip_name = 'device_info.zip'
48+
49+
with zipfile.ZipFile(zip_name, 'w') as z:
50+
# Zip in-memory file-like objects without writing to disk
51+
for file_io, filename in zip(in_memory_files, filenames):
52+
file_io.seek(0) # Reset cursor to the beginning of the file
53+
z.writestr(filename, file_io.getvalue())
54+
55+
if device.hasCrashDump():
56+
crashDump = device.getCrashDump()
57+
commitHash = crashDump.depthaiCommitHash
58+
deviceId = crashDump.deviceId
59+
filenames.append("crashreport_" + commitHash + "_" + deviceId + ".json")
60+
dump(crashDump.serializeToJson(), crashDump_io, indent=2)
61+
in_memory_files.append(crashDump_io)
62+
63+
with zipfile.ZipFile(zip_name, 'w') as z:
64+
# Zip in-memory file-like objects without writing to disk
65+
for file_io, filename in zip(in_memory_files, filenames):
66+
file_io.seek(0) # Reset cursor to the beginning of the file
67+
z.writestr(filename, file_io.getvalue())
68+
69+
print("Crash dump found on your device!")
70+
else:
71+
print("There was no crash dump found on your device!")
72+
73+
print("Please report to developers with the zip attached!")

find_version.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
def get_version_from_cmake_lists(path):
1313
with open(path, 'r') as file:
1414
content = file.read()
15-
match = re.search(cmake_lists_txt_version_pattern, content, flags=re.IGNORECASE)
15+
match = re.search(cmake_lists_txt_version_pattern, content, flags=re.IGNORECASE)
1616
ver1 = match.group('ver1')
1717
ver2 = match.group('ver2')
1818
version = ver1
@@ -21,7 +21,7 @@ def get_version_from_cmake_lists(path):
2121
return version
2222

2323
def get_package_version():
24-
24+
2525
version_core = '0.0.0'
2626
version_revision = '0'
2727
version_core = get_version_from_cmake_lists(version_depthai_core_path)
@@ -32,4 +32,4 @@ def get_package_version():
3232

3333

3434
def get_package_dev_version(commit_hash):
35-
return get_package_version() + ".dev+" + commit_hash
35+
return get_package_version() + ".dev0+" + commit_hash

src/pipeline/CommonBindings.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ void CommonBindings::bind(pybind11::module& m, void* pCallstack){
203203
.def_readwrite("orientation", &CameraFeatures::orientation)
204204
.def_readwrite("supportedTypes", &CameraFeatures::supportedTypes)
205205
.def_readwrite("hasAutofocus", &CameraFeatures::hasAutofocus)
206+
.def_readwrite("hasAutofocusIC", &CameraFeatures::hasAutofocusIC)
206207
.def_readwrite("name", &CameraFeatures::name)
207208
.def_readwrite("configs", &CameraFeatures::configs)
208209
.def("__repr__", [](CameraFeatures& camera) {

src/pipeline/datatype/AprilTagsBindings.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ void bind_apriltags(pybind11::module& m, void* pCallstack){
4848
aprilTags
4949
.def(py::init<>())
5050
.def_property("aprilTags", [](AprilTags& det) { return &det.aprilTags; }, [](AprilTags& det, std::vector<AprilTag> val) { det.aprilTags = val; })
51-
.def("getTimestamp", &AprilTags::getTimestamp, DOC(dai, AprilTags, getTimestamp))
52-
.def("getTimestampDevice", &AprilTags::getTimestampDevice, DOC(dai, AprilTags, getTimestampDevice))
53-
.def("getSequenceNum", &AprilTags::getSequenceNum, DOC(dai, AprilTags, getSequenceNum))
51+
.def("getTimestamp", &AprilTags::Buffer::getTimestamp, DOC(dai, Buffer, getTimestamp))
52+
.def("getTimestampDevice", &AprilTags::Buffer::getTimestampDevice, DOC(dai, Buffer, getTimestampDevice))
53+
.def("getSequenceNum", &AprilTags::Buffer::getSequenceNum, DOC(dai, Buffer, getSequenceNum))
5454
.def("setTimestamp", &AprilTags::setTimestamp, DOC(dai, AprilTags, setTimestamp))
5555
.def("setTimestampDevice", &AprilTags::setTimestampDevice, DOC(dai, AprilTags, setTimestampDevice))
5656
.def("setSequenceNum", &AprilTags::setSequenceNum, DOC(dai, AprilTags, setSequenceNum))

src/pipeline/datatype/BufferBindings.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,27 @@ void bind_buffer(pybind11::module& m, void* pCallstack){
4242
dai::RawBuffer &a = obj.cast<dai::RawBuffer&>();
4343
a.data = {array.data(), array.data() + array.size()};
4444
})
45+
.def_property("ts",
46+
[](const RawBuffer& o){
47+
double ts = o.ts.sec + o.ts.nsec / 1000000000.0;
48+
return ts;
49+
},
50+
[](RawBuffer& o, double ts){
51+
o.ts.sec = ts;
52+
o.ts.nsec = (ts - o.ts.sec) * 1000000000.0;
53+
}
54+
)
55+
.def_property("tsDevice",
56+
[](const RawBuffer& o){
57+
double ts = o.tsDevice.sec + o.tsDevice.nsec / 1000000000.0;
58+
return ts;
59+
},
60+
[](RawBuffer& o, double ts){
61+
o.tsDevice.sec = ts;
62+
o.tsDevice.nsec = (ts - o.tsDevice.sec) * 1000000000.0;
63+
}
64+
)
65+
.def_readwrite("sequenceNum", &RawBuffer::sequenceNum)
4566
;
4667

4768
// Message
@@ -59,6 +80,12 @@ void bind_buffer(pybind11::module& m, void* pCallstack){
5980
buffer.getData().clear();
6081
buffer.getData().insert(buffer.getData().begin(), array.data(), array.data() + array.nbytes());
6182
}, DOC(dai, Buffer, setData))
83+
.def("getTimestamp", &Buffer::getTimestamp, DOC(dai, Buffer, getTimestamp))
84+
.def("getTimestampDevice", &Buffer::getTimestampDevice, DOC(dai, Buffer, getTimestampDevice))
85+
.def("getSequenceNum", &Buffer::getSequenceNum, DOC(dai, Buffer, getSequenceNum))
86+
.def("setTimestamp", &Buffer::setTimestamp, DOC(dai, Buffer, setTimestamp))
87+
.def("setTimestampDevice", &Buffer::setTimestampDevice, DOC(dai, Buffer, setTimestampDevice))
88+
.def("setSequenceNum", &Buffer::setSequenceNum, DOC(dai, Buffer, setSequenceNum))
6289
;
6390

6491

src/pipeline/datatype/ImgDetectionsBindings.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ void bind_imgdetections(pybind11::module& m, void* pCallstack){
7474
imgDetections
7575
.def(py::init<>(), DOC(dai, ImgDetections, ImgDetections))
7676
.def_property("detections", [](ImgDetections& det) { return &det.detections; }, [](ImgDetections& det, std::vector<ImgDetection> val) { det.detections = val; }, DOC(dai, ImgDetections, detections))
77-
.def("getTimestamp", &ImgDetections::getTimestamp, DOC(dai, ImgDetections, getTimestamp))
78-
.def("getTimestampDevice", &ImgDetections::getTimestampDevice, DOC(dai, ImgDetections, getTimestampDevice))
79-
.def("getSequenceNum", &ImgDetections::getSequenceNum, DOC(dai, ImgDetections, getSequenceNum))
77+
.def("getTimestamp", &ImgDetections::Buffer::getTimestamp, DOC(dai, Buffer, getTimestamp))
78+
.def("getTimestampDevice", &ImgDetections::Buffer::getTimestampDevice, DOC(dai, Buffer, getTimestampDevice))
79+
.def("getSequenceNum", &ImgDetections::Buffer::getSequenceNum, DOC(dai, Buffer, getSequenceNum))
8080
.def("setTimestamp", &ImgDetections::setTimestamp, DOC(dai, ImgDetections, setTimestamp))
8181
.def("setTimestampDevice", &ImgDetections::setTimestampDevice, DOC(dai, ImgDetections, setTimestampDevice))
8282
.def("setSequenceNum", &ImgDetections::setSequenceNum, DOC(dai, ImgDetections, setSequenceNum))

src/pipeline/datatype/ImgFrameBindings.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ void bind_imgframe(pybind11::module& m, void* pCallstack){
117117
imgFrame
118118
.def(py::init<>())
119119
// getters
120-
.def("getTimestamp", py::overload_cast<>(&ImgFrame::getTimestamp, py::const_), DOC(dai, ImgFrame, getTimestamp))
121-
.def("getTimestampDevice", py::overload_cast<>(&ImgFrame::getTimestampDevice, py::const_), DOC(dai, ImgFrame, getTimestampDevice))
120+
.def("getTimestamp", py::overload_cast<>(&ImgFrame::Buffer::getTimestamp, py::const_), DOC(dai, Buffer, getTimestamp))
121+
.def("getTimestampDevice", py::overload_cast<>(&ImgFrame::Buffer::getTimestampDevice, py::const_), DOC(dai, Buffer, getTimestampDevice))
122122
.def("getTimestamp", py::overload_cast<CameraExposureOffset>(&ImgFrame::getTimestamp, py::const_), py::arg("offset"), DOC(dai, ImgFrame, getTimestamp))
123123
.def("getTimestampDevice", py::overload_cast<CameraExposureOffset>(&ImgFrame::getTimestampDevice, py::const_), py::arg("offset"), DOC(dai, ImgFrame, getTimestampDevice))
124+
.def("getSequenceNum", &ImgFrame::Buffer::getSequenceNum, DOC(dai, Buffer, getSequenceNum))
124125
.def("getInstanceNum", &ImgFrame::getInstanceNum, DOC(dai, ImgFrame, getInstanceNum))
125126
.def("getCategory", &ImgFrame::getCategory, DOC(dai, ImgFrame, getCategory))
126-
.def("getSequenceNum", &ImgFrame::getSequenceNum, DOC(dai, ImgFrame, getSequenceNum))
127127
.def("getWidth", &ImgFrame::getWidth, DOC(dai, ImgFrame, getWidth))
128128
.def("getHeight", &ImgFrame::getHeight, DOC(dai, ImgFrame, getHeight))
129129
.def("getType", &ImgFrame::getType, DOC(dai, ImgFrame, getType))

0 commit comments

Comments
 (0)