-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #919 from luxonis/device_bl_init_lock_bugfix
Improved Monitor&WD handling in DeviceBootloader
- Loading branch information
Showing
2 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
Submodule depthai-core
updated
4 files
+1 −1 | cmake/Depthai/DepthaiDeviceSideConfig.cmake | |
+2 −2 | cmake/Hunter/config.cmake | |
+3 −0 | include/depthai/device/DeviceBootloader.hpp | |
+214 −208 | src/device/DeviceBootloader.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import depthai as dai | ||
import numpy as np | ||
import cv2 | ||
from datetime import timedelta | ||
|
||
device = dai.Device() | ||
|
||
imuType = device.getConnectedIMU() | ||
imuFirmwareVersion = device.getIMUFirmwareVersion() | ||
print(f"IMU type: {imuType}, firmware version: {imuFirmwareVersion}") | ||
|
||
if imuType != "BNO086": | ||
print("Rotation vector output is supported only by BNO086!") | ||
exit(0) | ||
|
||
pipeline = dai.Pipeline() | ||
|
||
color = pipeline.create(dai.node.ColorCamera) | ||
imu = pipeline.create(dai.node.IMU) | ||
sync = pipeline.create(dai.node.Sync) | ||
xoutImu = pipeline.create(dai.node.XLinkOut) | ||
xoutImu.setStreamName("imu") | ||
|
||
xoutGrp = pipeline.create(dai.node.XLinkOut) | ||
xoutGrp.setStreamName("xout") | ||
|
||
color.setCamera("color") | ||
|
||
imu.enableIMUSensor(dai.IMUSensor.ROTATION_VECTOR, 120) | ||
imu.setBatchReportThreshold(1) | ||
imu.setMaxBatchReports(10) | ||
|
||
sync.setSyncThreshold(timedelta(milliseconds=10)) | ||
sync.setSyncAttempts(-1) | ||
|
||
color.video.link(sync.inputs["video"]) | ||
imu.out.link(sync.inputs["imu"]) | ||
|
||
sync.out.link(xoutGrp.input) | ||
|
||
|
||
with device: | ||
device.startPipeline(pipeline) | ||
groupQueue = device.getOutputQueue("xout", 3, True) | ||
while True: | ||
groupMessage = groupQueue.get() | ||
imuMessage = groupMessage["imu"] | ||
colorMessage = groupMessage["video"] | ||
print() | ||
print("Device timestamp imu: " + str(imuMessage.getTimestampDevice())) | ||
print("Device timestamp video:" + str(colorMessage.getTimestampDevice())) | ||
latestRotationVector = imuMessage.packets[-1].rotationVector | ||
imuF = "{:.4f}" | ||
print(f"Quaternion: i: {imuF.format(latestRotationVector.i)} j: {imuF.format(latestRotationVector.j)} " | ||
f"k: {imuF.format(latestRotationVector.k)} real: {imuF.format(latestRotationVector.real)}") | ||
print() | ||
cv2.imshow("video", colorMessage.getCvFrame()) | ||
if cv2.waitKey(1) == ord("q"): | ||
break |