Package Summary
Tags | No category tags. |
Version | 1.7.4 |
License | MIT |
Build type | CMAKE |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/luxonis/depthai-core.git |
VCS Type | git |
VCS Version | ros-release |
Last Updated | 2022-05-22 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Sachin Guruswamy
Authors
- Martin Peterlin
DepthAI C++ Library
Core C++ library
Documentation
Documentation is available over at Luxonis DepthAI API
Disclaimer
DepthAI library doesn't yet provide API stability guarantees. While we take care to properly deprecate old functions, some changes might still be breaking. We expect to provide API stability from version 3.0.0 onwards.
Dependencies
- CMake >= 3.10
- libusb1 development package (MacOS & Linux only)
- C/C++14 compiler
- [optional] OpenCV 4 (required if building examples)
MacOS: brew install libusb
, optionally with brew install opencv
Linux: sudo apt install libusb-1.0-0-dev
, optionally with sudo apt install libopencv-dev
Building
Make sure submodules are updated
git submodule update --init --recursive
Then configure and build
cmake -S. -Bbuild
cmake --build build
ℹ️ To speed up build times, use
cmake --build build --parallel [num CPU cores]
(CMake >= 3.12). For older versions use: Linux/macOS:cmake --build build -- -j[num CPU cores]
, MSVC:cmake --build build -- /MP[num CPU cores]
⚠️ If any CMake commands error with
CMake Error: The source directory "" does not exist.
replace argument-S
with-H
Dynamic library
To build dynamic version of library configure with following option added
cmake -S. -Bbuild -D'BUILD_SHARED_LIBS=ON'
cmake --build build
Running examples
To build the examples configure with following option added
cmake -S. -Bbuild -D'DEPTHAI_BUILD_EXAMPLES=ON'
cmake --build build
Then navigate to build/examples
folder and run a preferred example
cd build/examples
./MobileNet/rgb_mobilenet
ℹ️ Multi-Config generators (like Visual Studio on Windows) will have the examples built in
build/examples/MobileNet/[Debug/Release/...]/rgb_mobilenet
Integration
Under releases you may find prebuilt library for Windows, for use in either integration method. See Releases
CMake
Targets available to link to are: - depthai::core - Core library, without using opencv internally - depthai::opencv - Core + support for opencv related helper functions (requires OpenCV4)
Using find_package
Build static or dynamic version of library (See: Building and optionally Installing)
Add find_package
and target_link_libraries
to your project
find_package(depthai CONFIG REQUIRED)
...
target_link_libraries([my-app] PRIVATE depthai::opencv)
And point CMake to either build directory or install directory:
-D'depthai_DIR=depthai-core/build'
or
-D'depthai_DIR=depthai-core/build/install/lib/cmake/depthai'
If library was installed to default search path like /usr/local
on Linux, specifying depthai_DIR
isn't necessary as CMake will find it automatically.
Using add_subdirectory
This method is more intrusive but simpler as it doesn't require building the library separately.
Add add_subdirectory
which points to depthai-core
folder before project command. Then link to any required targets.
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/depthai-core EXCLUDE_FROM_ALL)
...
project(my-app)
...
target_link_libraries([my-app] PRIVATE depthai::opencv)
Non-CMake integration (Visual Studio, Xcode, CodeBlocks, ...)
To integrate into a different build system than CMake, prefered way is compiling as dynamic library and setting correct build options. 1. First build as dynamic library: Building Dynamic library 2. Then install: Installing
In your non-CMake project (new Visual Studio project, ...)
1. Set needed library directories:
- build/install/lib
(for linking to either depthai-core or depthai-opencv)
- build/install/bin
(for .dll's)
2. And include directories
- build/install/include
(library headers)
- build/install/include/depthai-shared/3rdparty
(shared 3rdparty headers)
- build/install/lib/cmake/depthai/dependencies/include
(dependency headers)
3. Add the following defines
- XLINK_USE_MX_ID_NAME=ON
- __PC__=ON
ℹ️ Threading library might need to be linked to explicitly.
ℹ️ Check
build/depthai-core-integration.txt
orbuild/depthai-opencv-integration.txt
for up to date define options. The generated integration file also specifies include paths without requiring installation.
Installing
To install specify optional prefix and build target install
cmake -S. -Bbuild -D'CMAKE_INSTALL_PREFIX=[path/to/install/dir]'
cmake --build build --target install
If CMAKE_INSTALL_PREFIX
isn't specified, the library is installed under build folder install
.
Environment variables
The following environment variables can be set to alter default behavior of the library without having to recompile
Environment variable | Description |
---|---|
DEPTHAI_LEVEL | Sets logging verbosity, 'trace', 'debug', 'warn', 'error' and 'off' |
DEPTHAI_INSTALL_SIGNAL_HANDLER | Set to 0 to disable installing Backward signal handler for stack trace printing |
DEPTHAI_WATCHDOG | Sets device watchdog timeout. Useful for debugging (DEPTHAI_WATCHDOG=0 ), to prevent device reset while the process is paused. |
DEPTHAI_WATCHDOG_INITIAL_DELAY | Specifies delay after which the device watchdog starts. |
DEPTHAI_SEARCH_TIMEOUT | Specifies timeout in milliseconds for device searching in blocking functions. |
DEPTHAI_CONNECT_TIMEOUT | Specifies timeout in milliseconds for establishing a connection to a given device. |
DEPTHAI_BOOTUP_TIMEOUT | Specifies timeout in milliseconds for waiting the device to boot after sending the binary. |
DEPTHAI_PROTOCOL | Restricts default search to the specified protocol. Options: any, usb, tcpip. |
DEPTHAI_DEVICE_BINARY | Overrides device Firmware binary. Mostly for internal debugging purposes. |
DEPTHAI_BOOTLOADER_BINARY_USB | Overrides device USB Bootloader binary. Mostly for internal debugging purposes. |
DEPTHAI_BOOTLOADER_BINARY_ETH | Overrides device Network Bootloader binary. Mostly for internal debugging purposes. |
DEPTHAI_ALLOW_FACTORY_FLASHING | Internal use only |
Running tests
To run the tests build the library with the following options
cmake -S. -Bbuild -D'DEPTHAI_TEST_EXAMPLES=ON' -D'DEPTHAI_BUILD_TESTS=ON' -D'DEPTHAI_BUILD_EXAMPLES=ON'
cmake --build build
Then navigate to build
folder and run ctest
with specified labels that denote device type to test on.
Currently available labels:
- usb
- poe
cd build
# Run tests on USB devices
ctest -L usb
# Run tests on PoE devices
ctest -L poe
Style check
The library uses clang format to enforce a certain coding style.
If a style check is failing, run the clangformat
target, check the output and push changes.
To use this target clang format must be installed, preferably clang-format-10
sudo apt install clang-format-10
And to apply formatting
cmake --build build --target clangformat
Documentation generation
Doxygen is used to generate documentation. Follow doxygen download and install the required binaries for your platform.
After that specify CMake define -D'DEPTHAI_BUILD_DOCS=ON
' and build the target doxygen
Debugging tips
Debugging can be done using Visual Studio Code and either GDB or LLDB (extension 'CodeLLDB').
LLDB in some cases was much faster to step with and resolved more incomplete_type
variables than GDB. Your mileage may vary though.
If there is a need to step into Hunter libraries, that can be achieved by removing previous built artifacts
rm -r ~/.hunter
And configuring the project with the following CMake option set to ON
cmake . -D'HUNTER_KEEP_PACKAGE_SOURCES=ON'
This retains the libraries source code, so that debugger can step through it (the paths are already set up correctly)
Troubleshooting
Build fails with missing OpenCV dependency
If your build process happen to fail due to OpenCV library not being found, but you have the OpenCV installed, please
run build with additional -D'OpenCV_DIR=...
' flag (replacing default Ubuntu path /usr/lib/x86_64-linux-gnu/cmake/opencv4
with yours)
cmake -S. -Bbuild -D'OpenCV_DIR=/usr/lib/x86_64-linux-gnu/cmake/opencv4'
Now the build process should correctly discover your OpenCV installation
Hunter
Hunter is a CMake-only dependency manager for C/C++ projects.
If you are stuck with error message which mentions external libraries (subdirectory of .hunter
) like the following:
/usr/bin/ld: /home/[user]/.hunter/_Base/062a19a/ccfed35/a84a713/Install/lib/liblzma.a(stream_flags_decoder.c.o): warning: relocation against `lzma_footer_magic' in read-only section `.text'
Try erasing the Hunter cache folder.
Linux/MacOS:
rm -r ~/.hunter
Windows:
del C:/.hunter
or
del C:/[user]/.hunter
Changelog for package depthai
1.7.4 (2022-05-20)
- Gen2: Release Dummy
1.0.0 (2021-02-26)
- Gen1: Release 1.0.0.0
- Merge pull request #68 from luxonis/develop Merge latest gen1 changes into main
- Merge pull request #58 from kunaltyagi/amend.gitmodules Allow recursive-clone with forks
- Allow recursive-clone with forks
- Update FW: fix -fusb2, USB descriptor was improperly set up, causing enumeration failure on Windows
- Merge pull request #45 from luxonis/pre_release_041 Bump core version; include fixes for Xlink
- Merge pull request #41 from luxonis/calibration_info Changed calibration file read and console information (gen1)
- Contributors: Kunal Tyagi, Sachin Guruswamy, SzabolcsGergely, TheMarpe, alex-luxonis, szabi-luxonis
0.4.1 (2021-01-22)
- Merge pull request #46 from luxonis/pre_release_041 Release 0.4.1.1
- Bump core version; include fixes for Xlink
- changed the debug print
- Merge remote-tracking branch \'origin/develop\' into calibration_info_1
- changed debug statements for calibration file
- Update FW: rotate RGB camera view 180deg on OAK-1 (Gen1)
- Update FW: increase_manual_exposure_limits
- Contributors: SzabolcsGergely, alex-luxonis, saching13, szabi-luxonis
0.4.0 (2020-12-02)
- Merge pull request #25 from luxonis/release_0_4_0 Release 0.4.0
- Bump version 0.4.0
- Merge pull request #24 from luxonis/rgb_fixes Update device FW with fixes for RGB
- Update device FW with fixes for RGB:
- fix crash with RGB 12MP + depth
- fix the cropping for 4K (make it centered)
- Merge pull request #14 from luxonis/usb-testing Fetching USB speed and Myriad X serial number
- updated xlink and device side commit
- updated device side sha id
- modified is_usb3()
- updated depthai-shared and changed device side commit id
- added wrapper for xlinkConnect to make it threadsafe in depthai-shared
- changed xlink path
- Merge pull request #22 from luxonis/fix_recreate_device_loop Fix crash on 2nd device object delete
- Fix crash on 2nd device delete, due to watchdog thread not recreated. Now running create+delete in a loop should work fine.
- renamed api to write_eeprom_data
- added api to write to eeprom and fetch existing pipeline
- Update FW, bugfix for config_h2d handling after initial setup
- Separate config_d2h handling in a new function, add test code to call it again at the end of create_pipeline. Add test code for sending a new config_h2d, TODO create API for sending a new calib file/structure.
- Device support for sending/receiving config_d2h/config_h2d (in this order, possible multiple times) after the initial setup, if the host sets app.enable_reconfig (default:true) in the first config. Report EEPROM write status as \'logs\' in the \"meta_d2h\" stream. Possible values: \"EEPROM cleared\" \"EEPROM write OK\" \"EEPROM write FAILED\"
- Do not crash when mat_mul fails, return an empty vector instead. Fixes a host app crash when the device calib data is full-zero. Was reproducible by writing to EEPROM a calib file generated by: dd if=/dev/zero of=resources/depthai.calib bs=1 count=445
- Merge remote-tracking branch \'origin/develop\' into usb-testing
- Merge pull request #21 from luxonis/release_0_3_0_0 Release 0.3.0
- added api to check cameras connection
- added device change check on swapping devices for testing
- added develop merged depthai device side
- updated device side hash
- Merge remote-tracking branch \'origin/develop\' into HEAD
- updatedd shared
- merge on updates
- added usb speed fetch
- updatedd shared
- added print statement on calibration file path to verify with mx id
- updated link to xlink
- updated link to xlink
- updated link to xlink
- updated link to xlink
- updated xlink config cmake
- updated device side config
- modified mx_id and is_usb3 api to use link id for multi device
- updated link to Xlink in config.cmake of hunter
- modified hunter cmake config
- changed XLink wrapped init from Host functions to not take speed and mx serial id as args and added getters in XLinkwrapper to fetch usb speed and mx serial id from XLink
- added eeprom loaded check
- updated hash commit to device and XLink
- update depthai-core
- modifed the Xlink wrapper to get myriad x serial id along with usb speed and added an api to return myriad x id for calibration saving of multiple devices
- updated device commit id
- Merge branch \'usb-testing\' of https://github.com/luxonis/depthai-core into HEAD
- updated on merge
- added is_usb3() check
- updating submodule linking
- modifed hunter config
- updated wrapper to write usb speed
- updated for usb fetch wip
- added usb speed fetch
- added is_usb3() check
- updating submodule linking
- modifed hunter config
- updated wrapper to write usb speed
- updated for usb fetch wip
- added usb speed fetch
- Contributors: Luxonis-Brandon, Sachin Guruswamy, alex-luxonis, saching13,
Wiki Tutorials
Source Tutorials
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged depthai at answers.ros.org
Package Summary
Tags | No category tags. |
Version | 1.7.4 |
License | MIT |
Build type | CMAKE |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/luxonis/depthai-core.git |
VCS Type | git |
VCS Version | ros-release |
Last Updated | 2022-05-22 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Sachin Guruswamy
Authors
- Martin Peterlin
DepthAI C++ Library
Core C++ library
Documentation
Documentation is available over at Luxonis DepthAI API
Disclaimer
DepthAI library doesn't yet provide API stability guarantees. While we take care to properly deprecate old functions, some changes might still be breaking. We expect to provide API stability from version 3.0.0 onwards.
Dependencies
- CMake >= 3.10
- libusb1 development package (MacOS & Linux only)
- C/C++14 compiler
- [optional] OpenCV 4 (required if building examples)
MacOS: brew install libusb
, optionally with brew install opencv
Linux: sudo apt install libusb-1.0-0-dev
, optionally with sudo apt install libopencv-dev
Building
Make sure submodules are updated
git submodule update --init --recursive
Then configure and build
cmake -S. -Bbuild
cmake --build build
ℹ️ To speed up build times, use
cmake --build build --parallel [num CPU cores]
(CMake >= 3.12). For older versions use: Linux/macOS:cmake --build build -- -j[num CPU cores]
, MSVC:cmake --build build -- /MP[num CPU cores]
⚠️ If any CMake commands error with
CMake Error: The source directory "" does not exist.
replace argument-S
with-H
Dynamic library
To build dynamic version of library configure with following option added
cmake -S. -Bbuild -D'BUILD_SHARED_LIBS=ON'
cmake --build build
Running examples
To build the examples configure with following option added
cmake -S. -Bbuild -D'DEPTHAI_BUILD_EXAMPLES=ON'
cmake --build build
Then navigate to build/examples
folder and run a preferred example
cd build/examples
./MobileNet/rgb_mobilenet
ℹ️ Multi-Config generators (like Visual Studio on Windows) will have the examples built in
build/examples/MobileNet/[Debug/Release/...]/rgb_mobilenet
Integration
Under releases you may find prebuilt library for Windows, for use in either integration method. See Releases
CMake
Targets available to link to are: - depthai::core - Core library, without using opencv internally - depthai::opencv - Core + support for opencv related helper functions (requires OpenCV4)
Using find_package
Build static or dynamic version of library (See: Building and optionally Installing)
Add find_package
and target_link_libraries
to your project
find_package(depthai CONFIG REQUIRED)
...
target_link_libraries([my-app] PRIVATE depthai::opencv)
And point CMake to either build directory or install directory:
-D'depthai_DIR=depthai-core/build'
or
-D'depthai_DIR=depthai-core/build/install/lib/cmake/depthai'
If library was installed to default search path like /usr/local
on Linux, specifying depthai_DIR
isn't necessary as CMake will find it automatically.
Using add_subdirectory
This method is more intrusive but simpler as it doesn't require building the library separately.
Add add_subdirectory
which points to depthai-core
folder before project command. Then link to any required targets.
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/depthai-core EXCLUDE_FROM_ALL)
...
project(my-app)
...
target_link_libraries([my-app] PRIVATE depthai::opencv)
Non-CMake integration (Visual Studio, Xcode, CodeBlocks, ...)
To integrate into a different build system than CMake, prefered way is compiling as dynamic library and setting correct build options. 1. First build as dynamic library: Building Dynamic library 2. Then install: Installing
In your non-CMake project (new Visual Studio project, ...)
1. Set needed library directories:
- build/install/lib
(for linking to either depthai-core or depthai-opencv)
- build/install/bin
(for .dll's)
2. And include directories
- build/install/include
(library headers)
- build/install/include/depthai-shared/3rdparty
(shared 3rdparty headers)
- build/install/lib/cmake/depthai/dependencies/include
(dependency headers)
3. Add the following defines
- XLINK_USE_MX_ID_NAME=ON
- __PC__=ON
ℹ️ Threading library might need to be linked to explicitly.
ℹ️ Check
build/depthai-core-integration.txt
orbuild/depthai-opencv-integration.txt
for up to date define options. The generated integration file also specifies include paths without requiring installation.
Installing
To install specify optional prefix and build target install
cmake -S. -Bbuild -D'CMAKE_INSTALL_PREFIX=[path/to/install/dir]'
cmake --build build --target install
If CMAKE_INSTALL_PREFIX
isn't specified, the library is installed under build folder install
.
Environment variables
The following environment variables can be set to alter default behavior of the library without having to recompile
Environment variable | Description |
---|---|
DEPTHAI_LEVEL | Sets logging verbosity, 'trace', 'debug', 'warn', 'error' and 'off' |
DEPTHAI_INSTALL_SIGNAL_HANDLER | Set to 0 to disable installing Backward signal handler for stack trace printing |
DEPTHAI_WATCHDOG | Sets device watchdog timeout. Useful for debugging (DEPTHAI_WATCHDOG=0 ), to prevent device reset while the process is paused. |
DEPTHAI_WATCHDOG_INITIAL_DELAY | Specifies delay after which the device watchdog starts. |
DEPTHAI_SEARCH_TIMEOUT | Specifies timeout in milliseconds for device searching in blocking functions. |
DEPTHAI_CONNECT_TIMEOUT | Specifies timeout in milliseconds for establishing a connection to a given device. |
DEPTHAI_BOOTUP_TIMEOUT | Specifies timeout in milliseconds for waiting the device to boot after sending the binary. |
DEPTHAI_PROTOCOL | Restricts default search to the specified protocol. Options: any, usb, tcpip. |
DEPTHAI_DEVICE_BINARY | Overrides device Firmware binary. Mostly for internal debugging purposes. |
DEPTHAI_BOOTLOADER_BINARY_USB | Overrides device USB Bootloader binary. Mostly for internal debugging purposes. |
DEPTHAI_BOOTLOADER_BINARY_ETH | Overrides device Network Bootloader binary. Mostly for internal debugging purposes. |
DEPTHAI_ALLOW_FACTORY_FLASHING | Internal use only |
Running tests
To run the tests build the library with the following options
cmake -S. -Bbuild -D'DEPTHAI_TEST_EXAMPLES=ON' -D'DEPTHAI_BUILD_TESTS=ON' -D'DEPTHAI_BUILD_EXAMPLES=ON'
cmake --build build
Then navigate to build
folder and run ctest
with specified labels that denote device type to test on.
Currently available labels:
- usb
- poe
cd build
# Run tests on USB devices
ctest -L usb
# Run tests on PoE devices
ctest -L poe
Style check
The library uses clang format to enforce a certain coding style.
If a style check is failing, run the clangformat
target, check the output and push changes.
To use this target clang format must be installed, preferably clang-format-10
sudo apt install clang-format-10
And to apply formatting
cmake --build build --target clangformat
Documentation generation
Doxygen is used to generate documentation. Follow doxygen download and install the required binaries for your platform.
After that specify CMake define -D'DEPTHAI_BUILD_DOCS=ON
' and build the target doxygen
Debugging tips
Debugging can be done using Visual Studio Code and either GDB or LLDB (extension 'CodeLLDB').
LLDB in some cases was much faster to step with and resolved more incomplete_type
variables than GDB. Your mileage may vary though.
If there is a need to step into Hunter libraries, that can be achieved by removing previous built artifacts
rm -r ~/.hunter
And configuring the project with the following CMake option set to ON
cmake . -D'HUNTER_KEEP_PACKAGE_SOURCES=ON'
This retains the libraries source code, so that debugger can step through it (the paths are already set up correctly)
Troubleshooting
Build fails with missing OpenCV dependency
If your build process happen to fail due to OpenCV library not being found, but you have the OpenCV installed, please
run build with additional -D'OpenCV_DIR=...
' flag (replacing default Ubuntu path /usr/lib/x86_64-linux-gnu/cmake/opencv4
with yours)
cmake -S. -Bbuild -D'OpenCV_DIR=/usr/lib/x86_64-linux-gnu/cmake/opencv4'
Now the build process should correctly discover your OpenCV installation
Hunter
Hunter is a CMake-only dependency manager for C/C++ projects.
If you are stuck with error message which mentions external libraries (subdirectory of .hunter
) like the following:
/usr/bin/ld: /home/[user]/.hunter/_Base/062a19a/ccfed35/a84a713/Install/lib/liblzma.a(stream_flags_decoder.c.o): warning: relocation against `lzma_footer_magic' in read-only section `.text'
Try erasing the Hunter cache folder.
Linux/MacOS:
rm -r ~/.hunter
Windows:
del C:/.hunter
or
del C:/[user]/.hunter
Changelog for package depthai
1.7.4 (2022-05-20)
- Gen2: Release Dummy
1.0.0 (2021-02-26)
- Gen1: Release 1.0.0.0
- Merge pull request #68 from luxonis/develop Merge latest gen1 changes into main
- Merge pull request #58 from kunaltyagi/amend.gitmodules Allow recursive-clone with forks
- Allow recursive-clone with forks
- Update FW: fix -fusb2, USB descriptor was improperly set up, causing enumeration failure on Windows
- Merge pull request #45 from luxonis/pre_release_041 Bump core version; include fixes for Xlink
- Merge pull request #41 from luxonis/calibration_info Changed calibration file read and console information (gen1)
- Contributors: Kunal Tyagi, Sachin Guruswamy, SzabolcsGergely, TheMarpe, alex-luxonis, szabi-luxonis
0.4.1 (2021-01-22)
- Merge pull request #46 from luxonis/pre_release_041 Release 0.4.1.1
- Bump core version; include fixes for Xlink
- changed the debug print
- Merge remote-tracking branch \'origin/develop\' into calibration_info_1
- changed debug statements for calibration file
- Update FW: rotate RGB camera view 180deg on OAK-1 (Gen1)
- Update FW: increase_manual_exposure_limits
- Contributors: SzabolcsGergely, alex-luxonis, saching13, szabi-luxonis
0.4.0 (2020-12-02)
- Merge pull request #25 from luxonis/release_0_4_0 Release 0.4.0
- Bump version 0.4.0
- Merge pull request #24 from luxonis/rgb_fixes Update device FW with fixes for RGB
- Update device FW with fixes for RGB:
- fix crash with RGB 12MP + depth
- fix the cropping for 4K (make it centered)
- Merge pull request #14 from luxonis/usb-testing Fetching USB speed and Myriad X serial number
- updated xlink and device side commit
- updated device side sha id
- modified is_usb3()
- updated depthai-shared and changed device side commit id
- added wrapper for xlinkConnect to make it threadsafe in depthai-shared
- changed xlink path
- Merge pull request #22 from luxonis/fix_recreate_device_loop Fix crash on 2nd device object delete
- Fix crash on 2nd device delete, due to watchdog thread not recreated. Now running create+delete in a loop should work fine.
- renamed api to write_eeprom_data
- added api to write to eeprom and fetch existing pipeline
- Update FW, bugfix for config_h2d handling after initial setup
- Separate config_d2h handling in a new function, add test code to call it again at the end of create_pipeline. Add test code for sending a new config_h2d, TODO create API for sending a new calib file/structure.
- Device support for sending/receiving config_d2h/config_h2d (in this order, possible multiple times) after the initial setup, if the host sets app.enable_reconfig (default:true) in the first config. Report EEPROM write status as \'logs\' in the \"meta_d2h\" stream. Possible values: \"EEPROM cleared\" \"EEPROM write OK\" \"EEPROM write FAILED\"
- Do not crash when mat_mul fails, return an empty vector instead. Fixes a host app crash when the device calib data is full-zero. Was reproducible by writing to EEPROM a calib file generated by: dd if=/dev/zero of=resources/depthai.calib bs=1 count=445
- Merge remote-tracking branch \'origin/develop\' into usb-testing
- Merge pull request #21 from luxonis/release_0_3_0_0 Release 0.3.0
- added api to check cameras connection
- added device change check on swapping devices for testing
- added develop merged depthai device side
- updated device side hash
- Merge remote-tracking branch \'origin/develop\' into HEAD
- updatedd shared
- merge on updates
- added usb speed fetch
- updatedd shared
- added print statement on calibration file path to verify with mx id
- updated link to xlink
- updated link to xlink
- updated link to xlink
- updated link to xlink
- updated xlink config cmake
- updated device side config
- modified mx_id and is_usb3 api to use link id for multi device
- updated link to Xlink in config.cmake of hunter
- modified hunter cmake config
- changed XLink wrapped init from Host functions to not take speed and mx serial id as args and added getters in XLinkwrapper to fetch usb speed and mx serial id from XLink
- added eeprom loaded check
- updated hash commit to device and XLink
- update depthai-core
- modifed the Xlink wrapper to get myriad x serial id along with usb speed and added an api to return myriad x id for calibration saving of multiple devices
- updated device commit id
- Merge branch \'usb-testing\' of https://github.com/luxonis/depthai-core into HEAD
- updated on merge
- added is_usb3() check
- updating submodule linking
- modifed hunter config
- updated wrapper to write usb speed
- updated for usb fetch wip
- added usb speed fetch
- added is_usb3() check
- updating submodule linking
- modifed hunter config
- updated wrapper to write usb speed
- updated for usb fetch wip
- added usb speed fetch
- Contributors: Luxonis-Brandon, Sachin Guruswamy, alex-luxonis, saching13,
Wiki Tutorials
Source Tutorials
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged depthai at answers.ros.org
Package Summary
Tags | No category tags. |
Version | 1.7.4 |
License | MIT |
Build type | CMAKE |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/luxonis/depthai-core.git |
VCS Type | git |
VCS Version | ros-release |
Last Updated | 2022-05-22 |
Dev Status | DEVELOPED |
CI status | No Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Sachin Guruswamy
Authors
- Martin Peterlin
DepthAI C++ Library
Core C++ library
Documentation
Documentation is available over at Luxonis DepthAI API
Disclaimer
DepthAI library doesn't yet provide API stability guarantees. While we take care to properly deprecate old functions, some changes might still be breaking. We expect to provide API stability from version 3.0.0 onwards.
Dependencies
- CMake >= 3.10
- libusb1 development package (MacOS & Linux only)
- C/C++14 compiler
- [optional] OpenCV 4 (required if building examples)
MacOS: brew install libusb
, optionally with brew install opencv
Linux: sudo apt install libusb-1.0-0-dev
, optionally with sudo apt install libopencv-dev
Building
Make sure submodules are updated
git submodule update --init --recursive
Then configure and build
cmake -S. -Bbuild
cmake --build build
ℹ️ To speed up build times, use
cmake --build build --parallel [num CPU cores]
(CMake >= 3.12). For older versions use: Linux/macOS:cmake --build build -- -j[num CPU cores]
, MSVC:cmake --build build -- /MP[num CPU cores]
⚠️ If any CMake commands error with
CMake Error: The source directory "" does not exist.
replace argument-S
with-H
Dynamic library
To build dynamic version of library configure with following option added
cmake -S. -Bbuild -D'BUILD_SHARED_LIBS=ON'
cmake --build build
Running examples
To build the examples configure with following option added
cmake -S. -Bbuild -D'DEPTHAI_BUILD_EXAMPLES=ON'
cmake --build build
Then navigate to build/examples
folder and run a preferred example
cd build/examples
./MobileNet/rgb_mobilenet
ℹ️ Multi-Config generators (like Visual Studio on Windows) will have the examples built in
build/examples/MobileNet/[Debug/Release/...]/rgb_mobilenet
Integration
Under releases you may find prebuilt library for Windows, for use in either integration method. See Releases
CMake
Targets available to link to are: - depthai::core - Core library, without using opencv internally - depthai::opencv - Core + support for opencv related helper functions (requires OpenCV4)
Using find_package
Build static or dynamic version of library (See: Building and optionally Installing)
Add find_package
and target_link_libraries
to your project
find_package(depthai CONFIG REQUIRED)
...
target_link_libraries([my-app] PRIVATE depthai::opencv)
And point CMake to either build directory or install directory:
-D'depthai_DIR=depthai-core/build'
or
-D'depthai_DIR=depthai-core/build/install/lib/cmake/depthai'
If library was installed to default search path like /usr/local
on Linux, specifying depthai_DIR
isn't necessary as CMake will find it automatically.
Using add_subdirectory
This method is more intrusive but simpler as it doesn't require building the library separately.
Add add_subdirectory
which points to depthai-core
folder before project command. Then link to any required targets.
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/depthai-core EXCLUDE_FROM_ALL)
...
project(my-app)
...
target_link_libraries([my-app] PRIVATE depthai::opencv)
Non-CMake integration (Visual Studio, Xcode, CodeBlocks, ...)
To integrate into a different build system than CMake, prefered way is compiling as dynamic library and setting correct build options. 1. First build as dynamic library: Building Dynamic library 2. Then install: Installing
In your non-CMake project (new Visual Studio project, ...)
1. Set needed library directories:
- build/install/lib
(for linking to either depthai-core or depthai-opencv)
- build/install/bin
(for .dll's)
2. And include directories
- build/install/include
(library headers)
- build/install/include/depthai-shared/3rdparty
(shared 3rdparty headers)
- build/install/lib/cmake/depthai/dependencies/include
(dependency headers)
3. Add the following defines
- XLINK_USE_MX_ID_NAME=ON
- __PC__=ON
ℹ️ Threading library might need to be linked to explicitly.
ℹ️ Check
build/depthai-core-integration.txt
orbuild/depthai-opencv-integration.txt
for up to date define options. The generated integration file also specifies include paths without requiring installation.
Installing
To install specify optional prefix and build target install
cmake -S. -Bbuild -D'CMAKE_INSTALL_PREFIX=[path/to/install/dir]'
cmake --build build --target install
If CMAKE_INSTALL_PREFIX
isn't specified, the library is installed under build folder install
.
Environment variables
The following environment variables can be set to alter default behavior of the library without having to recompile
Environment variable | Description |
---|---|
DEPTHAI_LEVEL | Sets logging verbosity, 'trace', 'debug', 'warn', 'error' and 'off' |
DEPTHAI_INSTALL_SIGNAL_HANDLER | Set to 0 to disable installing Backward signal handler for stack trace printing |
DEPTHAI_WATCHDOG | Sets device watchdog timeout. Useful for debugging (DEPTHAI_WATCHDOG=0 ), to prevent device reset while the process is paused. |
DEPTHAI_WATCHDOG_INITIAL_DELAY | Specifies delay after which the device watchdog starts. |
DEPTHAI_SEARCH_TIMEOUT | Specifies timeout in milliseconds for device searching in blocking functions. |
DEPTHAI_CONNECT_TIMEOUT | Specifies timeout in milliseconds for establishing a connection to a given device. |
DEPTHAI_BOOTUP_TIMEOUT | Specifies timeout in milliseconds for waiting the device to boot after sending the binary. |
DEPTHAI_PROTOCOL | Restricts default search to the specified protocol. Options: any, usb, tcpip. |
DEPTHAI_DEVICE_BINARY | Overrides device Firmware binary. Mostly for internal debugging purposes. |
DEPTHAI_BOOTLOADER_BINARY_USB | Overrides device USB Bootloader binary. Mostly for internal debugging purposes. |
DEPTHAI_BOOTLOADER_BINARY_ETH | Overrides device Network Bootloader binary. Mostly for internal debugging purposes. |
DEPTHAI_ALLOW_FACTORY_FLASHING | Internal use only |
Running tests
To run the tests build the library with the following options
cmake -S. -Bbuild -D'DEPTHAI_TEST_EXAMPLES=ON' -D'DEPTHAI_BUILD_TESTS=ON' -D'DEPTHAI_BUILD_EXAMPLES=ON'
cmake --build build
Then navigate to build
folder and run ctest
with specified labels that denote device type to test on.
Currently available labels:
- usb
- poe
cd build
# Run tests on USB devices
ctest -L usb
# Run tests on PoE devices
ctest -L poe
Style check
The library uses clang format to enforce a certain coding style.
If a style check is failing, run the clangformat
target, check the output and push changes.
To use this target clang format must be installed, preferably clang-format-10
sudo apt install clang-format-10
And to apply formatting
cmake --build build --target clangformat
Documentation generation
Doxygen is used to generate documentation. Follow doxygen download and install the required binaries for your platform.
After that specify CMake define -D'DEPTHAI_BUILD_DOCS=ON
' and build the target doxygen
Debugging tips
Debugging can be done using Visual Studio Code and either GDB or LLDB (extension 'CodeLLDB').
LLDB in some cases was much faster to step with and resolved more incomplete_type
variables than GDB. Your mileage may vary though.
If there is a need to step into Hunter libraries, that can be achieved by removing previous built artifacts
rm -r ~/.hunter
And configuring the project with the following CMake option set to ON
cmake . -D'HUNTER_KEEP_PACKAGE_SOURCES=ON'
This retains the libraries source code, so that debugger can step through it (the paths are already set up correctly)
Troubleshooting
Build fails with missing OpenCV dependency
If your build process happen to fail due to OpenCV library not being found, but you have the OpenCV installed, please
run build with additional -D'OpenCV_DIR=...
' flag (replacing default Ubuntu path /usr/lib/x86_64-linux-gnu/cmake/opencv4
with yours)
cmake -S. -Bbuild -D'OpenCV_DIR=/usr/lib/x86_64-linux-gnu/cmake/opencv4'
Now the build process should correctly discover your OpenCV installation
Hunter
Hunter is a CMake-only dependency manager for C/C++ projects.
If you are stuck with error message which mentions external libraries (subdirectory of .hunter
) like the following:
/usr/bin/ld: /home/[user]/.hunter/_Base/062a19a/ccfed35/a84a713/Install/lib/liblzma.a(stream_flags_decoder.c.o): warning: relocation against `lzma_footer_magic' in read-only section `.text'
Try erasing the Hunter cache folder.
Linux/MacOS:
rm -r ~/.hunter
Windows:
del C:/.hunter
or
del C:/[user]/.hunter
Changelog for package depthai
1.7.4 (2022-05-20)
- Gen2: Release Dummy
1.0.0 (2021-02-26)
- Gen1: Release 1.0.0.0
- Merge pull request #68 from luxonis/develop Merge latest gen1 changes into main
- Merge pull request #58 from kunaltyagi/amend.gitmodules Allow recursive-clone with forks
- Allow recursive-clone with forks
- Update FW: fix -fusb2, USB descriptor was improperly set up, causing enumeration failure on Windows
- Merge pull request #45 from luxonis/pre_release_041 Bump core version; include fixes for Xlink
- Merge pull request #41 from luxonis/calibration_info Changed calibration file read and console information (gen1)
- Contributors: Kunal Tyagi, Sachin Guruswamy, SzabolcsGergely, TheMarpe, alex-luxonis, szabi-luxonis
0.4.1 (2021-01-22)
- Merge pull request #46 from luxonis/pre_release_041 Release 0.4.1.1
- Bump core version; include fixes for Xlink
- changed the debug print
- Merge remote-tracking branch \'origin/develop\' into calibration_info_1
- changed debug statements for calibration file
- Update FW: rotate RGB camera view 180deg on OAK-1 (Gen1)
- Update FW: increase_manual_exposure_limits
- Contributors: SzabolcsGergely, alex-luxonis, saching13, szabi-luxonis
0.4.0 (2020-12-02)
- Merge pull request #25 from luxonis/release_0_4_0 Release 0.4.0
- Bump version 0.4.0
- Merge pull request #24 from luxonis/rgb_fixes Update device FW with fixes for RGB
- Update device FW with fixes for RGB:
- fix crash with RGB 12MP + depth
- fix the cropping for 4K (make it centered)
- Merge pull request #14 from luxonis/usb-testing Fetching USB speed and Myriad X serial number
- updated xlink and device side commit
- updated device side sha id
- modified is_usb3()
- updated depthai-shared and changed device side commit id
- added wrapper for xlinkConnect to make it threadsafe in depthai-shared
- changed xlink path
- Merge pull request #22 from luxonis/fix_recreate_device_loop Fix crash on 2nd device object delete
- Fix crash on 2nd device delete, due to watchdog thread not recreated. Now running create+delete in a loop should work fine.
- renamed api to write_eeprom_data
- added api to write to eeprom and fetch existing pipeline
- Update FW, bugfix for config_h2d handling after initial setup
- Separate config_d2h handling in a new function, add test code to call it again at the end of create_pipeline. Add test code for sending a new config_h2d, TODO create API for sending a new calib file/structure.
- Device support for sending/receiving config_d2h/config_h2d (in this order, possible multiple times) after the initial setup, if the host sets app.enable_reconfig (default:true) in the first config. Report EEPROM write status as \'logs\' in the \"meta_d2h\" stream. Possible values: \"EEPROM cleared\" \"EEPROM write OK\" \"EEPROM write FAILED\"
- Do not crash when mat_mul fails, return an empty vector instead. Fixes a host app crash when the device calib data is full-zero. Was reproducible by writing to EEPROM a calib file generated by: dd if=/dev/zero of=resources/depthai.calib bs=1 count=445
- Merge remote-tracking branch \'origin/develop\' into usb-testing
- Merge pull request #21 from luxonis/release_0_3_0_0 Release 0.3.0
- added api to check cameras connection
- added device change check on swapping devices for testing
- added develop merged depthai device side
- updated device side hash
- Merge remote-tracking branch \'origin/develop\' into HEAD
- updatedd shared
- merge on updates
- added usb speed fetch
- updatedd shared
- added print statement on calibration file path to verify with mx id
- updated link to xlink
- updated link to xlink
- updated link to xlink
- updated link to xlink
- updated xlink config cmake
- updated device side config
- modified mx_id and is_usb3 api to use link id for multi device
- updated link to Xlink in config.cmake of hunter
- modified hunter cmake config
- changed XLink wrapped init from Host functions to not take speed and mx serial id as args and added getters in XLinkwrapper to fetch usb speed and mx serial id from XLink
- added eeprom loaded check
- updated hash commit to device and XLink
- update depthai-core
- modifed the Xlink wrapper to get myriad x serial id along with usb speed and added an api to return myriad x id for calibration saving of multiple devices
- updated device commit id
- Merge branch \'usb-testing\' of https://github.com/luxonis/depthai-core into HEAD
- updated on merge
- added is_usb3() check
- updating submodule linking
- modifed hunter config
- updated wrapper to write usb speed
- updated for usb fetch wip
- added usb speed fetch
- added is_usb3() check
- updating submodule linking
- modifed hunter config
- updated wrapper to write usb speed
- updated for usb fetch wip
- added usb speed fetch
- Contributors: Luxonis-Brandon, Sachin Guruswamy, alex-luxonis, saching13,