Skip to content

Commit

Permalink
Ros release 2.21.0 (#795)
Browse files Browse the repository at this point in the history
* Several FW updates:
- !!! For all sockets/cameras to be scanned, the EEPROM calib data boardName/productName should contain "FFC" or an FFC-related board name: 1090/2090/2088. Otherwise the behavior is to scan only for standard OAK devices sockets/cameras
- Some more checks for the LCM48 (on MAX) supported resolutions
- Fixes for RGB-mono SW-sync for standard OAK-D / OAK-D-Lite camera configs
- AR0234 monochrome support, however needs an OV9282 enabled at the same time for now

* Color/MonoCamera: handle some more cases for newly added resolutions/sockets

* Update shared/FW after merge, fix error log printed for MonoCamera AUTO socket

* Closes: #355

* Bump version to 2.18.0

* Updated FW with some Color/MonoCamera fixes

* stability test

* Update FW:
- fix for high system load crash, especially on PoE devices
- for for OV9282 as MonoCamera on RGB/CAM_A socket

* FW: OV9282 720p/800p max FPS: 60 -> 120

* stability test

* Added a convinience setTimesync function

* Added isUserBootloaderSupported to DeviceBootloader

* Updated XLink with Windows improvements when scanning for already booted USB devices

* Updated FW with device time reset on boot

* Bump to v2.19.0

* Improved wording on unavailable devices

* Fix yolo v5 decoding when there is a single class

* FW: fixes for certain OV9782 and OV9282 permutations/configs,
fix for OV9782/OV9282 alone failing on RGB/CAM_A socket

* Update CI to Node16 compatible actions

* Update FW: fix image size when decimation filter is enabled

* Stability test - limit FPS (#633)

* Print CPU usage

* Limit the FPS so POE devices aren't maxed out

* Increase FPS

* Reverse changes to the system logger example

Co-authored-by: TheMarpe <[email protected]>
Co-authored-by: Matevz Morato <[email protected]>

* Added getProductName

* Added ids to IO for trace events

* Modified pipeline schema dump to happen on trace log level as well

* Renamed to getDeviceName and added some legacy handling

* Updated FW with productName as protected field and ImageManip behavior revert

* Updated style

* Added IR driver support for new OAK-FFC 4P

* FW: bugfix for device bootup with default static IP

* OAK-FFC 4P R5M1E5 IR/Dot support

* Bump to v2.19.1

* Added EepromError exception class and improved exception handling in calibration related methods

* Increased limit on DeviceBootloader monitor timeout

* Fixed check for user-provided toolchain file when given relative path (#645)

* Fixed check for user-provided toolchain file when given relative path

* WIP: camera/socket board configuration and capability to specify name/alias for a camera instead of socket

* Updated Bootloader to v0.0.22

* Added camera naming capabilites, setting and retrieving. WIP: rest of devices

* FW/CameraControl: fix still-capture for sockets other than RGB/center

* [FW] Fixed ImageManip + Subpixel issues and added FFC camera naming

* get/set camera FrameEvent filter

* Update depthai-shared submodule

* Disable depthai-shared commit hash check

* Change github workflows ubuntu version

* Update submodule

* Rename event filter

* fix #650 missing XLinkProtocolToStr() (#657)

- add local xlinkproto -> string from
  luxonis/XLink/tree/5c61615066af6539e50a4a17b5df3466e4350b21

* Updated grammar

* Update firmware

* WIP: Camera node

* Added capability to set XLink logging level via XLINK_LEVEL env var

* Replace "_CMAKE_" variables with "_DEPTHAI_" (#662)

"_CMAKE_" variables are reserved for internal use and should not be used.
This change also makes it harder for other CMake scripts to accidentall overwrite this variable.

Co-authored-by: Cameron Blomquist <[email protected]>

* Add comments

* Update FW: Add missing python bindings for boundingBoxMapping

* Updated NETWORK Bootloader with dual protocol capabilities

* [FW] Fixed a bug in board downselection. OAK-D S2/Pro camera enumeration fix.

* [FW] Added support for Mono video/preview in Camera node

* CI - Fixed style & tidy jobs

* Updated dual BL to v0.0.23 temporary build

* Added OAK-D-LR support. WIP: Orientation capability

* [FW/XLink] Explicitly limited to single connection

* ImageManip added colormap capability. TODO min/max range selection

* Add option to override baseline and/or focal length for disparity to depth conversion

* [FW] OAK-D-LR - Fixed default image orientation

* Updated brief description that affects docs of the DetectionParser node.

* Modified API of Camera a bit

* Updated FW with Camera changes and warp capabilities

* Updated FW with Camera warp capabilities

* Added dai::span

* Added undistort/warp API to Camera node

* FW - Modifed watchdog to do a graceful reset instead

* Added additional API to retrieve timestamps at various exposure points

* Fixed documentation on ObjectTracker::setMaxObjectsToTrack

* WIP: mockIsp capabilities

* [FW] Fix for CAM_C not being detected

* Device - Added non exclusive boot option

* Slight Colormap API improvements

* [FW] Added OpenVINO version 'universal'

* Added DeviceBase convinience constructors taking name or deviceid as string

* Add mode and median support to SLC

* Disabled some of the functionality for now

* Tweaked getTimestamp & exposure offset API

* FW: IMX296 support, added THE_1440x1080 resolution

* FW: IMX296 Camera node, IMX378 1080p limited to 60fps

* Bump version to 2.20.0

* Applied formatting

* Temporary revert to macos-11 for CI due to Catch2 issues

* Update FW, API

* Update FW

* Modified OpenVINO::VERSION_UNIVERSAL

* Updated Bootloader to 0.0.24

* Bump version and FW to 2.20.1 (Status LEDs improvement)

* calibration_flash example fix

* Fixed api docs for Warp HW ids

* FW: fix crash with ColorCamera at high resolution and certain ISP scaling

* FW: fix crash with ColorCamera at high resolution and certain ISP scaling

* Bump version to 2.20.2

* Added an ColorCamera isp scale example, and modified test workflow

* Implement multi stereo support

* Implement brightness filter

* FW: fix OV9282 SW-sync on devices with OV9782 RGB camera

* Update FW: Fix OOM due to too many SIPP pipelines

* Modified default device config OpenVINO version to universal

* Merge branch 'catch2_update'

* FW: handle EEPROM `boardOptions` bit 7 for separate I2C on L/R

* FW: fix for IMX378/477/577 on sockets other than RGB

* Update FW: support for stereo alignment to original left or right inputs; OOM fix for 4 stereo nodes with median filter

* Update FW: parsing optimization and improvements for Yolo v6, v6r2, v8

* Update FW w/ syncing stall fix

* Update stereo with more robust frame sync

* Update FW with optional override of spec translation for stereo algorithm calculations

* Correct type

* Update SPIOut.hpp

to address error C4458: declaration of 'id' hides class member

* Expose center alignment scale factor for debug purposes

* Expose SIPP mempool configurable sizes

* Update FW

* Fixed usage of DeviceBootloader with incomplete DeviceInfo and added a convinience constructor

* Closes: #714

* Add alpha scaling option for StereoDepth

* Update FW before merge

* Update FW with RGB alignment fix

* Update FW with performance metrics when DEPTHAI_LEVEL=info is enabled; enable brightness filter for 0 intensity pixels by default

* Improve spatial calculation X and Y accuracy; fix RGB alignment when custom output depth size is specified

* [XLink] Increased max number of links from 32 to 64

* Add crash dump functionality

* Change API to return just crash dump

* Update FW with commit hash attached to crash dump

* Update FW with fix for serialization of thread name

* Add hasCrashDump API

* Update FW

* Update FW, crash dump contains device ID

* Enable MEDAIN spatial calculation method for SpatialDetectionNetwork

* Update FW

* Update docs

* FW: HW sync (trigger mode) enabled for OAK-D-LR, for cameras with matching FPS

* Change default SIPP buffer sizes

* Add 3A skipping option to reduce CPU usage

* Change API to be able to configure isp 3A FPS

* Update BoarConfig with limits

* Update script node python bindings

* Update FW: Add workaround for BNO sequence number limit of 256 (sensors sends uint8)

* FW: camera sensor improvements:
- AR0234 improved AE smoothness, increased max gain to 400x (first 25.6x analog),
- OV9782 on RGB/CAM-A socket max FPS: 120 (previously was only for OV9282), also improves image quality in very bright light,
- OV9782/9282 minimum exposure time decreased: 20us -> 10us, helps in very bright light. TODO update tuning to make use of it, currently only possible to use with manual exposure

* Update stereo_depth_video.cpp

* Enable interrupt mode: Update BMI driver with fixes from: boschsensortec/BMI270_SensorAPI#16

* Update ObjectTracker with improvements from rvc3

* Add API to set trackingPerClass in ObjectTracker node

* Update FW before merge

* Update FW with IMU fix for BNO

* Add IMU versioning; firmware versioning, firmware update status callbacks

* Update FW with fix for BMI timestamp

* Update FW: IMU support for OAK-D-SR

* Fix 'default constrictible' error on some compilers

* Update FW

* Add IMU FW update RPC

* Updated yolo description

* Update examples

* Update FW with deprecation warning for enableFirmwareUpdate

* Change imu version to imu type

* Update FW before merge

* Added C++14 requirement to examples & tests

* Tweaked crash_report example

* [FW] Added missing bindings for CameraControl and ImgFrame

* Update FW with fix for calibration load example

* fix stability_stress_test fail to link on ubuntu

- fixes #769

* fix isClosed/checkClosed threading, rpcClient exceptions

- remove thread-unsafe checkClosed()
- update isClosed() doxygen + comments
- protect DataInputQueue::maxDataSize with std::atomic
- remove unused dai::DeviceBase::rpcStream
- fixes #520

* fix var hides class member, this-> in constructors

- fix few compile warn 'ex' unreferenced local variable
- rename setBusId() param to not hide class member
- refactor XLinkConnection constructors
- partial fix #247

* fix: stdexcept header added for std::runtime_error

Signed-off-by: Onuralp SEZER <[email protected]>

* [FW] Removed UTF-8 degree sign from temperature prints. Closes: #773

* Move sipp buffer size from BoardConfig to GlobalProperties

* Update style

* Partially reverted bce1444 - only kept the C++14 specified in examples, tests already had the version specified

* [Stereo] Add option to invalidate edge pixels on disparity/depth frame

* Update FW: handle disparity flipping

* Update FW: support for stereo.setOutputSize when LEFT or RIGHT alignment is set

* Update FW: support for stereo between RGB and LEFT/RIGHT

* [FW] ImageManip CSC improvements, New boards and power cycle fix

* FW: fix for UART0 / '/dev/ttyS0' init failure in Script node

* Update FW with fix for USB devices stuck after reboot

* Release v2.21.0

* updated version and changelot

* removed merge missing functions

---------

Signed-off-by: Onuralp SEZER <[email protected]>
Co-authored-by: alex-luxonis <[email protected]>
Co-authored-by: alex-luxonis <[email protected]>
Co-authored-by: TheMarpe <[email protected]>
Co-authored-by: SzabolcsGergely <[email protected]>
Co-authored-by: szabi-luxonis <[email protected]>
Co-authored-by: moratom <[email protected]>
Co-authored-by: Matevz Morato <[email protected]>
Co-authored-by: camblomquist <[email protected]>
Co-authored-by: Tommy <[email protected]>
Co-authored-by: Dale Phurrough <[email protected]>
Co-authored-by: Erol444 <[email protected]>
Co-authored-by: Cameron Blomquist <[email protected]>
Co-authored-by: anonymous-1000 <[email protected]>
Co-authored-by: TheMarpe <[email protected]>
Co-authored-by: Onuralp SEZER <[email protected]>
  • Loading branch information
16 people authored Apr 3, 2023
1 parent 24d626e commit 0dc56ee
Show file tree
Hide file tree
Showing 60 changed files with 595 additions and 319 deletions.
27 changes: 27 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package depthai
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2.21.0 (2023-04-03)
-----------
* Improved x/y accuracy for SpatialLocationCalculator/SpatialDetectionNetwork
* Support for median and mode, default changed to median in SpatialLocationCalculator/SpatialDetectionNetwork
* Multi stereo support, ability to run stereo between any 2 calibrated cameras
* Support for LEFT/RIGHT alignment in stereo node
* Support to invalidate edge pixels: setNumInvalidateEdgePixels in Stereo Node
* BrightnessFilter - If the input frame pixel is too dark or too bright, the disparity will be invalidated. Default pixels with value 0 are invalidated in Stereo Node
* Added disparityToDepthUseSpecTranslation, rectificationUseSpecTranslation, and depthAlignmentUseSpecTranslation options for advanced usage in Stereo Node
* Fix for RGB-depth alignment when RGB is configured to 12 MP
* Crash dump support - support to retrieve crash context from the device which can be shared with developers
* Configurable 3A fps - setIsp3aFps
* IMU - support to retrieve connected IMU type, and firmware version. Refactored firmware update API
* BMI270 - enable interrupt mode, timestamps are more consistent now
* BNO086* - fix for sequence number
* AR0234 improved AE smoothness, increased max gain to 400x (first 25.6x analog),
* OV9782 on RGB/CAM-A socket max FPS: 120 (previously was only for OV9282), also improves image quality in very bright light,
* OV9782/9282 minimum exposure time decreased: 20us -> 10us, helps in very bright light. TODO update tuning to make use of it, currently only possible to use with manual exposure
* HW sync (trigger mode) enabled for OAK-D-LR, for cameras with matching FPS
* FW: fix for UART0 / '/dev/ttyS0' init failure in Script node
* POE power cycle fix - in rare occasions POE devices got stuck after reboot, requiring a manual power cycle
* [XLink] Increased max number of links from 32 to 64
* Update FW with performance metrics when DEPTHAI_LEVEL=info is enabled
* Handle EEPROM boardOptions bit 7 for separate I2C on L/R cameras
* Contributors: Alex Bougdan, Szabolcs Gergely, Martin Peterlin

2.20.2 (2023-01-31)
-----------
* Fix for ColorCamera at high resolution while using isp scaling
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ if(WIN32)
endif()

# Create depthai project
project(depthai VERSION "2.20.2" LANGUAGES CXX C)
project(depthai VERSION "2.21.0" LANGUAGES CXX C)
get_directory_property(has_parent PARENT_DIRECTORY)
if(has_parent)
set(DEPTHAI_VERSION ${PROJECT_VERSION} PARENT_SCOPE)
Expand Down
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,29 @@ cmake -S. -Bbuild -D'BUILD_SHARED_LIBS=ON'
cmake --build build
```


### Android

Android is supported to some extent but not actively pursued nor tested. PRs with any improvements are welcome.

Steps:

- Install Android NDK (for example via Android Studio).
- Set the NDK path:
```
export ANDROID_HOME=$HOME/.local/lib/Android
export PATH=$PATH:$ANDROID_HOME/emulator:$ANDROID_HOME/platform-tools
export NDK=$ANDROID_HOME/ndk/23.1.7779620/ # Check version
```
- Ensure a recent version of cmake (apt version is outdated, install snap install cmake --classic)
- Run cmake, set your ABI and Platform as needed:

```
cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-25
cmake --build build
```


## Running examples

To build the examples configure with following option added
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 "8c3d6ac1c77b0bf7f9ea6fd4d962af37663d2fbd")
set(DEPTHAI_DEVICE_SIDE_COMMIT "57ca2c171f6ef53cb83fbbc3aabfe512c67796ce")

# "version if applicable"
set(DEPTHAI_DEVICE_SIDE_VERSION "")
8 changes: 4 additions & 4 deletions cmake/Hunter/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ hunter_config(
hunter_config(
XLink
VERSION "luxonis-2021.4.2-develop"
URL "https://github.com/luxonis/XLink/archive/1ef2f960eec66540891434c9a3341c11e66e4360.tar.gz"
SHA1 "23641bb9ae698d0e016abcce349094a38577838b"
URL "https://github.com/luxonis/XLink/archive/b7c3aca2ba8b9d598be886a8076a875b50f5184f.tar.gz"
SHA1 "6c19757c6fe6871a9f40688871edbfc6f1e939ee"
)

hunter_config(
Expand Down Expand Up @@ -100,8 +100,8 @@ hunter_config(
hunter_config(
Catch2
VERSION "2.13.7"
URL "https://github.com/catchorg/Catch2/archive/refs/tags/v2.13.7.tar.gz"
SHA1 "fa8f14ccf852413d3c6d3999145ada934d37d773"
URL "https://github.com/catchorg/Catch2/archive/refs/tags/v3.2.1.tar.gz"
SHA1 "acfba7f71cbbbbf60bc1bc4c0e3efca4a9c70df7"
)

# ZLib - Luxonis fix for alias on imported target for old CMake versions
Expand Down
7 changes: 7 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ function(dai_add_example example_name example_src enable_test)
add_executable(${example_name} ${example_src})
add_default_flags(${example_name} LEAN)
target_link_libraries(${example_name} PRIVATE utility depthai::opencv ${OpenCV_LIBS} Threads::Threads)
# Set compiler features (c++14), and disables extensions (g++14)
set_property(TARGET ${example_name} PROPERTY CXX_STANDARD 14)
set_property(TARGET ${example_name} PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET ${example_name} PROPERTY CXX_EXTENSIONS OFF)

# Add sanitizers for example
if(COMMAND add_sanitizers)
Expand Down Expand Up @@ -359,3 +363,6 @@ dai_add_example(apriltag_rgb AprilTag/apriltag_rgb.cpp ON)
# DetectionParser
dai_add_example(detection_parser NeuralNetwork/detection_parser.cpp ON)
target_compile_definitions(detection_parser PRIVATE BLOB_PATH="${mobilenet_blob}")

# DetectionParser
dai_add_example(crash_report CrashReport/crash_report.cpp OFF)
41 changes: 41 additions & 0 deletions examples/CrashReport/crash_report.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include <fstream>
#include <iostream>

// Includes common necessary includes for development using depthai library
#include "depthai/depthai.hpp"

static bool fileExists(dai::Path path) {
std::ifstream file(path);
return file.is_open();
}

int main() {
using namespace std;

// Connect to device and start pipeline
dai::Device device;
if(device.hasCrashDump()) {
auto crashDump = device.getCrashDump();
std::string commitHash = crashDump.depthaiCommitHash;
std::string deviceId = crashDump.deviceId;

auto json = crashDump.serializeToJson();

for(int i = 0;; i++) {
dai::Path destPath = "crashDump_" + to_string(i) + "_" + deviceId + "_" + commitHash + ".json";
if(fileExists(destPath)) continue;

std::ofstream ob(destPath);
ob << std::setw(4) << json << std::endl;

std::cout << "Crash dump found on your device!" << std::endl;
std::cout << "Saved to " << destPath.string() << std::endl;
std::cout << "Please report to developers!" << std::endl;
break;
}
} else {
std::cout << "There was no crash dump found on your device!" << std::endl;
}

return 0;
}
4 changes: 1 addition & 3 deletions examples/FeatureTracker/feature_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ class FeatureTrackerDrawer {
}
}

FeatureTrackerDrawer(std::string trackbarName, std::string windowName) {
this->trackbarName = trackbarName;
this->windowName = windowName;
FeatureTrackerDrawer(std::string trackbarName, std::string windowName) : trackbarName(trackbarName), windowName(windowName) {
cv::namedWindow(windowName.c_str());
cv::createTrackbar(trackbarName.c_str(), windowName.c_str(), &trackedFeaturesPathLength, maxTrackedFeaturesPathLength, nullptr);
}
Expand Down
82 changes: 24 additions & 58 deletions examples/IMU/imu_firmware_update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ int main() {
using namespace std;
using namespace std::chrono;

dai::Device device;

auto imuType = device.getConnectedIMU();
auto imuFirmwareVersion = device.getIMUFirmwareVersion();
auto embeddedIMUFirmwareVersion = device.getEmbeddedIMUFirmwareVersion();
std::cout << "IMU type: " << imuType << " firmware version: " << imuFirmwareVersion
<< " embedded firmware version: " << embeddedIMUFirmwareVersion << std::endl;

std::cout << "Warning! Flashing IMU firmware can potentially soft brick your device and should be done with caution." << std::endl;
std::cout << "Do not unplug your device while the IMU firmware is flashing." << std::endl;
std::cout << "Type 'y' and press enter to proceed, otherwise exits: ";
Expand All @@ -20,68 +28,26 @@ int main() {
return -1;
}

// Create pipeline
dai::Pipeline pipeline;

// Define sources and outputs
auto imu = pipeline.create<dai::node::IMU>();
auto xlinkOut = pipeline.create<dai::node::XLinkOut>();

xlinkOut->setStreamName("imu");

// enable ACCELEROMETER_RAW at 500 hz rate
imu->enableIMUSensor(dai::IMUSensor::ACCELEROMETER_RAW, 500);
// enable GYROSCOPE_RAW at 400 hz rate
imu->enableIMUSensor(dai::IMUSensor::GYROSCOPE_RAW, 400);
// it's recommended to set both setBatchReportThreshold and setMaxBatchReports to 20 when integrating in a pipeline with a lot of input/output connections
// above this threshold packets will be sent in batch of X, if the host is not blocked and USB bandwidth is available
imu->setBatchReportThreshold(1);
// maximum number of IMU packets in a batch, if it's reached device will block sending until host can receive it
// if lower or equal to batchReportThreshold then the sending is always blocking on device
// useful to reduce device's CPU load and number of lost packets, if CPU load is high on device side due to multiple nodes
imu->setMaxBatchReports(10);

// Link plugins IMU -> XLINK
imu->out.link(xlinkOut->input);

imu->enableFirmwareUpdate(true);

// Pipeline is defined, now we can connect to the device
dai::Device d(pipeline);

bool firstTs = false;

auto imuQueue = d.getOutputQueue("imu", 50, false);
auto baseTs = std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration>();
auto started = device.startIMUFirmwareUpdate();
if(!started) {
std::cout << "Couldn't start IMU firmware update" << std::endl;
return 1;
}

while(true) {
auto imuData = imuQueue->get<dai::IMUData>();

auto imuPackets = imuData->packets;
for(auto& imuPacket : imuPackets) {
auto& acceleroValues = imuPacket.acceleroMeter;
auto& gyroValues = imuPacket.gyroscope;

auto acceleroTs1 = acceleroValues.getTimestampDevice();
auto gyroTs1 = gyroValues.getTimestampDevice();
if(!firstTs) {
baseTs = std::min(acceleroTs1, gyroTs1);
firstTs = true;
bool fwUpdateFinished;
float percentage;
std::tie(fwUpdateFinished, percentage) = device.getIMUFirmwareUpdateStatus();
std::cout << "IMU FW update status: " << std::setprecision(1) << percentage << std::endl;
if(fwUpdateFinished) {
if(percentage == 100) {
std::cout << "Firmware update successful!" << std::endl;
} else {
std::cout << "Firmware update failed!" << std::endl;
}

auto acceleroTs = acceleroTs1 - baseTs;
auto gyroTs = gyroTs1 - baseTs;

printf("Accelerometer timestamp: %ld ms\n", static_cast<long>(duration_cast<milliseconds>(acceleroTs).count()));
printf("Accelerometer [m/s^2]: x: %.3f y: %.3f z: %.3f \n", acceleroValues.x, acceleroValues.y, acceleroValues.z);
printf("Gyroscope timestamp: %ld ms\n", static_cast<long>(duration_cast<milliseconds>(gyroTs).count()));
printf("Gyroscope [rad/s]: x: %.3f y: %.3f z: %.3f \n", gyroValues.x, gyroValues.y, gyroValues.z);
}

int key = cv::waitKey(1);
if(key == 'q') {
return 0;
break;
}
std::this_thread::sleep_for(1s);
}

return 0;
Expand Down
28 changes: 28 additions & 0 deletions examples/SpatialDetection/spatial_location_calculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ int main() {
dai::SpatialLocationCalculatorConfigData config;
config.depthThresholds.lowerThreshold = 100;
config.depthThresholds.upperThreshold = 10000;
auto calculationAlgorithm = dai::SpatialLocationCalculatorAlgorithm::MEDIAN;
config.calculationAlgorithm = calculationAlgorithm;
config.roi = dai::Rect(topLeft, bottomRight);

spatialDataCalculator->inputConfig.setWaitForMessage(false);
Expand Down Expand Up @@ -144,12 +146,38 @@ int main() {
newConfig = true;
}
break;
case '1':
calculationAlgorithm = dai::SpatialLocationCalculatorAlgorithm::MEAN;
newConfig = true;
std::cout << "Switching calculation algorithm to MEAN!" << std::endl;
break;
case '2':
calculationAlgorithm = dai::SpatialLocationCalculatorAlgorithm::MIN;
newConfig = true;
std::cout << "Switching calculation algorithm to MIN!" << std::endl;
break;
case '3':
calculationAlgorithm = dai::SpatialLocationCalculatorAlgorithm::MAX;
newConfig = true;
std::cout << "Switching calculation algorithm to MAX!" << std::endl;
break;
case '4':
calculationAlgorithm = dai::SpatialLocationCalculatorAlgorithm::MODE;
newConfig = true;
std::cout << "Switching calculation algorithm to MODE!" << std::endl;
break;
case '5':
calculationAlgorithm = dai::SpatialLocationCalculatorAlgorithm::MEDIAN;
newConfig = true;
std::cout << "Switching calculation algorithm to MEDIAN!" << std::endl;
break;
default:
break;
}

if(newConfig) {
config.roi = dai::Rect(topLeft, bottomRight);
config.calculationAlgorithm = calculationAlgorithm;
dai::SpatialLocationCalculatorConfig cfg;
cfg.addROI(config);
spatialCalcConfigInQueue->send(cfg);
Expand Down
1 change: 0 additions & 1 deletion examples/StereoDepth/stereo_depth_video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ int main() {
cv::imshow("right", right->getFrame());

if(withDepth) {
// Note: in some configurations (if depth is enabled), disparity may output garbage data
auto disparity = dispQueue->get<dai::ImgFrame>();
cv::Mat disp(disparity->getCvFrame());
disp.convertTo(disp, CV_8UC1, disparityMultiplier); // Extend disparity range
Expand Down
10 changes: 9 additions & 1 deletion include/depthai/device/DataQueue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ class DataOutputQueue {

/**
* Check whether queue is closed
*
* @warning This function is thread-unsafe and may return outdated incorrect values. It is
* only meant for use in simple single-threaded code. Well written code should handle
* exceptions when calling any DepthAI apis to handle hardware events and multithreaded use.
*/
bool isClosed() const;

Expand Down Expand Up @@ -343,7 +347,7 @@ class DataInputQueue {
std::atomic<bool> running{true};
std::string exceptionMessage;
const std::string name;
std::size_t maxDataSize = device::XLINK_USB_BUFFER_MAX_SIZE;
std::atomic<std::size_t> maxDataSize{device::XLINK_USB_BUFFER_MAX_SIZE};

public:
DataInputQueue(const std::shared_ptr<XLinkConnection> conn,
Expand All @@ -355,6 +359,10 @@ class DataInputQueue {

/**
* Check whether queue is closed
*
* @warning This function is thread-unsafe and may return outdated incorrect values. It is
* only meant for use in simple single-threaded code. Well written code should handle
* exceptions when calling any DepthAI apis to handle hardware events and multithreaded use.
*/
bool isClosed() const;

Expand Down
Loading

0 comments on commit 0dc56ee

Please sign in to comment.