Skip to content

Commit d0a7f1b

Browse files
committed
Merge branch 'xlink_device_search_improvements' into develop
2 parents 3ee46a5 + dadfc7d commit d0a7f1b

File tree

15 files changed

+110
-59
lines changed

15 files changed

+110
-59
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ jobs:
177177
matrix:
178178
python-version: [3.6, 3.7, 3.8, 3.9, '3.10']
179179
python-architecture: [x64, x86]
180+
fail-fast: false
180181
steps:
181182
- name: Cache .hunter folder
182183
uses: actions/cache@v2
@@ -230,6 +231,7 @@ jobs:
230231
strategy:
231232
matrix:
232233
python-version: [3.6, 3.7, 3.8, 3.9, '3.10']
234+
fail-fast: false
233235
steps:
234236
- name: Cache .hunter folder
235237
uses: actions/cache@v2

CMakeLists.txt

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ if(NOT WIN32)
99
set(HUNTER_CONFIGURATION_TYPES "Release" CACHE STRING "Hunter dependencies list of build configurations")
1010
endif()
1111

12+
# Specify path separator
13+
set(SYS_PATH_SEPARATOR ";")
14+
if(UNIX)
15+
set(SYS_PATH_SEPARATOR ":")
16+
endif()
17+
1218
# Generate combined Hunter config
1319
file(READ depthai-core/cmake/Hunter/config.cmake depthai_core_hunter_config)
1420
file(READ cmake/Hunter/config.cmake hunter_config)
@@ -97,6 +103,23 @@ pybind11_add_module(${TARGET_NAME}
97103
src/log/LogBindings.cpp
98104
)
99105

106+
if(WIN32)
107+
# Copy dlls to target directory - Windows only
108+
# TARGET_RUNTIME_DLLS generator expression available since CMake 3.21
109+
if(CMAKE_VERSION VERSION_LESS "3.21")
110+
file(GLOB depthai_dll_libraries "${HUNTER_INSTALL_PREFIX}/bin/*.dll")
111+
else()
112+
set(depthai_dll_libraries "$<TARGET_RUNTIME_DLLS:${TARGET_NAME}>")
113+
endif()
114+
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD COMMAND
115+
${CMAKE_COMMAND} -E copy ${depthai_dll_libraries} $<TARGET_FILE_DIR:${TARGET_NAME}>
116+
COMMAND_EXPAND_LISTS
117+
)
118+
119+
# Disable "d" postfix, so python can import the library as is
120+
set_target_properties(${TARGET_NAME} PROPERTIES DEBUG_POSTFIX "")
121+
endif()
122+
100123
# Add stubs (pyi) generation step after building bindings
101124
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "from mypy import api" RESULT_VARIABLE error OUTPUT_QUIET ERROR_QUIET)
102125
if(error)
@@ -108,7 +131,12 @@ else()
108131
endif()
109132
message(STATUS "Mypy available, creating and checking stubs. Running with generate_stubs.py ${TARGET_NAME} ${bindings_directory}")
110133
add_custom_command(TARGET ${TARGET_NAME} POST_BUILD COMMAND
111-
${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR}/generate_stubs.py" "${TARGET_NAME}" "${bindings_directory}"
134+
${CMAKE_COMMAND} -E env
135+
# PATH (dlls)
136+
"PATH=${HUNTER_INSTALL_PREFIX}/bin${SYS_PATH_SEPARATOR}$ENV{PATH}"
137+
# Python path (to find compiled module)
138+
"PYTHONPATH=$<TARGET_FILE_DIR:${TARGET_NAME}>${SYS_PATH_SEPARATOR}$ENV{PYTHONPATH}"
139+
${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR}/generate_stubs.py" "${TARGET_NAME}" "$<TARGET_FILE_DIR:${TARGET_NAME}>"
112140
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/generate_stubs.py"
113141
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
114142
)

docs/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ else()
4040
add_custom_target(sphinx ALL
4141
${CMAKE_COMMAND} -E env
4242
# Environment variables
43+
# PATH (dlls)
44+
"PATH=${HUNTER_INSTALL_PREFIX}/bin${SYS_PATH_SEPARATOR}$ENV{PATH}"
4345
# Python path (to find compiled module)
4446
"PYTHONPATH=$<TARGET_FILE_DIR:${TARGET_NAME}>${SYS_PATH_SEPARATOR}$ENV{PYTHONPATH}"
4547
# ASAN in case of sanitizers

docs/source/components/device.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,20 @@ When you create the device in the code, firmware is uploaded together with the p
4040
cfg = depthai.ImageManipConfig()
4141
input_q.send(cfg)
4242
43+
Connect to specified device
44+
###########################
45+
46+
If you have multiple devices and only want to connect to a specific one, or if your OAK PoE camera is outside of your
47+
subnet, you can specify the device (either with MxID, IP, or USB port name) you want to connect to.
48+
49+
.. code-block:: python
50+
51+
# Specify MXID, IP Address or USB path
52+
device_info = depthai.DeviceInfo("14442C108144F1D000") # MXID
53+
#device_info = depthai.DeviceInfo("192.168.1.44") # IP Address
54+
#device_info = depthai.DeviceInfo("3.3.3") # USB port name
55+
with depthai.Device(pipeline, device_info) as device:
56+
# ...
4357
4458
Multiple devices
4559
################

docs/source/tutorials/standalone_mode.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,9 @@ You can also **factory reset OAK POE at specific IP** if it's not reachable (not
139139
with tempfile.NamedTemporaryFile() as tmpBlFw:
140140
tmpBlFw.write(bytes(blBinary))
141141
142-
device_info = dai.DeviceInfo()
142+
device_info = dai.DeviceInfo("192.168.34.110") # Set IP here
143143
device_info.state = dai.XLinkDeviceState.X_LINK_BOOTLOADER
144-
device_info.desc.protocol = dai.XLinkProtocol.X_LINK_TCP_IP
145-
device_info.desc.name = "192.168.34.110" # Set IP here
144+
device_info.protocol = dai.XLinkProtocol.X_LINK_TCP_IP
146145
147146
with dai.DeviceBootloader(device_info, allowFlashingBootloader=True) as bootloader:
148147
progress = lambda p : print(f'Factory reset progress: {p*100:.1f}%')

examples/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ function(add_python_example example_name python_script_path)
3333
add_custom_target(${example_name}
3434
${CMAKE_COMMAND} -E env
3535
# Environment variables
36+
# PATH (dlls)
37+
"PATH=${HUNTER_INSTALL_PREFIX}/bin${SYS_PATH_SEPARATOR}$ENV{PATH}"
3638
# Python path (to find compiled module)
3739
"PYTHONPATH=$<TARGET_FILE_DIR:${TARGET_NAME}>${SYS_PATH_SEPARATOR}$ENV{PYTHONPATH}"
3840
# ASAN in case of sanitizers
@@ -49,6 +51,8 @@ function(add_python_example example_name python_script_path)
4951
# Adds test with 5 seconds timeout and bumps all python warnings to errors
5052
add_test(NAME ${example_name} COMMAND
5153
${CMAKE_COMMAND} -E env
54+
# PATH (dlls)
55+
"PATH=${HUNTER_INSTALL_PREFIX}/bin${SYS_PATH_SEPARATOR}$ENV{PATH}"
5256
# Python path (to find compiled module)
5357
"PYTHONPATH=$<TARGET_FILE_DIR:${TARGET_NAME}>${SYS_PATH_SEPARATOR}$ENV{PYTHONPATH}"
5458
# ASAN in case of sanitizers
@@ -70,6 +74,8 @@ if(DEPTHAI_PYTHON_TEST_EXAMPLES)
7074
# Adds install requirements test with 5 minute timeout
7175
add_test(NAME install_requirements COMMAND
7276
${CMAKE_COMMAND} -E env
77+
# PATH (dlls)
78+
"PATH=${HUNTER_INSTALL_PREFIX}/bin${SYS_PATH_SEPARATOR}$ENV{PATH}"
7379
# Python path (to find compiled module)
7480
"PYTHONPATH=$<TARGET_FILE_DIR:${TARGET_NAME}>${SYS_PATH_SEPARATOR}$ENV{PYTHONPATH}"
7581
# ASAN in case of sanitizers

examples/bootloader/bootloader_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
(res, info) = dai.DeviceBootloader.getFirstAvailableDevice()
3232

3333
if res:
34-
print(f'Found device with name: {info.desc.name}');
34+
print(f'Found device with name: {info.name}');
3535
with dai.DeviceBootloader(info) as bl:
3636
if read:
3737
print('Current flashed configuration')

examples/bootloader/bootloader_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
(res, info) = dai.DeviceBootloader.getFirstAvailableDevice()
66

77
if res == True:
8-
print(f'Found device with name: {info.desc.name}')
8+
print(f'Found device with name: {info.name}')
99
bl = dai.DeviceBootloader(info)
1010
print(f'Version: {bl.getVersion()}')
1111
else:

examples/bootloader/poe_set_ip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def check_str(s: str):
1212
return s
1313

1414
if found:
15-
print(f'Found device with name: {info.desc.name}')
15+
print(f'Found device with name: {info.name}')
1616
print('-------------------------------------')
1717
print('"1" to set a static IPv4 address')
1818
print('"2" to set a dynamic IPv4 address')

0 commit comments

Comments
 (0)