fix(api): get_imu_correspondence

This commit is contained in:
TinyOh 2019-03-13 15:03:02 +08:00
parent f4007aa78c
commit ecb8cd640a

View File

@ -55,10 +55,7 @@ int main(int argc, char *argv[]) {
auto &&left_data = api->GetStreamData(Stream::LEFT); auto &&left_data = api->GetStreamData(Stream::LEFT);
auto &&right_data = api->GetStreamData(Stream::RIGHT); auto &&right_data = api->GetStreamData(Stream::RIGHT);
if (left_data.frame.empty() || right_data.frame.empty()) { if (!left_data.frame.empty() || !right_data.frame.empty()) {
continue;
}
auto img_stamp = left_data.img->timestamp; auto img_stamp = left_data.img->timestamp;
LOG(INFO) << "Img timestamp: " << img_stamp LOG(INFO) << "Img timestamp: " << img_stamp
<< ", diff_prev=" << (img_stamp - prev_img_stamp); << ", diff_prev=" << (img_stamp - prev_img_stamp);
@ -69,6 +66,9 @@ int main(int argc, char *argv[]) {
auto &&motion_datas = api->GetMotionDatas(); auto &&motion_datas = api->GetMotionDatas();
LOG(INFO) << "Imu count: " << motion_datas.size(); LOG(INFO) << "Imu count: " << motion_datas.size();
if (motion_datas.size() == 0) {
continue;
}
for (size_t i = 0, n = motion_datas.size() - 1; i <= n; ++i) { for (size_t i = 0, n = motion_datas.size() - 1; i <= n; ++i) {
auto data = motion_datas[i]; auto data = motion_datas[i];
auto imu_flag = data.imu->flag; auto imu_flag = data.imu->flag;
@ -125,6 +125,7 @@ int main(int argc, char *argv[]) {
*/ */
cv::imshow("frame", img); cv::imshow("frame", img);
}
char key = static_cast<char>(cv::waitKey(1)); char key = static_cast<char>(cv::waitKey(1));
if (key == 27 || key == 'q' || key == 'Q') { // ESC/Q if (key == 27 || key == 'q' || key == 'Q') { // ESC/Q