Skip to content

Commit 0dc56ee

Browse files
saching13alex-luxonisthemarpeSzabolcsGergelySzabolcsGergely
authored
Ros release 2.21.0 (#795)
* 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]>
1 parent 24d626e commit 0dc56ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+595
-319
lines changed

CHANGELOG.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22
Changelog for package depthai
33
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
5+
2.21.0 (2023-04-03)
6+
-----------
7+
* Improved x/y accuracy for SpatialLocationCalculator/SpatialDetectionNetwork
8+
* Support for median and mode, default changed to median in SpatialLocationCalculator/SpatialDetectionNetwork
9+
* Multi stereo support, ability to run stereo between any 2 calibrated cameras
10+
* Support for LEFT/RIGHT alignment in stereo node
11+
* Support to invalidate edge pixels: setNumInvalidateEdgePixels in Stereo Node
12+
* 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
13+
* Added disparityToDepthUseSpecTranslation, rectificationUseSpecTranslation, and depthAlignmentUseSpecTranslation options for advanced usage in Stereo Node
14+
* Fix for RGB-depth alignment when RGB is configured to 12 MP
15+
* Crash dump support - support to retrieve crash context from the device which can be shared with developers
16+
* Configurable 3A fps - setIsp3aFps
17+
* IMU - support to retrieve connected IMU type, and firmware version. Refactored firmware update API
18+
* BMI270 - enable interrupt mode, timestamps are more consistent now
19+
* BNO086* - fix for sequence number
20+
* AR0234 improved AE smoothness, increased max gain to 400x (first 25.6x analog),
21+
* OV9782 on RGB/CAM-A socket max FPS: 120 (previously was only for OV9282), also improves image quality in very bright light,
22+
* 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
23+
* HW sync (trigger mode) enabled for OAK-D-LR, for cameras with matching FPS
24+
* FW: fix for UART0 / '/dev/ttyS0' init failure in Script node
25+
* POE power cycle fix - in rare occasions POE devices got stuck after reboot, requiring a manual power cycle
26+
* [XLink] Increased max number of links from 32 to 64
27+
* Update FW with performance metrics when DEPTHAI_LEVEL=info is enabled
28+
* Handle EEPROM boardOptions bit 7 for separate I2C on L/R cameras
29+
* Contributors: Alex Bougdan, Szabolcs Gergely, Martin Peterlin
30+
431
2.20.2 (2023-01-31)
532
-----------
633
* Fix for ColorCamera at high resolution while using isp scaling

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ if(WIN32)
4545
endif()
4646

4747
# Create depthai project
48-
project(depthai VERSION "2.20.2" LANGUAGES CXX C)
48+
project(depthai VERSION "2.21.0" LANGUAGES CXX C)
4949
get_directory_property(has_parent PARENT_DIRECTORY)
5050
if(has_parent)
5151
set(DEPTHAI_VERSION ${PROJECT_VERSION} PARENT_SCOPE)

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,29 @@ cmake -S. -Bbuild -D'BUILD_SHARED_LIBS=ON'
4747
cmake --build build
4848
```
4949

50+
51+
### Android
52+
53+
Android is supported to some extent but not actively pursued nor tested. PRs with any improvements are welcome.
54+
55+
Steps:
56+
57+
- Install Android NDK (for example via Android Studio).
58+
- Set the NDK path:
59+
```
60+
export ANDROID_HOME=$HOME/.local/lib/Android
61+
export PATH=$PATH:$ANDROID_HOME/emulator:$ANDROID_HOME/platform-tools
62+
export NDK=$ANDROID_HOME/ndk/23.1.7779620/ # Check version
63+
```
64+
- Ensure a recent version of cmake (apt version is outdated, install snap install cmake --classic)
65+
- Run cmake, set your ABI and Platform as needed:
66+
67+
```
68+
cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-25
69+
cmake --build build
70+
```
71+
72+
5073
## Running examples
5174

5275
To build the examples configure with following option added

cmake/Depthai/DepthaiDeviceSideConfig.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot")
33

44
# "full commit hash of device side binary"
5-
set(DEPTHAI_DEVICE_SIDE_COMMIT "8c3d6ac1c77b0bf7f9ea6fd4d962af37663d2fbd")
5+
set(DEPTHAI_DEVICE_SIDE_COMMIT "57ca2c171f6ef53cb83fbbc3aabfe512c67796ce")
66

77
# "version if applicable"
88
set(DEPTHAI_DEVICE_SIDE_VERSION "")

cmake/Hunter/config.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ hunter_config(
88
hunter_config(
99
XLink
1010
VERSION "luxonis-2021.4.2-develop"
11-
URL "https://github.com/luxonis/XLink/archive/1ef2f960eec66540891434c9a3341c11e66e4360.tar.gz"
12-
SHA1 "23641bb9ae698d0e016abcce349094a38577838b"
11+
URL "https://github.com/luxonis/XLink/archive/b7c3aca2ba8b9d598be886a8076a875b50f5184f.tar.gz"
12+
SHA1 "6c19757c6fe6871a9f40688871edbfc6f1e939ee"
1313
)
1414

1515
hunter_config(
@@ -100,8 +100,8 @@ hunter_config(
100100
hunter_config(
101101
Catch2
102102
VERSION "2.13.7"
103-
URL "https://github.com/catchorg/Catch2/archive/refs/tags/v2.13.7.tar.gz"
104-
SHA1 "fa8f14ccf852413d3c6d3999145ada934d37d773"
103+
URL "https://github.com/catchorg/Catch2/archive/refs/tags/v3.2.1.tar.gz"
104+
SHA1 "acfba7f71cbbbbf60bc1bc4c0e3efca4a9c70df7"
105105
)
106106

107107
# ZLib - Luxonis fix for alias on imported target for old CMake versions

examples/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ function(dai_add_example example_name example_src enable_test)
3232
add_executable(${example_name} ${example_src})
3333
add_default_flags(${example_name} LEAN)
3434
target_link_libraries(${example_name} PRIVATE utility depthai::opencv ${OpenCV_LIBS} Threads::Threads)
35+
# Set compiler features (c++14), and disables extensions (g++14)
36+
set_property(TARGET ${example_name} PROPERTY CXX_STANDARD 14)
37+
set_property(TARGET ${example_name} PROPERTY CXX_STANDARD_REQUIRED ON)
38+
set_property(TARGET ${example_name} PROPERTY CXX_EXTENSIONS OFF)
3539

3640
# Add sanitizers for example
3741
if(COMMAND add_sanitizers)
@@ -359,3 +363,6 @@ dai_add_example(apriltag_rgb AprilTag/apriltag_rgb.cpp ON)
359363
# DetectionParser
360364
dai_add_example(detection_parser NeuralNetwork/detection_parser.cpp ON)
361365
target_compile_definitions(detection_parser PRIVATE BLOB_PATH="${mobilenet_blob}")
366+
367+
# DetectionParser
368+
dai_add_example(crash_report CrashReport/crash_report.cpp OFF)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#include <fstream>
2+
#include <iostream>
3+
4+
// Includes common necessary includes for development using depthai library
5+
#include "depthai/depthai.hpp"
6+
7+
static bool fileExists(dai::Path path) {
8+
std::ifstream file(path);
9+
return file.is_open();
10+
}
11+
12+
int main() {
13+
using namespace std;
14+
15+
// Connect to device and start pipeline
16+
dai::Device device;
17+
if(device.hasCrashDump()) {
18+
auto crashDump = device.getCrashDump();
19+
std::string commitHash = crashDump.depthaiCommitHash;
20+
std::string deviceId = crashDump.deviceId;
21+
22+
auto json = crashDump.serializeToJson();
23+
24+
for(int i = 0;; i++) {
25+
dai::Path destPath = "crashDump_" + to_string(i) + "_" + deviceId + "_" + commitHash + ".json";
26+
if(fileExists(destPath)) continue;
27+
28+
std::ofstream ob(destPath);
29+
ob << std::setw(4) << json << std::endl;
30+
31+
std::cout << "Crash dump found on your device!" << std::endl;
32+
std::cout << "Saved to " << destPath.string() << std::endl;
33+
std::cout << "Please report to developers!" << std::endl;
34+
break;
35+
}
36+
} else {
37+
std::cout << "There was no crash dump found on your device!" << std::endl;
38+
}
39+
40+
return 0;
41+
}

examples/FeatureTracker/feature_tracker.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,7 @@ class FeatureTrackerDrawer {
7272
}
7373
}
7474

75-
FeatureTrackerDrawer(std::string trackbarName, std::string windowName) {
76-
this->trackbarName = trackbarName;
77-
this->windowName = windowName;
75+
FeatureTrackerDrawer(std::string trackbarName, std::string windowName) : trackbarName(trackbarName), windowName(windowName) {
7876
cv::namedWindow(windowName.c_str());
7977
cv::createTrackbar(trackbarName.c_str(), windowName.c_str(), &trackedFeaturesPathLength, maxTrackedFeaturesPathLength, nullptr);
8078
}

examples/IMU/imu_firmware_update.cpp

Lines changed: 24 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ int main() {
1111
using namespace std;
1212
using namespace std::chrono;
1313

14+
dai::Device device;
15+
16+
auto imuType = device.getConnectedIMU();
17+
auto imuFirmwareVersion = device.getIMUFirmwareVersion();
18+
auto embeddedIMUFirmwareVersion = device.getEmbeddedIMUFirmwareVersion();
19+
std::cout << "IMU type: " << imuType << " firmware version: " << imuFirmwareVersion
20+
<< " embedded firmware version: " << embeddedIMUFirmwareVersion << std::endl;
21+
1422
std::cout << "Warning! Flashing IMU firmware can potentially soft brick your device and should be done with caution." << std::endl;
1523
std::cout << "Do not unplug your device while the IMU firmware is flashing." << std::endl;
1624
std::cout << "Type 'y' and press enter to proceed, otherwise exits: ";
@@ -20,68 +28,26 @@ int main() {
2028
return -1;
2129
}
2230

23-
// Create pipeline
24-
dai::Pipeline pipeline;
25-
26-
// Define sources and outputs
27-
auto imu = pipeline.create<dai::node::IMU>();
28-
auto xlinkOut = pipeline.create<dai::node::XLinkOut>();
29-
30-
xlinkOut->setStreamName("imu");
31-
32-
// enable ACCELEROMETER_RAW at 500 hz rate
33-
imu->enableIMUSensor(dai::IMUSensor::ACCELEROMETER_RAW, 500);
34-
// enable GYROSCOPE_RAW at 400 hz rate
35-
imu->enableIMUSensor(dai::IMUSensor::GYROSCOPE_RAW, 400);
36-
// it's recommended to set both setBatchReportThreshold and setMaxBatchReports to 20 when integrating in a pipeline with a lot of input/output connections
37-
// above this threshold packets will be sent in batch of X, if the host is not blocked and USB bandwidth is available
38-
imu->setBatchReportThreshold(1);
39-
// maximum number of IMU packets in a batch, if it's reached device will block sending until host can receive it
40-
// if lower or equal to batchReportThreshold then the sending is always blocking on device
41-
// useful to reduce device's CPU load and number of lost packets, if CPU load is high on device side due to multiple nodes
42-
imu->setMaxBatchReports(10);
43-
44-
// Link plugins IMU -> XLINK
45-
imu->out.link(xlinkOut->input);
46-
47-
imu->enableFirmwareUpdate(true);
48-
49-
// Pipeline is defined, now we can connect to the device
50-
dai::Device d(pipeline);
51-
52-
bool firstTs = false;
53-
54-
auto imuQueue = d.getOutputQueue("imu", 50, false);
55-
auto baseTs = std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration>();
31+
auto started = device.startIMUFirmwareUpdate();
32+
if(!started) {
33+
std::cout << "Couldn't start IMU firmware update" << std::endl;
34+
return 1;
35+
}
5636

5737
while(true) {
58-
auto imuData = imuQueue->get<dai::IMUData>();
59-
60-
auto imuPackets = imuData->packets;
61-
for(auto& imuPacket : imuPackets) {
62-
auto& acceleroValues = imuPacket.acceleroMeter;
63-
auto& gyroValues = imuPacket.gyroscope;
64-
65-
auto acceleroTs1 = acceleroValues.getTimestampDevice();
66-
auto gyroTs1 = gyroValues.getTimestampDevice();
67-
if(!firstTs) {
68-
baseTs = std::min(acceleroTs1, gyroTs1);
69-
firstTs = true;
38+
bool fwUpdateFinished;
39+
float percentage;
40+
std::tie(fwUpdateFinished, percentage) = device.getIMUFirmwareUpdateStatus();
41+
std::cout << "IMU FW update status: " << std::setprecision(1) << percentage << std::endl;
42+
if(fwUpdateFinished) {
43+
if(percentage == 100) {
44+
std::cout << "Firmware update successful!" << std::endl;
45+
} else {
46+
std::cout << "Firmware update failed!" << std::endl;
7047
}
71-
72-
auto acceleroTs = acceleroTs1 - baseTs;
73-
auto gyroTs = gyroTs1 - baseTs;
74-
75-
printf("Accelerometer timestamp: %ld ms\n", static_cast<long>(duration_cast<milliseconds>(acceleroTs).count()));
76-
printf("Accelerometer [m/s^2]: x: %.3f y: %.3f z: %.3f \n", acceleroValues.x, acceleroValues.y, acceleroValues.z);
77-
printf("Gyroscope timestamp: %ld ms\n", static_cast<long>(duration_cast<milliseconds>(gyroTs).count()));
78-
printf("Gyroscope [rad/s]: x: %.3f y: %.3f z: %.3f \n", gyroValues.x, gyroValues.y, gyroValues.z);
79-
}
80-
81-
int key = cv::waitKey(1);
82-
if(key == 'q') {
83-
return 0;
48+
break;
8449
}
50+
std::this_thread::sleep_for(1s);
8551
}
8652

8753
return 0;

examples/SpatialDetection/spatial_location_calculator.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ int main() {
4949
dai::SpatialLocationCalculatorConfigData config;
5050
config.depthThresholds.lowerThreshold = 100;
5151
config.depthThresholds.upperThreshold = 10000;
52+
auto calculationAlgorithm = dai::SpatialLocationCalculatorAlgorithm::MEDIAN;
53+
config.calculationAlgorithm = calculationAlgorithm;
5254
config.roi = dai::Rect(topLeft, bottomRight);
5355

5456
spatialDataCalculator->inputConfig.setWaitForMessage(false);
@@ -144,12 +146,38 @@ int main() {
144146
newConfig = true;
145147
}
146148
break;
149+
case '1':
150+
calculationAlgorithm = dai::SpatialLocationCalculatorAlgorithm::MEAN;
151+
newConfig = true;
152+
std::cout << "Switching calculation algorithm to MEAN!" << std::endl;
153+
break;
154+
case '2':
155+
calculationAlgorithm = dai::SpatialLocationCalculatorAlgorithm::MIN;
156+
newConfig = true;
157+
std::cout << "Switching calculation algorithm to MIN!" << std::endl;
158+
break;
159+
case '3':
160+
calculationAlgorithm = dai::SpatialLocationCalculatorAlgorithm::MAX;
161+
newConfig = true;
162+
std::cout << "Switching calculation algorithm to MAX!" << std::endl;
163+
break;
164+
case '4':
165+
calculationAlgorithm = dai::SpatialLocationCalculatorAlgorithm::MODE;
166+
newConfig = true;
167+
std::cout << "Switching calculation algorithm to MODE!" << std::endl;
168+
break;
169+
case '5':
170+
calculationAlgorithm = dai::SpatialLocationCalculatorAlgorithm::MEDIAN;
171+
newConfig = true;
172+
std::cout << "Switching calculation algorithm to MEDIAN!" << std::endl;
173+
break;
147174
default:
148175
break;
149176
}
150177

151178
if(newConfig) {
152179
config.roi = dai::Rect(topLeft, bottomRight);
180+
config.calculationAlgorithm = calculationAlgorithm;
153181
dai::SpatialLocationCalculatorConfig cfg;
154182
cfg.addROI(config);
155183
spatialCalcConfigInQueue->send(cfg);

0 commit comments

Comments
 (0)