diff --git a/cmake/Depthai/DepthaiDeviceSideConfig.cmake b/cmake/Depthai/DepthaiDeviceSideConfig.cmake index 6263ef2d1..25a741544 100644 --- a/cmake/Depthai/DepthaiDeviceSideConfig.cmake +++ b/cmake/Depthai/DepthaiDeviceSideConfig.cmake @@ -2,7 +2,7 @@ set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot") # "full commit hash of device side binary" -set(DEPTHAI_DEVICE_SIDE_COMMIT "549315be3f2e2af09e6301c5b131b77ceedb0391") +set(DEPTHAI_DEVICE_SIDE_COMMIT "afcf303d4bee6a0e313fc763ecb390fcf1a4886e") # "version if applicable" set(DEPTHAI_DEVICE_SIDE_VERSION "") diff --git a/cmake/Hunter/config.cmake b/cmake/Hunter/config.cmake index 80b026f93..9503ea228 100644 --- a/cmake/Hunter/config.cmake +++ b/cmake/Hunter/config.cmake @@ -8,8 +8,8 @@ hunter_config( hunter_config( XLink VERSION "luxonis-2021.4.2-xlink-linkid-race-fix" - URL "https://github.com/luxonis/XLink/archive/6bf33bb51100f6a5aa159d025159fa22eb4f15b7.tar.gz" - SHA1 "e54effec01d0fa7403fcc34ebebf784370256a29" + URL "https://github.com/luxonis/XLink/archive/14d4056d9d9dc21de2c6089a4648ddb9e981f418.tar.gz" + SHA1 "14613474368971d67c520f6f911cf88fb6384506" CMAKE_ARGS XLINK_ENABLE_LIBUSB=${DEPTHAI_ENABLE_LIBUSB} ) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index cc0c22fcc..606ab29ff 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -374,3 +374,4 @@ dai_add_example(crash_report CrashReport/crash_report.cpp OFF) 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) diff --git a/examples/Sync/imu_video_synced.cpp b/examples/Sync/imu_video_synced.cpp new file mode 100644 index 000000000..9a12f96cb --- /dev/null +++ b/examples/Sync/imu_video_synced.cpp @@ -0,0 +1,74 @@ +#include +#include + +#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(); + auto imu = pipeline.create(); + auto sync = pipeline.create(); + auto xoutGroup = pipeline.create(); + + 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(); + auto imuData = groupMessage->get("imu"); + auto colorData = groupMessage->get("video"); + auto timeDifference = imuData->getTimestampDevice() - colorData->getTimestampDevice(); + auto timeDifferenceUs = std::chrono::duration_cast(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; +} diff --git a/shared/depthai-shared b/shared/depthai-shared index 84db0c02f..a73b58b5d 160000 --- a/shared/depthai-shared +++ b/shared/depthai-shared @@ -1 +1 @@ -Subproject commit 84db0c02f562ac38007616a2f416cf97be8b7939 +Subproject commit a73b58b5d0c7798633309d3b0ce4d40c096014ca