Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v2.24.0 #940

Merged
merged 152 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
0b8c5d3
FW: support for IMX283, at almost full resolution: 5312x3692, FPS max…
alex-luxonis Apr 6, 2023
0eca08e
Update FW: IMX283 exposure and ISO setting fixed,
alex-luxonis Apr 17, 2023
6a26332
Merge 'develop' into imx283. Update FW with IMX462 support
alex-luxonis May 21, 2023
440d7b1
Added host side EncodedFrame with parsing and output handling
asahtik Aug 24, 2023
a63cf88
Bugfixes
asahtik Aug 25, 2023
3aa5d54
getConnectivity feature
AnielAlexa Sep 6, 2023
6d43342
add corespoding SHA
AnielAlexa Sep 7, 2023
19e2cbe
Merge branch 'develop' of github.com:luxonis/depthai-core into video_…
asahtik Sep 8, 2023
8fd2365
Moved timestamps to buffer
asahtik Sep 8, 2023
32e3200
Merge develop
asahtik Sep 19, 2023
60c0b29
EncFrm fixes
asahtik Sep 19, 2023
fd35a88
Added tests, bugfixes
asahtik Sep 20, 2023
acb82a5
clangformat
asahtik Sep 21, 2023
f4e89f5
Bump device
asahtik Sep 21, 2023
4a9ee8d
Bump device again
asahtik Sep 21, 2023
c9fb1d7
Implemented metadata serialization
asahtik Oct 5, 2023
1c406a9
Merge resolution
asahtik Oct 6, 2023
88d1c6b
Implemented raw data serialization in MG
asahtik Oct 9, 2023
810647e
Merge branch 'develop' of github.com:luxonis/depthai-core into messag…
asahtik Oct 9, 2023
f59efaa
FW: OAK-D-SR-PoE R1 fixes for fsync detect and status LED (green when…
alex-luxonis Oct 9, 2023
16b4d98
Merge resolution
asahtik Oct 10, 2023
4338f13
Added fields to EncodedFrame
asahtik Oct 10, 2023
797638a
Bump shared
asahtik Oct 11, 2023
b5150b1
Implemented sync node
asahtik Oct 18, 2023
5858091
CameraControl: add `setControlMode`, `setCaptureIntent`
alex-luxonis Jul 29, 2022
49a7c34
Fixed msggrp serialization
asahtik Oct 27, 2023
8a37a5a
Bump shared
asahtik Oct 27, 2023
48d3669
Merge 'origin/develop' into imx283
alex-luxonis Oct 27, 2023
0a66ca7
Simplified msggrp
asahtik Oct 28, 2023
d519eed
Moved frame type extraction into a getter
asahtik Oct 28, 2023
09abc65
Merge resolution
asahtik Oct 30, 2023
d1a1d3b
Bump shared
asahtik Oct 30, 2023
d22bbb5
Fixed python bindings
asahtik Oct 30, 2023
92950cc
Bump shared
asahtik Oct 30, 2023
ecfec82
FW: multiple tunings to fix image quality issues, OV9782 tuning, IMX4…
alex-luxonis Oct 31, 2023
faa86ae
Merge 'origin/imx283' into develop
alex-luxonis Oct 31, 2023
b65c24d
Implemented messagedemux
asahtik Nov 2, 2023
5c668f3
Added doc comments
asahtik Nov 2, 2023
ac76211
Merge branch 'develop' of github.com:luxonis/depthai-core into messag…
asahtik Nov 2, 2023
2142130
Bump shared
asahtik Nov 2, 2023
fc308cf
Bump firmware
asahtik Nov 2, 2023
34ffec9
Merge branch 'develop' of github.com:luxonis/depthai-core into video_…
asahtik Nov 3, 2023
79c1d67
Bump shared
asahtik Nov 3, 2023
af9de8c
Bump device
asahtik Nov 3, 2023
06672b7
Bump device
asahtik Nov 3, 2023
b910590
clangformat
asahtik Nov 3, 2023
a2f4092
Merge branch 'video_encoder_frame' of github.com:luxonis/depthai-core…
asahtik Nov 3, 2023
a730a33
Some changes WRT Android build
themarpe Nov 3, 2023
a8c2c0e
Removed unnecessary functions
asahtik Nov 3, 2023
7be4ef8
Redid messageGroups
asahtik Nov 4, 2023
0abf5fd
Fix multi stereo node race condition when depth output is enabled
SzabolcsGergely Nov 4, 2023
4a71169
Ir brightness control based on normalized intensity, instead of current.
zrezke Nov 6, 2023
2319297
Changed dynamic to static cast
asahtik Nov 6, 2023
0ebded2
Added option to only demux successful syncs
asahtik Nov 6, 2023
5709112
Added ability to set success on msggrp
asahtik Nov 6, 2023
a1e6bf1
Clangformat
asahtik Nov 6, 2023
ab88129
Added IR intensity API
zrezke Nov 6, 2023
04e09ab
Merge branch 'develop' of github.com:luxonis/depthai-core into getCon…
asahtik Nov 7, 2023
437cc34
Merge branch 'develop' of github.com:luxonis/depthai-core into video_…
asahtik Nov 7, 2023
3d85f9f
Applied suggestions
asahtik Nov 7, 2023
15e5fda
Merge pull request #905 from luxonis/video_encoder_frame
asahtik Nov 7, 2023
3433a5a
Fix XLink linkId reuse, caused multi-threading failures. See:
alex-luxonis Nov 7, 2023
9e94ce8
Merge branch 'develop' of github.com:luxonis/depthai-core into getCon…
asahtik Nov 8, 2023
7042f21
Bump device
asahtik Nov 8, 2023
4b943ea
Merge branch 'develop' of github.com:luxonis/depthai-core into messag…
asahtik Nov 8, 2023
3844391
Implemented automatic crash dump retrieval
asahtik Nov 8, 2023
3ec8837
Fixed auto crash report for PoE
asahtik Nov 8, 2023
3283165
Bump device
asahtik Nov 8, 2023
6e8e67d
Fix warning
asahtik Nov 8, 2023
63d296a
Improved Monitor&WD handling in DeviceBootloader
themarpe Nov 9, 2023
268b6b8
Renamed getConnectivity
asahtik Nov 10, 2023
e4943f2
Update docstring. Point to correct device side commit.
zrezke Nov 10, 2023
7fa88bc
Merge branch 'develop' of github.com:luxonis/depthai-core into ir-int…
zrezke Nov 10, 2023
8b2df03
Renamed getAvailableInterfaces
asahtik Nov 13, 2023
6d71e82
Use a new devicebase to connect to device
asahtik Nov 13, 2023
57f3946
Clangformat
asahtik Nov 13, 2023
444a1c0
Deprecated ir brightness api, fixed spatial_calculator_multi_roi exam…
zrezke Nov 13, 2023
b0a37dc
Attempt to fix macos pipeline build
asahtik Nov 13, 2023
94c2acf
Bump shared
asahtik Nov 13, 2023
725a57a
Added tests for encframe
asahtik Nov 13, 2023
57e4c10
Changed the way sync works + added test
asahtik Nov 14, 2023
060e8d0
Add CameraControl `setAutoExposureLimit`. FW: improve OV9282/OV9782 i…
alex-luxonis Nov 15, 2023
daba851
Changed the way sync is configured
asahtik Nov 15, 2023
bb8ebd4
Clangformat
asahtik Nov 15, 2023
190fdc0
Added examples + bump fw
asahtik Nov 15, 2023
94f2085
Added example, removed numPools from Sync
asahtik Nov 17, 2023
8a5175b
Minor modification to example
asahtik Nov 17, 2023
f91a1bd
Bump fw
asahtik Nov 17, 2023
f975127
Bump fw
asahtik Nov 20, 2023
63529fc
Bump fw
asahtik Nov 20, 2023
feeb2ee
Throw error when indexing non-existing message, changed example to us…
asahtik Nov 20, 2023
2928de7
Improved example
asahtik Nov 20, 2023
5bd2e4c
Clangformat
asahtik Nov 20, 2023
f37c023
Bump fw
asahtik Nov 20, 2023
22e513e
Bump fw
asahtik Nov 20, 2023
ebda6a2
Merge pull request #920 from luxonis/getConnectivity_rpc
asahtik Nov 20, 2023
a27df06
Bump shared
asahtik Nov 20, 2023
3f50eaf
Merge branch 'develop' of github.com:luxonis/depthai-core into messag…
asahtik Nov 20, 2023
e4bbd6e
Changed syncThreshold setter to use chrono duration
asahtik Nov 20, 2023
af2ec17
Bump shared
asahtik Nov 22, 2023
eb1f606
Bump fw
asahtik Nov 23, 2023
7a6ca8f
Handle shutdown returning false, bump fw
asahtik Nov 23, 2023
e325fed
Merge branch 'develop' of github.com:luxonis/depthai-core into auto_c…
asahtik Nov 23, 2023
befbb21
Bump fw
asahtik Nov 23, 2023
eccd0f4
Changed the way crash reports are retrieved
asahtik Nov 23, 2023
a9a0b31
Bump fw
asahtik Nov 23, 2023
119e3a5
Clangformat
asahtik Nov 23, 2023
16ebb17
Bump fw
asahtik Nov 23, 2023
0c480a1
Bump fw
asahtik Nov 23, 2023
6a10051
IR Intensity API (#924)
zrezke Nov 23, 2023
2928a70
Merge 'origin/develop' into ae_exp_limit. FW: fix large exposure limi…
alex-luxonis Nov 24, 2023
7b6f022
Merge pull request #926 from luxonis/ae_exp_limit
alex-luxonis Nov 24, 2023
3260c38
Merge pull request #919 from luxonis/xlink_linkid_race_fix
alex-luxonis Nov 24, 2023
98360b5
Merge branch 'develop' of github.com:luxonis/depthai-core into messag…
asahtik Nov 24, 2023
fad0a31
Rename connectivity enum
asahtik Nov 24, 2023
bc067fa
Update README
asahtik Nov 24, 2023
eaeab62
Merge branch 'develop' of github.com:luxonis/depthai-core into auto_c…
asahtik Nov 27, 2023
5229636
Minor encframe test fixes
asahtik Nov 27, 2023
74384c5
Bump fw
asahtik Nov 27, 2023
9430753
Added DEPTHAI_CRASHDUMP_TIMEOUT to determine crashdump timeout
asahtik Nov 29, 2023
a5b6cbb
TODO fix windows test
asahtik Nov 29, 2023
e38023c
Merge pull request #917 from luxonis/message_groups
asahtik Nov 29, 2023
9ac7da3
Merge branch 'develop' of github.com:luxonis/depthai-core into auto_c…
asahtik Nov 29, 2023
6684f14
Changed crashdump timing
asahtik Nov 29, 2023
886baf9
Bump shared
asahtik Nov 29, 2023
29de45d
Clangformat
asahtik Nov 29, 2023
1826431
Fix readme
asahtik Nov 29, 2023
73141f4
Merge pull request #921 from luxonis/auto_crash_report
asahtik Nov 29, 2023
8d45d32
Bump fw
asahtik Nov 30, 2023
e6bf28a
Merge pull request #932 from luxonis/dmaMemcpy_fix
moratom Nov 30, 2023
a85f3da
Bump shared
asahtik Dec 5, 2023
ab3df62
Bump fw and XLink
asahtik Dec 5, 2023
38681bb
Merge pull request #933 from luxonis/profilingdata_fix
asahtik Dec 5, 2023
419cfd2
Bump fw
asahtik Dec 5, 2023
f9b09eb
Add an example with IMU
Dec 7, 2023
ef06fd6
Add new line at the end of the example
Dec 7, 2023
d60e203
[RVC2 FW] Update FW with updated shared
Dec 7, 2023
c9d5783
added docstring for fisheye
saching13 Dec 7, 2023
c496463
Check for crash dump before getting
asahtik Dec 7, 2023
ec0c720
Update FW with a stability fix for timesync
Dec 7, 2023
7a5dedd
Merge pull request #937 from luxonis/crash_report_fix
moratom Dec 7, 2023
b40465e
Merge pull request #936 from luxonis/distortio-docstring
moratom Dec 7, 2023
00a5c5c
Merge remote-tracking branch 'origin/develop' into xlinkin_timestamps
Dec 7, 2023
e8e0048
Merge branch 'develop' of github.com:luxonis/depthai-core into bl_loc…
asahtik Dec 8, 2023
a8a4702
Merge branch 'xlinkin_timestamps' of github.com:luxonis/depthai-core …
asahtik Dec 8, 2023
5ca1e14
Revert the XLink profiling to uint64_t change
Dec 11, 2023
c9fd406
Update FW and shared to develop
Dec 11, 2023
0cae1b0
Merge pull request #934 from luxonis/xlinkin_timestamps
moratom Dec 11, 2023
a25a3dc
Fix the xlink profiling
Dec 11, 2023
cf7e7e0
Merge branch 'profilingdata_fix' into bl_lock_bugix_devel
Dec 11, 2023
7930da4
Merge pull request #922 from luxonis/device_bl_init_lock_bugfix
moratom Dec 11, 2023
fc39d13
Bump version to 2.24.0
themarpe Dec 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if(WIN32)
endif()

# Create depthai project
project(depthai VERSION "2.23.0" LANGUAGES CXX C)
project(depthai VERSION "2.24.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 @@ -208,8 +208,10 @@ add_library(${TARGET_CORE_NAME}
src/pipeline/node/ColorCamera.cpp
src/pipeline/node/Camera.cpp
src/pipeline/node/ToF.cpp
src/pipeline/node/MessageDemux.cpp
src/pipeline/node/MonoCamera.cpp
src/pipeline/node/StereoDepth.cpp
src/pipeline/node/Sync.cpp
src/pipeline/node/NeuralNetwork.cpp
src/pipeline/node/ImageManip.cpp
src/pipeline/node/Warp.cpp
Expand All @@ -229,6 +231,7 @@ add_library(${TARGET_CORE_NAME}
src/pipeline/node/UVC.cpp
src/pipeline/datatype/Buffer.cpp
src/pipeline/datatype/ImgFrame.cpp
src/pipeline/datatype/EncodedFrame.cpp
src/pipeline/datatype/ImageManipConfig.cpp
src/pipeline/datatype/CameraControl.cpp
src/pipeline/datatype/NNData.cpp
Expand All @@ -247,6 +250,8 @@ add_library(${TARGET_CORE_NAME}
src/pipeline/datatype/TrackedFeatures.cpp
src/pipeline/datatype/FeatureTrackerConfig.cpp
src/pipeline/datatype/ToFConfig.cpp
src/pipeline/datatype/MessageGroup.cpp
src/utility/H26xParsers.cpp
src/utility/Initialization.cpp
src/utility/Resources.cpp
src/utility/Path.cpp
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ The following environment variables can be set to alter default behavior of the
| 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 |
| 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. |

## 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 "39a9d271a9ed0172f6481877723fca96d41b54c6")
set(DEPTHAI_DEVICE_SIDE_COMMIT "a95f582a61ec9bdbd0f72dec84822455872ffaf7")

# "version if applicable"
set(DEPTHAI_DEVICE_SIDE_VERSION "")
12 changes: 6 additions & 6 deletions cmake/Hunter/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ hunter_config(

hunter_config(
XLink
VERSION "luxonis-2021.4.2-develop"
URL "https://github.com/luxonis/XLink/archive/c940feaf9321f06a7d9660f28e686a9718135f38.tar.gz"
SHA1 "52935b6ceb470ee632de3348b9d2aaa2c6c24ac0"
VERSION "luxonis-2021.4.2-xlink-linkid-race-fix"
URL "https://github.com/luxonis/XLink/archive/e9eb1ef38030176ad70cddd3b545d5e6c509f1e1.tar.gz"
SHA1 "b1e4ded41cd7b9c37189468e2aaddbb10cbda9f6"
CMAKE_ARGS
XLINK_ENABLE_LIBUSB=${DEPTHAI_ENABLE_LIBUSB}
)
Expand Down Expand Up @@ -101,9 +101,9 @@ hunter_config(
# Specific Catch2 version
hunter_config(
Catch2
VERSION "2.13.7"
URL "https://github.com/catchorg/Catch2/archive/refs/tags/v3.2.1.tar.gz"
SHA1 "acfba7f71cbbbbf60bc1bc4c0e3efca4a9c70df7"
VERSION "3.4.0"
URL "https://github.com/catchorg/Catch2/archive/refs/tags/v3.4.0.tar.gz"
SHA1 "4c308576c856a43dc88949a8f64ef90ebf94ae1b"
)

# ZLib - Luxonis fix for alias on imported target for old CMake versions
Expand Down
6 changes: 6 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,9 @@ target_compile_definitions(detection_parser PRIVATE BLOB_PATH="${mobilenet_blob}

# DetectionParser
dai_add_example(crash_report CrashReport/crash_report.cpp OFF)

# Sync
dai_add_example(sync_scripts Sync/sync_scripts.cpp ON)
dai_add_example(demux_message_group Sync/demux_message_group.cpp ON)
dai_add_example(depth_video_synced Sync/depth_video_synced.cpp ON)
dai_add_example(imu_video_synced Sync/imu_video_synced.cpp ON)
4 changes: 2 additions & 2 deletions examples/SpatialDetection/spatial_calculator_multi_roi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main() {

// Connect to device and start pipeline
dai::Device device(pipeline);
device.setIrLaserDotProjectorBrightness(1000);
device.setIrLaserDotProjectorIntensity(0.7f);

// Output queue will be used to get the depth frames from the outputs defined above
auto depthQueue = device.getOutputQueue("depth", 4, false);
Expand Down Expand Up @@ -106,4 +106,4 @@ int main() {
}
}
return 0;
}
}
63 changes: 63 additions & 0 deletions examples/Sync/demux_message_group.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#include <chrono>
#include <iostream>

#include "depthai/depthai.hpp"

int main() {
dai::Pipeline pipeline;

auto script1 = pipeline.create<dai::node::Script>();
script1->setScript(
R"SCRPT(
from time import sleep

while True:
sleep(1)
b = Buffer(512)
b.setData(bytes(4 * [i for i in range(0, 128)]))
b.setTimestamp(Clock.now())
node.io['out'].send(b)
)SCRPT");

auto script2 = pipeline.create<dai::node::Script>();
script2->setScript(
R"SCRPT(
from time import sleep

while True:
sleep(0.3)
b = Buffer(512)
b.setData(bytes(4 * [i for i in range(128, 256)]))
b.setTimestamp(Clock.now())
node.io['out'].send(b)
)SCRPT");

auto sync = pipeline.create<dai::node::Sync>();
sync->setSyncThreshold(std::chrono::milliseconds(100));

auto demux = pipeline.create<dai::node::MessageDemux>();

auto xout1 = pipeline.create<dai::node::XLinkOut>();
xout1->setStreamName("xout1");
auto xout2 = pipeline.create<dai::node::XLinkOut>();
xout2->setStreamName("xout2");

script1->outputs["out"].link(sync->inputs["s1"]);
script2->outputs["out"].link(sync->inputs["s2"]);
sync->out.link(demux->input);
demux->outputs["s1"].link(xout1->input);
demux->outputs["s2"].link(xout2->input);

dai::Device device(pipeline);
std::cout << "Start" << std::endl;
auto queue1 = device.getOutputQueue("xout1", 10, true);
auto queue2 = device.getOutputQueue("xout2", 10, true);
while(true) {
auto bufS1 = queue1->get<dai::Buffer>();
auto bufS2 = queue2->get<dai::Buffer>();
std::cout << "Buffer 1 timestamp: " << bufS1->getTimestamp().time_since_epoch().count() << std::endl;
std::cout << "Buffer 2 timestamp: " << bufS2->getTimestamp().time_since_epoch().count() << std::endl;
std::cout << "----------" << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(200));
}
}
68 changes: 68 additions & 0 deletions examples/Sync/depth_video_synced.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#include <iostream>

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

int main() {
// Create pipeline
dai::Pipeline pipeline;

// Define sources and outputs
auto monoLeft = pipeline.create<dai::node::MonoCamera>();
auto monoRight = pipeline.create<dai::node::MonoCamera>();
auto color = pipeline.create<dai::node::ColorCamera>();
auto stereo = pipeline.create<dai::node::StereoDepth>();
auto sync = pipeline.create<dai::node::Sync>();

auto xoutGrp = pipeline.create<dai::node::XLinkOut>();

// XLinkOut
xoutGrp->setStreamName("xout");

// Properties
monoLeft->setResolution(dai::MonoCameraProperties::SensorResolution::THE_400_P);
monoLeft->setCamera("left");
monoRight->setResolution(dai::MonoCameraProperties::SensorResolution::THE_400_P);
monoRight->setCamera("right");

stereo->setDefaultProfilePreset(dai::node::StereoDepth::PresetMode::HIGH_ACCURACY);

color->setCamera("color");

sync->setSyncThreshold(std::chrono::milliseconds(100));

// Linking
monoLeft->out.link(stereo->left);
monoRight->out.link(stereo->right);

stereo->disparity.link(sync->inputs["disparity"]);
color->video.link(sync->inputs["video"]);

sync->out.link(xoutGrp->input);

// Connect to device and start pipeline
dai::Device device(pipeline);

auto queue = device.getOutputQueue("xout", 10, true);

float disparityMultiplier = 255 / stereo->initialConfig.getMaxDisparity();

while(true) {
auto msgGrp = queue->get<dai::MessageGroup>();
for(auto& frm : *msgGrp) {
auto imgFrm = std::dynamic_pointer_cast<dai::ImgFrame>(frm.second);
cv::Mat img = imgFrm->getCvFrame();
if(frm.first == "disparity") {
img.convertTo(img, CV_8UC1, disparityMultiplier); // Extend disparity range
cv::applyColorMap(img, img, cv::COLORMAP_JET);
}
cv::imshow(frm.first, img);
}

int key = cv::waitKey(1);
if(key == 'q' || key == 'Q') {
return 0;
}
}
return 0;
}
74 changes: 74 additions & 0 deletions examples/Sync/imu_video_synced.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#include <iostream>
#include <opencv2/opencv.hpp>

#include "depthai/depthai.hpp"

int main() {
dai::Device device;

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

if(imuType != "BNO086") {
std::cout << "Rotation vector output is supported only by BNO086!" << std::endl;
return 1;
}

dai::Pipeline pipeline;

auto colorCamera = pipeline.create<dai::node::ColorCamera>();
auto imu = pipeline.create<dai::node::IMU>();
auto sync = pipeline.create<dai::node::Sync>();
auto xoutGroup = pipeline.create<dai::node::XLinkOut>();

xoutGroup->setStreamName("xout");

colorCamera->setCamera("color");

imu->enableIMUSensor(dai::IMUSensor::ROTATION_VECTOR, 120);
imu->setBatchReportThreshold(1);
imu->setMaxBatchReports(10);

sync->setSyncThreshold(std::chrono::milliseconds(10));
sync->setSyncAttempts(-1); // Infinite attempts

colorCamera->video.link(sync->inputs["video"]);
imu->out.link(sync->inputs["imu"]);

sync->out.link(xoutGroup->input);

device.startPipeline(pipeline);

auto groupQueue = device.getOutputQueue("xout", 3, false);

while(true) {
auto groupMessage = groupQueue->get<dai::MessageGroup>();
auto imuData = groupMessage->get<dai::IMUData>("imu");
auto colorData = groupMessage->get<dai::ImgFrame>("video");
auto timeDifference = imuData->getTimestampDevice() - colorData->getTimestampDevice();
auto timeDifferenceUs = std::chrono::duration_cast<std::chrono::microseconds>(timeDifference).count();

std::cout << "Time difference between messages is: " << std::abs(timeDifferenceUs / 1000.0) << " ms" << std::endl;

for(auto& packet : imuData->packets) {
auto& rv = packet.rotationVector;

printf(
"Quaternion: i: %.3f j: %.3f k: %.3f real: %.3f\n"
"Accuracy (rad): %.3f \n",
rv.i,
rv.j,
rv.k,
rv.real,
rv.rotationVectorAccuracy);
}

cv::imshow("Color", colorData->getCvFrame());
if(cv::waitKey(1) == 'q') {
break;
}
}

return 0;
}
56 changes: 56 additions & 0 deletions examples/Sync/sync_scripts.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#include <chrono>
#include <iostream>

#include "depthai/depthai.hpp"

int main() {
dai::Pipeline pipeline;

auto script1 = pipeline.create<dai::node::Script>();
script1->setScript(
R"SCRPT(
from time import sleep

while True:
sleep(1)
b = Buffer(512)
b.setData(bytes(4 * [i for i in range(0, 128)]))
b.setTimestamp(Clock.now())
node.io['out'].send(b)
)SCRPT");

auto script2 = pipeline.create<dai::node::Script>();
script2->setScript(
R"SCRPT(
from time import sleep

while True:
sleep(0.3)
b = Buffer(512)
b.setData(bytes(4 * [i for i in range(128, 256)]))
b.setTimestamp(Clock.now())
node.io['out'].send(b)
)SCRPT");

auto sync = pipeline.create<dai::node::Sync>();
sync->setSyncThreshold(std::chrono::milliseconds(100));

auto xout = pipeline.create<dai::node::XLinkOut>();
xout->setStreamName("xout");

sync->out.link(xout->input);
script1->outputs["out"].link(sync->inputs["s1"]);
script2->outputs["out"].link(sync->inputs["s2"]);

dai::Device device(pipeline);
std::cout << "Start" << std::endl;
auto queue = device.getOutputQueue("xout", 10, true);
while(true) {
auto grp = queue->get<dai::MessageGroup>();
std::cout << "Buffer 1 timestamp: " << grp->get<dai::Buffer>("s1")->getTimestamp().time_since_epoch().count() << std::endl;
std::cout << "Buffer 2 timestamp: " << grp->get<dai::Buffer>("s2")->getTimestamp().time_since_epoch().count() << std::endl;
std::cout << "Time interval between messages: " << static_cast<double>(grp->getIntervalNs()) / 1e6 << "ms" << std::endl;
std::cout << "----------" << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(200));
}
}
5 changes: 4 additions & 1 deletion include/depthai/device/CalibrationHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ class CalibrationHandler {
* Get the Distortion Coefficients object
*
* @param cameraId Uses the cameraId to identify which distortion Coefficients to return.
* @return the distortion coefficients of the requested camera in this order: [k1,k2,p1,p2,k3,k4,k5,k6,s1,s2,s3,s4,τx,τy]
* @return the distortion coefficients of the requested camera in this order: [k1,k2,p1,p2,k3,k4,k5,k6,s1,s2,s3,s4,τx,τy] for CameraModel::Perspective
* or [k1, k2, k3, k4] for CameraModel::Fisheye
* see https://docs.opencv.org/4.5.4/d9/d0c/group__calib3d.html for Perspective model (Rational Polynomial Model)
* see https://docs.opencv.org/4.5.4/db/d58/group__calib3d__fisheye.html for Fisheye model
*/
std::vector<float> getDistortionCoefficients(CameraBoardSocket cameraId) const;

Expand Down
Loading
Loading