9 Commits
2.3.1 ... 2.3.2

Author SHA1 Message Date
John Zhao
455bfc72b2 chore(readme): update readme 2019-02-28 10:23:19 +08:00
John Zhao
852d8d8faf docs(doxyfile): update version 2019-02-28 09:40:23 +08:00
TinyOh
d09f037aee fix: change cmake version to 2.3.2 2019-02-28 04:16:59 +08:00
TinyOh
b2bd90192d feat(api) sdk/firmware version check 2019-02-28 03:53:50 +08:00
TinyOh
6953758101 Merge branch 'develop' of http://gitlab.mynt.com/mynteye/mynt-eye-sdk-2 into develop 2019-02-27 08:24:31 +08:00
TinyOh
262f64715d feat(api): version check 2019-02-27 08:14:37 +08:00
kalman
b6d4037357 fix(wrapper): fix camera info repeat bug 2019-02-26 14:59:28 +08:00
John Zhao
30ed3ed5e2 build(makefile): ensure uninstall before install 2019-02-25 12:12:19 +08:00
John Zhao
5b5ded25c9 fix(correspondence): also wait stream matched ready 2019-02-25 12:09:48 +08:00
12 changed files with 218 additions and 21 deletions

View File

@@ -14,7 +14,7 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
project(mynteye VERSION 2.3.1 LANGUAGES C CXX) project(mynteye VERSION 2.3.2 LANGUAGES C CXX)
include(cmake/Common.cmake) include(cmake/Common.cmake)
@@ -220,6 +220,7 @@ if(WITH_API)
src/mynteye/api/processor/rectify_processor_ocv.cc src/mynteye/api/processor/rectify_processor_ocv.cc
src/mynteye/api/config.cc src/mynteye/api/config.cc
src/mynteye/api/correspondence.cc src/mynteye/api/correspondence.cc
src/mynteye/api/version_checker.cc
) )
if(WITH_CAM_MODELS) if(WITH_CAM_MODELS)
list(APPEND MYNTEYE_SRCS list(APPEND MYNTEYE_SRCS

View File

@@ -130,7 +130,7 @@ endif
# install # install
install: build install: uninstall build
@$(call echo,Make $@) @$(call echo,Make $@)
ifeq ($(HOST_OS),Win) ifeq ($(HOST_OS),Win)
ifneq ($(HOST_NAME),MinGW) ifneq ($(HOST_NAME),MinGW)

View File

@@ -1,6 +1,6 @@
# MYNT® EYE S SDK # MYNT® EYE S SDK
[![](https://img.shields.io/badge/MYNT%20EYE%20S%20SDK-2.3.1-brightgreen.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK) [![](https://img.shields.io/badge/MYNT%20EYE%20S%20SDK-2.3.2-brightgreen.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK)
## Overview ## Overview
@@ -17,11 +17,11 @@ Please follow the guide doc to install the SDK on different platforms.
## Documentations ## Documentations
* [API Doc](https://github.com/slightech/MYNT-EYE-S-SDK/releases): API reference, some guides and data spec. * [API Doc](https://github.com/slightech/MYNT-EYE-S-SDK/releases): API reference, some guides and data spec.
* en: [![](https://img.shields.io/badge/Download-PDF-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK/files/2893965/mynt-eye-s-sdk-apidoc-2.3.1-en.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK/files/2893979/mynt-eye-s-sdk-apidoc-2.3.1-en.zip) [![](https://img.shields.io/badge/Online-HTML-blue.svg?style=flat)](https://slightech.github.io/MYNT-EYE-S-SDK/) * en: [![](https://img.shields.io/badge/Download-PDF-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK/files/2913110/mynt-eye-s-sdk-apidoc-2.3.2-en.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK/files/2913111/mynt-eye-s-sdk-apidoc-2.3.2-en.zip) [![](https://img.shields.io/badge/Online-HTML-blue.svg?style=flat)](https://slightech.github.io/MYNT-EYE-S-SDK/)
* zh-Hans: [![](https://img.shields.io/badge/Download-PDF-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK/files/2893985/mynt-eye-s-sdk-apidoc-2.3.1-zh-Hans.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK/files/2893986/mynt-eye-s-sdk-apidoc-2.3.1-zh-Hans.zip) [![](https://img.shields.io/badge/Online-HTML-blue.svg?style=flat)](http://doc.myntai.com/resource/api/mynt-eye-s-sdk-apidoc-2.3.1-zh-Hans/mynt-eye-s-sdk-apidoc-2.3.1-zh-Hans/index.html) * zh-Hans: [![](https://img.shields.io/badge/Download-PDF-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK/files/2913112/mynt-eye-s-sdk-apidoc-2.3.2-zh-Hans.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK/files/2913113/mynt-eye-s-sdk-apidoc-2.3.2-zh-Hans.zip) [![](https://img.shields.io/badge/Online-HTML-blue.svg?style=flat)](http://doc.myntai.com/resource/api/mynt-eye-s-sdk-apidoc-2.3.2-zh-Hans/mynt-eye-s-sdk-apidoc-2.3.2-zh-Hans/index.html)
* [Guide Doc](https://github.com/slightech/MYNT-EYE-S-SDK-Guide/releases): How to install and start using the SDK. * [Guide Doc](https://github.com/slightech/MYNT-EYE-S-SDK-Guide/releases): How to install and start using the SDK.
* en: [![](https://img.shields.io/badge/Download-PDF-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK-Guide/files/2893975/mynt-eye-s-sdk-guide-2.3.1-en.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK-Guide/files/2893996/mynt-eye-s-sdk-guide-2.3.1-en.zip) [![](https://img.shields.io/badge/Online-HTML-blue.svg?style=flat)](https://slightech.github.io/MYNT-EYE-S-SDK-Guide/) * en: [![](https://img.shields.io/badge/Download-PDF-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK-Guide/files/2913052/mynt-eye-s-sdk-guide-2.3.2-en.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK-Guide/files/2913053/mynt-eye-s-sdk-guide-2.3.2-en.zip) [![](https://img.shields.io/badge/Online-HTML-blue.svg?style=flat)](https://slightech.github.io/MYNT-EYE-S-SDK-Guide/)
* zh-Hans: [![](https://img.shields.io/badge/Download-PDF-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK-Guide/files/2893997/mynt-eye-s-sdk-guide-2.3.1-zh-Hans.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK-Guide/files/2893997/mynt-eye-s-sdk-guide-2.3.1-zh-Hans.pdf) [![](https://img.shields.io/badge/Online-HTML-blue.svg?style=flat)](http://doc.myntai.com/resource/sdk/mynt-eye-s-sdk-guide-2.3.1-zh-Hans/mynt-eye-s-sdk-guide-2.3.1-zh-Hans/index.html) * zh-Hans: [![](https://img.shields.io/badge/Download-PDF-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK-Guide/files/2913054/mynt-eye-s-sdk-guide-2.3.2-zh-Hans.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK-Guide/files/2913056/mynt-eye-s-sdk-guide-2.3.2-zh-Hans.zip) [![](https://img.shields.io/badge/Online-HTML-blue.svg?style=flat)](http://doc.myntai.com/resource/sdk/mynt-eye-s-sdk-guide-2.3.2-zh-Hans/mynt-eye-s-sdk-guide-2.3.2-zh-Hans/index.html)
> Supported languages: `en`, `zh-Hans`. > Supported languages: `en`, `zh-Hans`.

View File

@@ -38,7 +38,7 @@ PROJECT_NAME = "MYNT EYE S SDK"
# could be handy for archiving the generated documentation or if some version # could be handy for archiving the generated documentation or if some version
# control system is used. # control system is used.
PROJECT_NUMBER = 2.3.1 PROJECT_NUMBER = 2.3.2
# Using the PROJECT_BRIEF tag one can provide an optional one line description # Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a # for a project that appears at the top of each page and should give viewer a

View File

@@ -38,7 +38,7 @@ PROJECT_NAME = "MYNT EYE S SDK"
# could be handy for archiving the generated documentation or if some version # could be handy for archiving the generated documentation or if some version
# control system is used. # control system is used.
PROJECT_NUMBER = 2.3.1 PROJECT_NUMBER = 2.3.2
# Using the PROJECT_BRIEF tag one can provide an optional one line description # Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a # for a project that appears at the top of each page and should give viewer a

View File

@@ -122,6 +122,8 @@ enum class Info : std::uint8_t {
IMU_TYPE, IMU_TYPE,
/** Nominal baseline */ /** Nominal baseline */
NOMINAL_BASELINE, NOMINAL_BASELINE,
/** SDK version*/
SDK_VERSION,
/** Last guard */ /** Last guard */
LAST LAST
}; };

View File

@@ -26,6 +26,7 @@
#include "mynteye/api/dl.h" #include "mynteye/api/dl.h"
#include "mynteye/api/plugin.h" #include "mynteye/api/plugin.h"
#include "mynteye/api/synthetic.h" #include "mynteye/api/synthetic.h"
#include "mynteye/api/version_checker.h"
#include "mynteye/device/device.h" #include "mynteye/device/device.h"
#include "mynteye/device/utils.h" #include "mynteye/device/utils.h"
@@ -222,7 +223,11 @@ API::~API() {
std::shared_ptr<API> API::Create(int argc, char *argv[]) { std::shared_ptr<API> API::Create(int argc, char *argv[]) {
auto &&device = device::select(); auto &&device = device::select();
if (!device) return nullptr; if (!device) return nullptr;
return Create(argc, argv, device); auto api = Create(argc, argv, device);
return api;
// if (api && checkFirmwareVersion(api))
// return api;
// return nullptr;
} }
std::shared_ptr<API> API::Create( std::shared_ptr<API> API::Create(
@@ -261,7 +266,7 @@ std::shared_ptr<API> API::Create(const std::shared_ptr<Device> &device) {
} }
} else { } else {
LOG(ERROR) <<"no device!"; LOG(ERROR) <<"no device!";
api = std::make_shared<API>(device, CalibrationModel::UNKNOW); return nullptr;
} }
return api; return api;
} }
@@ -324,6 +329,20 @@ std::shared_ptr<DeviceInfo> API::GetInfo() const {
} }
std::string API::GetInfo(const Info &info) const { std::string API::GetInfo(const Info &info) const {
if (info == Info::SDK_VERSION) {
std::string info_path =
utils::get_sdk_install_dir();
info_path.append(MYNTEYE_OS_SEP "share" \
MYNTEYE_OS_SEP "mynteye" MYNTEYE_OS_SEP "build.info");
cv::FileStorage fs(info_path, cv::FileStorage::READ);
if (!fs.isOpened()) {
LOG(WARNING) << "build.info not found: " << info_path;
return "null";
}
return fs["MYNTEYE_VERSION"];
}
return device_->GetInfo(info); return device_->GetInfo(info);
} }

View File

@@ -171,9 +171,13 @@ void Correspondence::NotifyStreamDataReady() {
bool Correspondence::IsStreamDataReady() { bool Correspondence::IsStreamDataReady() {
if (stream_datas_.empty()) return false; if (stream_datas_.empty()) return false;
if (stream_match_enabled_) {
if (stream_datas_match_.empty()) return false;
}
if (motion_datas_.empty()) return false; if (motion_datas_.empty()) return false;
std::uint64_t img_stamp = 0; std::uint64_t img_stamp = 0;
std::uint64_t img_macth_stamp = 0;
{ {
std::lock_guard<std::recursive_mutex> _(mtx_stream_datas_); std::lock_guard<std::recursive_mutex> _(mtx_stream_datas_);
auto data = stream_datas_.front(); auto data = stream_datas_.front();
@@ -181,6 +185,10 @@ bool Correspondence::IsStreamDataReady() {
LOG(FATAL) << "stream data image info is empty!"; LOG(FATAL) << "stream data image info is empty!";
} }
img_stamp = data.img->timestamp; img_stamp = data.img->timestamp;
if (stream_match_enabled_) {
img_macth_stamp = stream_datas_match_.front().img->timestamp;
}
} }
std::uint64_t imu_stamp = 0; std::uint64_t imu_stamp = 0;
{ {
@@ -192,7 +200,12 @@ bool Correspondence::IsStreamDataReady() {
imu_stamp = data.imu->timestamp; imu_stamp = data.imu->timestamp;
} }
return img_stamp + stream_interval_us_half_ < imu_stamp; if (stream_match_enabled_) {
return img_stamp + stream_interval_us_half_ < imu_stamp
&& img_macth_stamp + stream_interval_us_half_ < imu_stamp;
} else {
return img_stamp + stream_interval_us_half_ < imu_stamp;
}
} }
std::vector<api::StreamData> Correspondence::GetReadyStreamData(bool matched) { std::vector<api::StreamData> Correspondence::GetReadyStreamData(bool matched) {

View File

@@ -15,6 +15,7 @@
#define MYNTEYE_API_CONFIG_H_ #define MYNTEYE_API_CONFIG_H_
#pragma once #pragma once
#include <atomic>
#include <condition_variable> #include <condition_variable>
#include <memory> #include <memory>
#include <mutex> #include <mutex>
@@ -57,7 +58,7 @@ class Correspondence {
std::shared_ptr<Device> device_; std::shared_ptr<Device> device_;
Stream stream_; Stream stream_;
Stream stream_match_; Stream stream_match_;
bool stream_match_enabled_; std::atomic_bool stream_match_enabled_;
float stream_interval_us_; float stream_interval_us_;
float stream_interval_us_half_; float stream_interval_us_half_;

View File

@@ -0,0 +1,138 @@
// Copyright 2018 Slightech Co., Ltd. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "mynteye/api/version_checker.h"
#include "mynteye/device/utils.h"
#include "mynteye/logger.h"
#include "mynteye/types.h"
MYNTEYE_BEGIN_NAMESPACE
typedef struct {
const std::string device_type;
const std::string sdk_version;
const std::string firmware_version;
const std::string status;
}firmware_version_match_table_unit;
const char* ERRO_DESCRIPTION_F =
"Please update the firmware at first";
const char* ERRO_DESCRIPTION_S =
"Please update the SDK at first";
const char* WARN_DESCRIPTION_F =
"We suggest that you should update the firmware";
const char* WARN_DESCRIPTION_S =
"We suggest that you should update the SDK";
const char* PASS_DESCRIPTION = "pass";
/** firmware/sdk version matched table */
/**----device type-----sdk version---firmware version-----pass tag-----*/
static const firmware_version_match_table_unit FSVM_TABLE[] ={
/** S1030 */
{"MYNT-EYE-S1030", ">2.3.0", ">2.2.0", PASS_DESCRIPTION},
{"MYNT-EYE-S1030", ">2.3.0", "2.2.0", WARN_DESCRIPTION_F},
{"MYNT-EYE-S1030", ">2.3.0", "<2.2.0", ERRO_DESCRIPTION_F},
{"MYNT-EYE-S1030", "<2.3.1", "<2.2.0", WARN_DESCRIPTION_S},
/** S2100 */
{"MYNT-EYE-S2100", ">0.0.0", "1.0", PASS_DESCRIPTION},
/** S210A */
{"MYNT-EYE-S210A", ">0.0.0", "1.0", PASS_DESCRIPTION},
};
void getVersion(const std::string &str, char *version) {
std::string st1("");
int j = 0;
for (size_t i = 0; i < str.size(); i++) {
if (str[i] == '.') {
version[j++] = atoi(st1.c_str());
st1 = "";
} else {
st1 += str[i];
}
}
version[j++] = atoi(st1.c_str());
}
bool conditionMatch(const std::string& condition, const std::string& target) {
char version[4] = {0};
char version_c[4] = {0};
getVersion(target, version);
int tag_c = 0;
std::string condition_c;
if (condition[0] == '>') {
tag_c = 1;
condition_c = condition.substr(1);
} else if (condition[0] == '<') {
tag_c = -1;
condition_c = condition.substr(1);
} else {
tag_c = 0;
condition_c = condition;
}
getVersion(condition_c, version_c);
int tag_big = memcmp(version, version_c, 4);
if (tag_big * tag_c > 0 || (tag_big == 0 && tag_c == 0)) return true;
return false;
}
enum STATUS_UNIT {
ST_PASS,
ST_ERRO_F,
ST_ERRO_S,
ST_NOT_PASS
};
STATUS_UNIT checkUnit(const std::string& sdkv,
const std::string& devn,
const std::string& firmv,
const firmware_version_match_table_unit& condition) {
if (condition.device_type == devn &&
conditionMatch(condition.sdk_version, sdkv) &&
conditionMatch(condition.firmware_version, firmv)) {
if (condition.status == ERRO_DESCRIPTION_F) {
return ST_ERRO_F;
}
if (condition.status == ERRO_DESCRIPTION_S) {
return ST_ERRO_S;
}
if (condition.status == WARN_DESCRIPTION_F ||
condition.status == WARN_DESCRIPTION_S) {
LOG(WARNING) << condition.status;
}
return ST_PASS;
}
return ST_NOT_PASS;
}
bool checkFirmwareVersion(const std::shared_ptr<API> api) {
auto sdkv = api->GetInfo(Info::SDK_VERSION);
auto devn = api->GetInfo(Info::DEVICE_NAME);
auto firmv = api->GetInfo(Info::FIRMWARE_VERSION);
for (size_t i =0;
i < sizeof(FSVM_TABLE)/sizeof(firmware_version_match_table_unit);
i++) {
auto res = checkUnit(sdkv, devn, firmv, FSVM_TABLE[i]);
if (res == ST_PASS) {
return true;
} else if (res == ST_ERRO_S || res == ST_ERRO_F) {
LOG(ERROR) << FSVM_TABLE[i].status;
return false;
}
}
LOG(ERROR) << ERRO_DESCRIPTION_S;
return false;
}
MYNTEYE_END_NAMESPACE

View File

@@ -0,0 +1,25 @@
// Copyright 2018 Slightech Co., Ltd. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef MYNTEYE_API_VERSION_CHECKER_H_
#define MYNTEYE_API_VERSION_CHECKER_H_
#pragma once
#include <string>
#include "mynteye/api/api.h"
MYNTEYE_BEGIN_NAMESPACE
bool checkFirmwareVersion(const std::shared_ptr<API> api);
MYNTEYE_END_NAMESPACE
#endif // MYNTEYE_API_VERSION_CHECKER_H_

View File

@@ -315,7 +315,7 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
for (auto &&it = mono_topics.begin(); it != mono_topics.end(); ++it) { for (auto &&it = mono_topics.begin(); it != mono_topics.end(); ++it) {
auto &&topic = mono_topics[it->first]; auto &&topic = mono_topics[it->first];
if (it->first == Stream::LEFT || it->first == Stream::RIGHT) { if (it->first == Stream::LEFT || it->first == Stream::RIGHT) {
mono_publishers_[it->first] = it_mynteye.advertiseCamera(topic, 1); mono_publishers_[it->first] = it_mynteye.advertise(topic, 1);
} }
NODELET_INFO_STREAM("Advertized on topic " << topic); NODELET_INFO_STREAM("Advertized on topic " << topic);
} }
@@ -644,7 +644,7 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
is_published_[stream] = false; is_published_[stream] = false;
} }
api_->Start(Source::VIDEO_STREAMING); api_->Start(Source::VIDEO_STREAMING);
} else if (sum_c > sum) { } else {
if ((camera_publishers_[Stream::LEFT].getNumSubscribers() > 0 || if ((camera_publishers_[Stream::LEFT].getNumSubscribers() > 0 ||
mono_publishers_[Stream::LEFT].getNumSubscribers() > 0) && mono_publishers_[Stream::LEFT].getNumSubscribers() > 0) &&
!is_published_[Stream::LEFT]) { !is_published_[Stream::LEFT]) {
@@ -828,9 +828,7 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
cv::cvtColor(data.frame, mono, CV_RGB2GRAY); cv::cvtColor(data.frame, mono, CV_RGB2GRAY);
auto &&msg = cv_bridge::CvImage(header, enc::MONO8, mono).toImageMsg(); auto &&msg = cv_bridge::CvImage(header, enc::MONO8, mono).toImageMsg();
pthread_mutex_unlock(&mutex_data_); pthread_mutex_unlock(&mutex_data_);
auto &&info = getCameraInfo(stream); mono_publishers_[stream].publish(msg);
info->header.stamp = msg->header.stamp;
mono_publishers_[stream].publish(msg, info);
} }
void publishPoints( void publishPoints(
@@ -1517,7 +1515,7 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
std::map<Stream, std::string> image_encodings_; std::map<Stream, std::string> image_encodings_;
// mono: LEFT, RIGHT // mono: LEFT, RIGHT
std::map<Stream, image_transport::CameraPublisher> mono_publishers_; std::map<Stream, image_transport::Publisher> mono_publishers_;
// pointcloud: POINTS // pointcloud: POINTS
ros::Publisher points_publisher_; ros::Publisher points_publisher_;