2 #include <opencv2/opencv.hpp>
11 std::cout <<
"IMU type: " << imuType <<
", firmware version: " << imuFirmwareVersion << std::endl;
13 if(imuType !=
"BNO086") {
14 std::cout <<
"Rotation vector output is supported only by BNO086!" << std::endl;
25 xoutGroup->setStreamName(
"xout");
27 colorCamera->setCamera(
"color");
30 imu->setBatchReportThreshold(1);
31 imu->setMaxBatchReports(10);
33 sync->setSyncThreshold(std::chrono::milliseconds(10));
34 sync->setSyncAttempts(-1);
36 colorCamera->video.link(sync->inputs[
"video"]);
37 imu->out.link(sync->inputs[
"imu"]);
39 sync->
out.link(xoutGroup->input);
50 auto timeDifferenceUs = std::chrono::duration_cast<std::chrono::microseconds>(timeDifference).count();
52 std::cout <<
"Time difference between messages is: " << std::abs(timeDifferenceUs / 1000.0) <<
" ms" << std::endl;
54 for(
auto& packet : imuData->packets) {
55 auto& rv = packet.rotationVector;
58 "Quaternion: i: %.3f j: %.3f k: %.3f real: %.3f\n"
59 "Accuracy (rad): %.3f \n",
64 rv.rotationVectorAccuracy);
67 cv::imshow(
"Color", colorData->getCvFrame());
68 if(cv::waitKey(1) ==
'q') {