Skip to content

Commit

Permalink
Merge pull request #1045 from luxonis/release_2.27.0
Browse files Browse the repository at this point in the history
Release 2.27.0
  • Loading branch information
moratom authored Jun 26, 2024
2 parents 879bedb + 9cb397d commit 729e478
Show file tree
Hide file tree
Showing 15 changed files with 694 additions and 32 deletions.
35 changes: 32 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ endif()
# Early options
option(DEPTHAI_ENABLE_LIBUSB "Enable usage of libusb and interaction with USB devices" ON)

# Set to use native tls for windows before including Hunter (used for Curl)
if(WIN32)
set(DEPTHAI_CURL_USE_SCHANNEL ON)
set(DEPTHAI_CURL_USE_OPENSSL OFF)
else()
set(DEPTHAI_CURL_USE_SCHANNEL OFF)
set(DEPTHAI_CURL_USE_OPENSSL ON)
endif()

# Set type to canonicalize relative paths for user-provided toolchain
set(CMAKE_TOOLCHAIN_FILE "" CACHE FILEPATH "CMake toolchain path")

Expand All @@ -35,8 +44,8 @@ endif()

include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.23.322.tar.gz"
SHA1 "cb0ea1f74f4a2c49a807de34885743495fccccbe"
URL "https://github.com/cpp-pm/hunter/archive/9d9242b60d5236269f894efd3ddd60a9ca83dd7f.tar.gz"
SHA1 "16cc954aa723bccd16ea45fc91a858d0c5246376"
LOCAL # Local config for dependencies
)

Expand All @@ -46,7 +55,7 @@ if(WIN32)
endif()

# Create depthai project
project(depthai VERSION "2.26.0" LANGUAGES CXX C)
project(depthai VERSION "2.27.0" LANGUAGES CXX C)
get_directory_property(has_parent PARENT_DIRECTORY)
if(has_parent)
set(DEPTHAI_VERSION ${PROJECT_VERSION} PARENT_SCOPE)
Expand Down Expand Up @@ -111,6 +120,16 @@ else()
endif()
endif()

# Check if on 32 bit linux - default without CURL support
if(CMAKE_SIZEOF_VOID_P EQUAL 4 AND UNIX)
set(DEPTHAI_DEFAULT_CURL_SUPPORT OFF)
else()
set(DEPTHAI_DEFAULT_CURL_SUPPORT ON)
endif()

option(DEPTHAI_ENABLE_CURL "Enable CURL support" ${DEPTHAI_DEFAULT_CURL_SUPPORT})
message(STATUS "CURL support: ${DEPTHAI_ENABLE_CURL}")

# Force Colored output when using Ninja
# Global option - affects all targets
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)" OFF)
Expand Down Expand Up @@ -266,6 +285,7 @@ add_library(${TARGET_CORE_NAME}
src/utility/XLinkGlobalProfilingLogger.cpp
src/utility/Logging.cpp
src/utility/EepromDataParser.cpp
src/utility/LogCollection.cpp
src/xlink/XLinkConnection.cpp
src/xlink/XLinkStream.cpp
src/openvino/OpenVINO.cpp
Expand Down Expand Up @@ -456,8 +476,17 @@ target_link_libraries(${TARGET_CORE_NAME}
archive_static
spdlog::spdlog
ZLIB::zlib
ghcFilesystem::ghc_filesystem
)

if(DEPTHAI_ENABLE_CURL)
target_link_libraries(${TARGET_CORE_NAME} PRIVATE
CURL::libcurl
cpr::cpr
)
target_compile_definitions(${TARGET_CORE_NAME} PRIVATE DEPTHAI_ENABLE_CURL)
endif()

# Add compile & CMake definitions
set(DEPTHAI_DEVICE_VERSION "${DEPTHAI_DEVICE_SIDE_COMMIT}")
target_compile_definitions(${TARGET_CORE_NAME}
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ To install PCL:
MacOS: `brew install pcl`
Linux: `sudo apt install libpcl-dev`

> ℹ️ On Linux distributions based on RPMs, you need to install `perl-core` required by OpenSSL dependency.
>```
>sudo yum install perl-core
>```
>
> Another option is to disable CURL support by setting `DEPTHAI_ENABLE_CURL=OFF` when configuring CMake.
> ```
> cmake -S. -Bbuild -D'DEPTHAI_ENABLE_CURL=OFF'
> ```
## Building

Make sure submodules are updated
Expand Down Expand Up @@ -194,7 +203,8 @@ The following environment variables can be set to alter default behavior of the
| DEPTHAI_LIBUSB_ANDROID_JAVAVM | JavaVM pointer that is passed to libusb for rootless Android interaction with devices. Interpreted as decimal value of uintptr_t |
| DEPTHAI_CRASHDUMP | Directory in which to save the crash dump. |
| DEPTHAI_CRASHDUMP_TIMEOUT | Specifies the duration in seconds to wait for device reboot when obtaining a crash dump. Crash dump retrieval disabled if 0. |
| DEPTHAI_PCL_SUPPORT | Enables PCL support. |
| DEPTHAI_ENABLE_FEEDBACK_PIPELINE | Enables automatic pipeline schema collection used to improve the library |
| DEPTHAI_ENABLE_FEEDBACK_CRASHDUMP | Enables automatic crash dump collection used to improve the library |

## Running tests

Expand Down
2 changes: 1 addition & 1 deletion cmake/Depthai/DepthaiDeviceSideConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot")

# "full commit hash of device side binary"
set(DEPTHAI_DEVICE_SIDE_COMMIT "24a3b465b979de3f69410cd225914d8bd029f3ba")
set(DEPTHAI_DEVICE_SIDE_COMMIT "9822af7082d67b87c5307b9c37ec7f6ab8e1bbce")

# "version if applicable"
set(DEPTHAI_DEVICE_SIDE_VERSION "")
38 changes: 34 additions & 4 deletions cmake/Hunter/config.cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
hunter_config(
nlohmann_json
VERSION "3.9.1"
URL "https://github.com/nlohmann/json/archive/v3.9.1.tar.gz"
SHA1 "f8a20a7e19227906d77de0ede97468fbcfea03e7"
)

hunter_config(
XLink
VERSION "luxonis-2021.4.2-xlink-linkid-race-fix"
URL "https://github.com/luxonis/XLink/archive/e9eb1ef38030176ad70cddd3b545d5e6c509f1e1.tar.gz"
SHA1 "b1e4ded41cd7b9c37189468e2aaddbb10cbda9f6"
URL "https://github.com/luxonis/XLink/archive/e0eddd9f98c5eacecd4134cbdb713b3d7be039b8.tar.gz"
SHA1 "c97a20d98ce3a5e35cf922c5aaad7e861569869d"
CMAKE_ARGS
XLINK_ENABLE_LIBUSB=${DEPTHAI_ENABLE_LIBUSB}
)
Expand Down Expand Up @@ -126,3 +124,35 @@ hunter_config(
# Build shared libs by default to not cause licensing issues
BUILD_SHARED_LIBS=ON
)

hunter_config(
CURL
VERSION "7.88.1-p0-custom"
URL "https://github.com/cpp-pm/curl/archive/25d45e89d140d6ab27103cd7f8f6d7d6cf548d47.tar.gz"
SHA1 "db96d87e078e529a90dfb74de8d360a785c053aa"
CMAKE_ARGS
BUILD_CURL_TESTS=OFF
BUILD_CURL_EXE=OFF
CURL_USE_SCHANNEL=${DEPTHAI_CURL_USE_SCHANNEL}
CURL_USE_OPENSSL=${DEPTHAI_CURL_USE_OPENSSL} # Override hunter flags - no OpenSSL needed on Windows
BUILD_STATIC_CURL=ON
BUILD_SHARED_LIBS=OFF
BUILD_STATIC_LIBS=ON
)

hunter_config(
cpr
VERSION "1.4.0"
URL "https://github.com/luxonis/cpr/archive/a1d28dbbaccda3df8fddd993b2cd916f64f9da56.tar.gz"
SHA1 "14e18d04d05e36e920aa90ee744952bf55783ea4"
)

hunter_config(
ghc_filesystem
VERSION "1.5.14-luxonis"
URL "https://github.com/luxonis/filesystem/archive/d29630953f3526b61842d937764f012503a79ec3.tar.gz"
SHA1 "1cee5c95b53e014710970c920230ad1d3f3b5055"
CMAKE_ARGS
GHC_FILESYSTEM_BUILD_EXAMPLES=OFF
GHC_FILESYSTEM_BUILD_TESTING=OFF
)
2 changes: 2 additions & 0 deletions cmake/depthaiConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ set(DEPTHAI_SHARED_LIBS @BUILD_SHARED_LIBS@)
# Get whether library was build with Backward or not
set(DEPTHAI_ENABLE_BACKWARD @DEPTHAI_ENABLE_BACKWARD@)

set(DEPTHAI_ENABLE_CURL @DEPTHAI_ENABLE_CURL@)

# Specify that this is config mode (Called by find_package)
set(CONFIG_MODE TRUE)

Expand Down
12 changes: 12 additions & 0 deletions cmake/depthaiDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ else()
if(DEPTHAI_PCL_SUPPORT)
hunter_add_package(jsoncpp)
endif()

if(DEPTHAI_ENABLE_CURL)
hunter_add_package(CURL)
hunter_add_package(cpr)
endif()
hunter_add_package(ghc_filesystem)
endif()

# If library was build as static, find all dependencies
Expand Down Expand Up @@ -54,6 +60,12 @@ if(NOT CONFIG_MODE OR (CONFIG_MODE AND NOT DEPTHAI_SHARED_LIBS))
unset(STACK_DETAILS_AUTO_DETECT)
endif()

# Log collection dependencies
if(DEPTHAI_ENABLE_CURL)
find_package(CURL ${_QUIET} CONFIG REQUIRED)
find_package(cpr ${_QUIET} CONFIG REQUIRED)
endif()
find_package(ghc_filesystem ${_QUIET} CONFIG REQUIRED)
endif()

# Add threads (c++)
Expand Down
4 changes: 4 additions & 0 deletions include/depthai/device/DeviceBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "depthai-shared/device/CrashDump.hpp"
#include "depthai-shared/log/LogLevel.hpp"
#include "depthai-shared/log/LogMessage.hpp"
#include "depthai-shared/pipeline/PipelineSchema.hpp"

namespace dai {

Expand Down Expand Up @@ -995,5 +996,8 @@ class DeviceBase {

dai::Path firmwarePath;
bool dumpOnly = false;

// Schema of the started pipeline
tl::optional<PipelineSchema> pipelineSchema;
};
} // namespace dai
2 changes: 1 addition & 1 deletion include/depthai/pipeline/node/Camera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class Camera : public NodeCRTP<Node, Camera, CameraProperties> {
* Note that camera controls will be processed at this rate. E.g. if camera is running at 30 fps, and camera control is sent at every frame,
* but 3A fps is set to 15, the camera control messages will be processed at 15 fps rate, which will lead to queueing.
*/
void setIsp3aFps(int isp3aFps);
[[deprecated("setIsp3aFps is unstable")]] void setIsp3aFps(int isp3aFps);

/**
* Get rate at which camera should produce frames
Expand Down
2 changes: 1 addition & 1 deletion include/depthai/pipeline/node/ColorCamera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class ColorCamera : public NodeCRTP<Node, ColorCamera, ColorCameraProperties> {
* but 3A fps is set to 15, the camera control messages will be processed at 15 fps rate, which will lead to queueing.
*/
void setIsp3aFps(int isp3aFps);
[[deprecated("setIsp3aFps is unstable")]] void setIsp3aFps(int isp3aFps);

// Set events on which frames will be received
void setFrameEventFilter(const std::vector<dai::FrameEvent>& events);
Expand Down
2 changes: 1 addition & 1 deletion include/depthai/pipeline/node/MonoCamera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class MonoCamera : public NodeCRTP<Node, MonoCamera, MonoCameraProperties> {
* but 3A fps is set to 15, the camera control messages will be processed at 15 fps rate, which will lead to queueing.
*/
void setIsp3aFps(int isp3aFps);
[[deprecated("setIsp3aFps is unstable")]] void setIsp3aFps(int isp3aFps);

/**
* Get rate at which camera should produce frames
Expand Down
2 changes: 1 addition & 1 deletion shared/depthai-shared
27 changes: 8 additions & 19 deletions src/device/DeviceBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "spdlog/fmt/chrono.h"
#include "spdlog/sinks/stdout_color_sinks.h"
#include "spdlog/spdlog.h"
#include "utility/LogCollection.hpp"
#include "utility/Logging.hpp"

namespace dai {
Expand Down Expand Up @@ -527,13 +528,6 @@ unsigned int getCrashdumpTimeout(XLinkProtocol_t protocol) {
return DEFAULT_CRASHDUMP_TIMEOUT + (protocol == X_LINK_TCP_IP ? device::XLINK_TCP_WATCHDOG_TIMEOUT.count() : device::XLINK_USB_WATCHDOG_TIMEOUT.count());
}

tl::optional<std::string> saveCrashDump(dai::CrashDump& dump, std::string mxId) {
std::vector<uint8_t> data;
utility::serialize<SerializationType::JSON>(dump, data);
auto crashDumpPathStr = utility::getEnv("DEPTHAI_CRASHDUMP");
return saveFileToTemporaryDirectory(data, mxId + "-depthai_crash_dump.json", crashDumpPathStr);
}

void DeviceBase::closeImpl() {
using namespace std::chrono;
auto t1 = steady_clock::now();
Expand All @@ -544,12 +538,7 @@ void DeviceBase::closeImpl() {
if(hasCrashDump()) {
connection->setRebootOnDestruction(true);
auto dump = getCrashDump();
auto path = saveCrashDump(dump, deviceInfo.getMxId());
if(path.has_value()) {
pimpl->logger.warn("There was a fatal error. Crash dump saved to {}", path.value());
} else {
pimpl->logger.warn("There was a fatal error. Crash dump could not be saved");
}
logCollection::logCrashDump(pipelineSchema, dump, deviceInfo);
} else {
bool isRunning = pimpl->rpcClient->call("isRunning").as<bool>();
shouldGetCrashDump = !isRunning;
Expand Down Expand Up @@ -607,12 +596,8 @@ void DeviceBase::closeImpl() {
DeviceBase rebootingDevice(config, rebootingDeviceInfo, firmwarePath, true);
if(rebootingDevice.hasCrashDump()) {
auto dump = rebootingDevice.getCrashDump();
auto path = saveCrashDump(dump, deviceInfo.getMxId());
if(path.has_value()) {
pimpl->logger.warn("Device crashed. Crash dump saved to {}", path.value());
} else {
pimpl->logger.warn("Device crashed. Crash dump could not be saved");
}
logCollection::logCrashDump(pipelineSchema, dump, deviceInfo);

} else {
pimpl->logger.warn("Device crashed, but no crash dump could be extracted.");
}
Expand Down Expand Up @@ -1558,6 +1543,10 @@ bool DeviceBase::startPipelineImpl(const Pipeline& pipeline) {
// print assets on device side for test
pimpl->rpcClient->call("printAssets");

// Log the pipeline
logCollection::logPipeline(schema, deviceInfo);
this->pipelineSchema = schema; // Save the schema so it can be passed alongside the crashdump

// Build and start the pipeline
bool success = false;
std::string errorMsg;
Expand Down
Loading

0 comments on commit 729e478

Please sign in to comment.