Merge branch 'develop' of https://github.com/slightech/MYNT-EYE-SDK-2 into develop

This commit is contained in:
Tiny 2018-12-11 17:08:38 +08:00
commit 132cbc19e2
28 changed files with 219 additions and 65 deletions

View File

@ -14,7 +14,7 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.0)
project(mynteye VERSION 2.2.1 LANGUAGES C CXX) project(mynteye VERSION 2.2.2 LANGUAGES C CXX)
include(cmake/Common.cmake) include(cmake/Common.cmake)

View File

@ -24,7 +24,7 @@ MKFILE_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
SUDO ?= sudo SUDO ?= sudo
.DEFAULT_GOAL := help .DEFAULT_GOAL := all
help: help:
@echo "Usage:" @echo "Usage:"
@ -44,7 +44,7 @@ help:
.PHONY: help .PHONY: help
all: test samples tools all: init samples tools ros
.PHONY: all .PHONY: all
@ -78,7 +78,7 @@ submodules:
# init # init
init: submodules init:
@$(call echo,Make $@) @$(call echo,Make $@)
@$(SH) ./scripts/init.sh $(INIT_OPTIONS) @$(SH) ./scripts/init.sh $(INIT_OPTIONS)
@ -86,7 +86,7 @@ init: submodules
# build # build
build: submodules build:
@$(call echo,Make $@) @$(call echo,Make $@)
ifeq ($(HOST_OS),Win) ifeq ($(HOST_OS),Win)
@$(call cmake_build,./_build,..,-DCMAKE_INSTALL_PREFIX=$(MKFILE_DIR)/_install) @$(call cmake_build,./_build,..,-DCMAKE_INSTALL_PREFIX=$(MKFILE_DIR)/_install)
@ -98,7 +98,7 @@ endif
# test # test
test: install test: submodules install
@$(call echo,Make $@) @$(call echo,Make $@)
@$(call echo,Make gtest,33) @$(call echo,Make gtest,33)
ifeq ($(HOST_OS),Win) ifeq ($(HOST_OS),Win)
@ -139,8 +139,8 @@ endif
uninstall: uninstall:
@$(call echo,Make $@) @$(call echo,Make $@)
ifeq ($(HOST_OS),Linux) ifeq ($(HOST_OS),Linux)
$(SUDO) rm -rf /usr/local/lib/libmynteye*
$(SUDO) rm -rf /usr/local/include/mynteye/ $(SUDO) rm -rf /usr/local/include/mynteye/
$(SUDO) rm -rf /usr/local/lib/libmynteye.so*
$(SUDO) rm -rf /usr/local/lib/cmake/mynteye/ $(SUDO) rm -rf /usr/local/lib/cmake/mynteye/
$(SUDO) rm -rf /usr/local/share/mynteye/ $(SUDO) rm -rf /usr/local/share/mynteye/
endif endif
@ -184,7 +184,7 @@ cleanpkg:
ros: install ros: install
@$(call echo,Make $@) @$(call echo,Make $@)
ifeq ($(HOST_OS),Linux) ifeq ($(HOST_OS),Linux)
@cd ./wrappers/ros && catkin_make @cd ./wrappers/ros && catkin_make -DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
else else
$(error "Can't make ros on $(HOST_OS)") $(error "Can't make ros on $(HOST_OS)")
endif endif

View File

@ -1,10 +1,10 @@
# MYNT® EYE SDK # MYNT® EYE S SDK
[![](https://img.shields.io/badge/MYNT%20EYE%20SDK-2.2.1--rc-brightgreen.svg?style=flat)](https://github.com/slightech/MYNT-EYE-SDK-2) [![](https://img.shields.io/badge/MYNT%20EYE%20S%20SDK-2.2.2--rc1-brightgreen.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK)
## Overview ## Overview
MYNT® EYE SDK 2.0 is a cross-platform library for MYNT® EYE cameras. MYNT® EYE S SDK is a cross-platform library for MYNT® EYE Standard cameras.
The following platforms have been tested: The following platforms have been tested:
@ -16,12 +16,12 @@ Please follow the guide doc to install the SDK on different platforms.
## Documentations ## Documentations
* [API Doc](https://github.com/slightech/MYNT-EYE-SDK-2/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-SDK-2/files/2501756/mynt-eye-sdk-apidoc-2.2.1-rc-en.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-SDK-2/files/2501763/mynt-eye-sdk-apidoc-2.2.1-rc-en.zip) [![](https://img.shields.io/badge/Online-HTML-blue.svg?style=flat)](https://slightech.github.io/MYNT-EYE-SDK-2/) * en: [![](https://img.shields.io/badge/Download-PDF-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK/files/2612865/mynt-eye-s-sdk-apidoc-2.2.2-rc1-en.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK/files/2612866/mynt-eye-s-sdk-apidoc-2.2.2-rc1-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-SDK-2/files/2501770/mynt-eye-sdk-apidoc-2.2.1-rc-zh-Hans.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-SDK-2/files/2501782/mynt-eye-sdk-apidoc-2.2.1-rc-zh-Hans.zip) [![](https://img.shields.io/badge/Online-HTML-blue.svg?style=flat)](http://doc.myntai.com/resource/api/mynt-eye-sdk-apidoc-2.2.1-rc-zh-Hans/mynt-eye-sdk-apidoc-2.2.1-rc-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/2612867/mynt-eye-s-sdk-apidoc-2.2.2-rc1-zh-Hans.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK/files/2612868/mynt-eye-s-sdk-apidoc-2.2.2-rc1-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.2.2-rc1-zh-Hans/mynt-eye-s-sdk-apidoc-2.2.2-rc1-zh-Hans/index.html)
* [Guide Doc](https://github.com/slightech/MYNT-EYE-SDK-2-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-SDK-2-Guide/files/2501821/mynt-eye-sdk-guide-2.2.1-rc-en.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-SDK-2-Guide/files/2501822/mynt-eye-sdk-guide-2.2.1-rc-en.zip) [![](https://img.shields.io/badge/Online-HTML-blue.svg?style=flat)](https://slightech.github.io/MYNT-EYE-SDK-2-Guide/) * en: [![](https://img.shields.io/badge/Download-PDF-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK-Guide/files/2612872/mynt-eye-s-sdk-guide-2.2.2-rc1-en.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK-Guide/files/2612873/mynt-eye-s-sdk-guide-2.2.2-rc1-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-SDK-2-Guide/files/2501823/mynt-eye-sdk-guide-2.2.1-rc-zh-Hans.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-SDK-2-Guide/files/2501827/mynt-eye-sdk-guide-2.2.1-rc-zh-Hans.zip) [![](https://img.shields.io/badge/Online-HTML-blue.svg?style=flat)](http://doc.myntai.com/resource/sdk/mynt-eye-sdk-guide-2.2.1-rc-zh-Hans/mynt-eye-sdk-guide-2.2.1-rc-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/2612874/mynt-eye-s-sdk-guide-2.2.2-rc1-zh-Hans.pdf) [![](https://img.shields.io/badge/Download-HTML-blue.svg?style=flat)](https://github.com/slightech/MYNT-EYE-S-SDK-Guide/files/2612875/mynt-eye-s-sdk-guide-2.2.2-rc1-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.2.2-rc1-zh-Hans/mynt-eye-s-sdk-guide-2.2.2-rc1-zh-Hans/index.html)
> Supported languages: `en`, `zh-Hans`. > Supported languages: `en`, `zh-Hans`.
@ -29,7 +29,7 @@ Please follow the guide doc to install the SDK on different platforms.
[MYNTEYE_BOX]: http://doc.myntai.com/mynteye/s/download [MYNTEYE_BOX]: http://doc.myntai.com/mynteye/s/download
Get firmwares from our online disks: [MYNTEYE_BOX][]. The latest version is `2.2.1`. Get firmwares from our online disks: [MYNTEYE_BOX][]. The latest version is `2.2.2`.
## Usage ## Usage
@ -61,8 +61,8 @@ make samples
## Mirrors ## Mirrors
国内镜像:[码云](https://gitee.com/mynt/MYNT-EYE-SDK-2)。 国内镜像:[码云](https://gitee.com/mynt/MYNT-EYE-S-SDK)。
## License ## License
This project is licensed under the Apache License, Version 2.0. Copyright 2018 Slightech Co., Ltd. This project is licensed under the [Apache License, Version 2.0](LICENSE). Copyright 2018 Slightech Co., Ltd.

View File

@ -58,7 +58,7 @@ for lang in "${LANGS[@]}"; do
# html # html
if [ -d "$OUTPUT/$lang/html" ]; then if [ -d "$OUTPUT/$lang/html" ]; then
dirname="mynt-eye-sdk-apidoc"; \ dirname="mynt-eye-s-sdk-apidoc"; \
[ -n "$version" ] && dirname="$dirname-$version"; \ [ -n "$version" ] && dirname="$dirname-$version"; \
dirname="$dirname-$lang" dirname="$dirname-$lang"
cd "$OUTPUT/$lang" cd "$OUTPUT/$lang"
@ -69,7 +69,7 @@ for lang in "${LANGS[@]}"; do
# latex # latex
if [ $pdflatex_FOUND ] && [ -f "$OUTPUT/$lang/latex/Makefile" ]; then if [ $pdflatex_FOUND ] && [ -f "$OUTPUT/$lang/latex/Makefile" ]; then
_echo_in "doxygen make latex" _echo_in "doxygen make latex"
filename="mynt-eye-sdk-apidoc"; \ filename="mynt-eye-s-sdk-apidoc"; \
[ -n "$version" ] && filename="$filename-$version"; \ [ -n "$version" ] && filename="$filename-$version"; \
filename="$filename-$lang.pdf" filename="$filename-$lang.pdf"
cd "$OUTPUT/$lang/latex" && _texcjk refman.tex && make cd "$OUTPUT/$lang/latex" && _texcjk refman.tex && make

View File

@ -32,19 +32,19 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places. # title of most generated pages and in a few other places.
# The default value is: My Project. # The default value is: My Project.
PROJECT_NAME = "MYNT EYE SDK" PROJECT_NAME = "MYNT EYE S SDK"
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This # The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# 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.2.1-rc PROJECT_NUMBER = 2.2.2-rc1
# 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
# quick idea about the purpose of the project. Keep the description short. # quick idea about the purpose of the project. Keep the description short.
PROJECT_BRIEF = http://www.myntai.com/camera PROJECT_BRIEF = http://www.myntai.com/mynteye/standard
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included # With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55 # in the documentation. The maximum height of the logo should not exceed 55
@ -1310,7 +1310,7 @@ DOCSET_PUBLISHER_ID = com.slightech.mynteye.documentation
# The default value is: Publisher. # The default value is: Publisher.
# This tag requires that the tag GENERATE_DOCSET is set to YES. # This tag requires that the tag GENERATE_DOCSET is set to YES.
DOCSET_PUBLISHER_NAME = MYNT EYE SDK DOCSET_PUBLISHER_NAME = MYNT EYE S SDK
# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The # additional HTML index files: index.hhp, index.hhc, and index.hhk. The

View File

@ -1,4 +1,4 @@
# MYNT EYE SDK {#mainpage} # MYNT EYE S SDK {#mainpage}
* <a class="el" href="annotated.html">API Classes</a> * <a class="el" href="annotated.html">API Classes</a>
* <a class="el" href="modules.html">API Modules</a> * <a class="el" href="modules.html">API Modules</a>

View File

@ -32,19 +32,19 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places. # title of most generated pages and in a few other places.
# The default value is: My Project. # The default value is: My Project.
PROJECT_NAME = "MYNT EYE SDK" PROJECT_NAME = "MYNT EYE S SDK"
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This # The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# 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.2.1-rc PROJECT_NUMBER = 2.2.2-rc1
# 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
# quick idea about the purpose of the project. Keep the description short. # quick idea about the purpose of the project. Keep the description short.
PROJECT_BRIEF = http://www.myntai.com/camera PROJECT_BRIEF = http://www.myntai.com/mynteye/standard
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included # With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55 # in the documentation. The maximum height of the logo should not exceed 55
@ -1310,7 +1310,7 @@ DOCSET_PUBLISHER_ID = com.slightech.mynteye.documentation
# The default value is: Publisher. # The default value is: Publisher.
# This tag requires that the tag GENERATE_DOCSET is set to YES. # This tag requires that the tag GENERATE_DOCSET is set to YES.
DOCSET_PUBLISHER_NAME = MYNT EYE SDK DOCSET_PUBLISHER_NAME = MYNT EYE S SDK
# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The # additional HTML index files: index.hhp, index.hhc, and index.hhk. The

View File

@ -5,13 +5,13 @@
## 获取代码 ## 获取代码
```bash ```bash
git clone https://github.com/slightech/MYNT-EYE-SDK-2.git git clone https://github.com/slightech/MYNT-EYE-S-SDK.git
``` ```
## 准备依赖 ## 准备依赖
```bash ```bash
cd mynt-eye-sdk-2/ cd mynt-eye-s-sdk/
make init make init
``` ```

View File

@ -72,13 +72,13 @@ GNU Make 4.2.1
## 获取代码 ## 获取代码
```cmd ```cmd
>git clone https://github.com/slightech/MYNT-EYE-SDK-2.git >git clone https://github.com/slightech/MYNT-EYE-S-SDK.git
``` ```
## 准备依赖 ## 准备依赖
```cmd ```cmd
>cd mynt-eye-sdk-2 >cd mynt-eye-s-sdk
>make init >make init
Make init Make init
Init deps Init deps

View File

@ -1,4 +1,4 @@
# MYNT EYE SDK {#mainpage} # MYNT EYE S SDK {#mainpage}
* <a class="el" href="annotated.html">API 类</a> * <a class="el" href="annotated.html">API 类</a>
* <a class="el" href="modules.html">API 模块</a> * <a class="el" href="modules.html">API 模块</a>

View File

@ -26,3 +26,5 @@
| HDR 模式 | hdr_mode | 1 | 0 | 0 | 1 | √ | 0x1F | XU_CAM_CTRL | 010-bit112-bit | | HDR 模式 | hdr_mode | 1 | 0 | 0 | 1 | √ | 0x1F | XU_CAM_CTRL | 010-bit112-bit |
| 零漂标定 | zero_drift_calibration | | - | - | - | × | - | XU_HALF_DUPLEX | | | 零漂标定 | zero_drift_calibration | | - | - | - | × | - | XU_HALF_DUPLEX | |
| 擦除芯片 | erase_chip | | - | - | - | × | - | XU_HALF_DUPLEX | | | 擦除芯片 | erase_chip | | - | - | - | × | - | XU_HALF_DUPLEX | |
| 加速度计量程 | accelerometer_range | 2 | 12 | 6 | 48 | √ | - | XU_CAM_CTRL | 0x0100 | |
| 陀螺仪量程 | gyroscope_range | 2 | 1000 | 250 | 4000 | √ | - | XU_CAM_CTRL | 0x0100 | |

View File

@ -195,6 +195,18 @@ enum class Option : std::uint8_t {
ZERO_DRIFT_CALIBRATION, ZERO_DRIFT_CALIBRATION,
/** Erase chip */ /** Erase chip */
ERASE_CHIP, ERASE_CHIP,
/**
* The range of accelerometer
*
* values: {4,8,16,32}, default: 8
*/
ACCELEROMETER_RANGE,
/**
* The range of gyroscope
*
* values: {500,1000,2000,4000}, default: 1000
*/
GYROSCOPE_RANGE,
/** Last guard */ /** Last guard */
LAST LAST
}; };

View File

@ -1,10 +1,10 @@
# How to use MYNT® EYE SDK with Visual Studio 2017 # How to use MYNT® EYE S SDK with Visual Studio 2017
This tutorial will create a project with Visual Studio 2017 to start using MYNT® EYE SDK. This tutorial will create a project with Visual Studio 2017 to start using MYNT® EYE S SDK.
## Preparation ## Preparation
Install the win pack of MYNT® EYE SDK. Install the win pack of MYNT® EYE S SDK.
## Create Project ## Create Project

View File

@ -1,4 +1,4 @@
# MYNT® EYE SDK # MYNT® EYE S SDK
################################################################################ ################################################################################
Language: 简体中文 Language: 简体中文
@ -18,7 +18,7 @@ Language: 简体中文
接着,进入 "<SDK_ROOT_DIR>\samples" 目录, 双击 "generate.bat" 即可生成样例工程。 接着,进入 "<SDK_ROOT_DIR>\samples" 目录, 双击 "generate.bat" 即可生成样例工程。
p.s. 样例教程,可见 https://slightech.github.io/MYNT-EYE-SDK-2/ 主页给出的 Guide 文档。 p.s. 样例教程,可见 https://slightech.github.io/MYNT-EYE-S-SDK/ 主页给出的 Guide 文档。
p.p.s. 运行结果,参考下方英文内容。 p.p.s. 运行结果,参考下方英文内容。
@ -50,7 +50,7 @@ Second, goto the "<SDK_ROOT_DIR>\samples" directory and click "generate.bat" to
Finally, you could click `_build\mynteye_samples.sln` to open the samples project. Finally, you could click `_build\mynteye_samples.sln` to open the samples project.
p.s. The tutorials of samples are here: https://slightech.github.io/MYNT-EYE-SDK-2-Guide/src/data/contents.html. p.s. The tutorials of samples are here: https://slightech.github.io/MYNT-EYE-S-SDK-Guide/src/data/contents.html.
p.p.s. The example result of "generate.bat", p.p.s. The example result of "generate.bat",
@ -171,6 +171,6 @@ CMake Warning at tutorials/CMakeLists.txt:86 (message):
Press any key to continue . . . Press any key to continue . . .
``` ```
3) Start using MYNT® EYE SDK with Visual Studio 2017 3) Start using MYNT® EYE S SDK with Visual Studio 2017
Goto the "<SDK_ROOT_DIR>\projects\vs2017", see the "README.md". Goto the "<SDK_ROOT_DIR>\projects\vs2017", see the "README.md".

View File

@ -114,6 +114,7 @@ make_executable2(get_with_plugin SRCS data/get_with_plugin.cc WITH_OPENCV)
## control ## control
make_executable2(ctrl_framerate SRCS control/framerate.cc WITH_OPENCV) make_executable2(ctrl_framerate SRCS control/framerate.cc WITH_OPENCV)
make_executable2(ctrl_imu_range SRCS control/imu_range.cc WITH_OPENCV)
make_executable2(ctrl_auto_exposure make_executable2(ctrl_auto_exposure
SRCS control/auto_exposure.cc util/cv_painter.cc SRCS control/auto_exposure.cc util/cv_painter.cc
WITH_OPENCV WITH_OPENCV

View File

@ -0,0 +1,89 @@
// 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 <atomic>
#include <opencv2/highgui/highgui.hpp>
#include "mynteye/logger.h"
#include "mynteye/api/api.h"
#include "mynteye/util/times.h"
MYNTEYE_USE_NAMESPACE
int main(int argc, char *argv[]) {
auto &&api = API::Create(argc, argv);
if (!api)
return 1;
// ACCELEROMETER_RANGE values: 4, 8, 16, 32
api->SetOptionValue(Option::ACCELEROMETER_RANGE, 8);
// GYROSCOPE_RANGE values: 500, 1000, 2000, 4000
api->SetOptionValue(Option::GYROSCOPE_RANGE, 1000);
LOG(INFO) << "Set ACCELEROMETER_RANGE to "
<< api->GetOptionValue(Option::ACCELEROMETER_RANGE);
LOG(INFO) << "Set GYROSCOPE_RANGE to "
<< api->GetOptionValue(Option::GYROSCOPE_RANGE);
// Count img
std::atomic_uint img_count(0);
api->SetStreamCallback(
Stream::LEFT, [&img_count](const api::StreamData &data) {
CHECK_NOTNULL(data.img);
++img_count;
});
// Count imu
std::atomic_uint imu_count(0);
api->SetMotionCallback([&imu_count](const api::MotionData &data) {
CHECK_NOTNULL(data.imu);
++imu_count;
});
api->Start(Source::ALL);
cv::namedWindow("frame");
auto &&time_beg = times::now();
while (true) {
api->WaitForStreams();
auto &&left_data = api->GetStreamData(Stream::LEFT);
auto &&right_data = api->GetStreamData(Stream::RIGHT);
cv::Mat img;
cv::hconcat(left_data.frame, right_data.frame, img);
cv::imshow("frame", img);
char key = static_cast<char>(cv::waitKey(1));
if (key == 27 || key == 'q' || key == 'Q') { // ESC/Q
break;
}
}
auto &&time_end = times::now();
api->Stop(Source::ALL);
// Calculate img fps and imu hz
float elapsed_ms =
times::count<times::microseconds>(time_end - time_beg) * 0.001f;
LOG(INFO) << "Time beg: " << times::to_local_string(time_beg)
<< ", end: " << times::to_local_string(time_end)
<< ", cost: " << elapsed_ms << "ms";
LOG(INFO) << "Img count: " << img_count
<< ", fps: " << (1000.f * img_count / elapsed_ms);
LOG(INFO) << "Imu count: " << imu_count
<< ", hz: " << (1000.f * imu_count / elapsed_ms);
return 0;
}

View File

@ -226,7 +226,7 @@ API::API(std::shared_ptr<Device> device) : device_(device) {
"to write the image params. If you update the SDK from " "to write the image params. If you update the SDK from "
"1.x, the `SN*.conf` is the file contains them. Besides, " "1.x, the `SN*.conf` is the file contains them. Besides, "
"you could also calibrate them by yourself. Read the guide " "you could also calibrate them by yourself. Read the guide "
"doc (https://github.com/slightech/MYNT-EYE-SDK-2-Guide) " "doc (https://github.com/slightech/MYNT-EYE-S-SDK-Guide) "
"to learn more."; "to learn more.";
} }
} }

View File

@ -63,6 +63,12 @@ int XuCamCtrlId(Option option) {
case Option::FRAME_RATE: case Option::FRAME_RATE:
return 7; return 7;
break; break;
case Option::ACCELEROMETER_RANGE:
return 9;
break;
case Option::GYROSCOPE_RANGE:
return 10;
break;
default: default:
LOG(FATAL) << "No cam ctrl id for " << option; LOG(FATAL) << "No cam ctrl id for " << option;
} }
@ -135,7 +141,8 @@ void Channels::UpdateControlInfos() {
for (auto &&option : std::vector<Option>{ for (auto &&option : std::vector<Option>{
Option::FRAME_RATE, Option::IMU_FREQUENCY, Option::EXPOSURE_MODE, Option::FRAME_RATE, Option::IMU_FREQUENCY, Option::EXPOSURE_MODE,
Option::MAX_GAIN, Option::MAX_EXPOSURE_TIME, Option::MAX_GAIN, Option::MAX_EXPOSURE_TIME,
Option::DESIRED_BRIGHTNESS, Option::IR_CONTROL, Option::HDR_MODE}) { Option::DESIRED_BRIGHTNESS, Option::IR_CONTROL, Option::HDR_MODE,
Option::ACCELEROMETER_RANGE, Option::GYROSCOPE_RANGE}) {
control_infos_[option] = XuControlInfo(option); control_infos_[option] = XuControlInfo(option);
} }
@ -177,6 +184,8 @@ std::int32_t Channels::GetControlValue(const Option &option) const {
case Option::DESIRED_BRIGHTNESS: case Option::DESIRED_BRIGHTNESS:
case Option::IR_CONTROL: case Option::IR_CONTROL:
case Option::HDR_MODE: case Option::HDR_MODE:
case Option::ACCELEROMETER_RANGE:
case Option::GYROSCOPE_RANGE:
return XuCamCtrlGet(option); return XuCamCtrlGet(option);
case Option::ZERO_DRIFT_CALIBRATION: case Option::ZERO_DRIFT_CALIBRATION:
case Option::ERASE_CHIP: case Option::ERASE_CHIP:
@ -232,6 +241,16 @@ void Channels::SetControlValue(const Option &option, std::int32_t value) {
break; break;
XuCamCtrlSet(option, value); XuCamCtrlSet(option, value);
} break; } break;
case Option::ACCELEROMETER_RANGE: {
if (!in_range() || !in_values({4, 8, 16, 32}))
break;
XuCamCtrlSet(option, value);
} break;
case Option::GYROSCOPE_RANGE: {
if (!in_range() || !in_values({500, 1000, 2000, 4000}))
break;
XuCamCtrlSet(option, value);
} break;
case Option::EXPOSURE_MODE: case Option::EXPOSURE_MODE:
case Option::MAX_GAIN: case Option::MAX_GAIN:
case Option::MAX_EXPOSURE_TIME: case Option::MAX_EXPOSURE_TIME:
@ -268,6 +287,8 @@ bool Channels::RunControlAction(const Option &option) const {
case Option::DESIRED_BRIGHTNESS: case Option::DESIRED_BRIGHTNESS:
case Option::IR_CONTROL: case Option::IR_CONTROL:
case Option::HDR_MODE: case Option::HDR_MODE:
case Option::ACCELEROMETER_RANGE:
case Option::GYROSCOPE_RANGE:
LOG(WARNING) << option << " run action useless"; LOG(WARNING) << option << " run action useless";
return false; return false;
default: default:

View File

@ -26,7 +26,8 @@ const std::map<Model, OptionSupports> option_supports_map = {
{Option::GAIN, Option::BRIGHTNESS, Option::CONTRAST, Option::FRAME_RATE, {Option::GAIN, Option::BRIGHTNESS, Option::CONTRAST, Option::FRAME_RATE,
Option::IMU_FREQUENCY, Option::EXPOSURE_MODE, Option::MAX_GAIN, Option::IMU_FREQUENCY, Option::EXPOSURE_MODE, Option::MAX_GAIN,
Option::MAX_EXPOSURE_TIME, Option::DESIRED_BRIGHTNESS, Option::IR_CONTROL, Option::MAX_EXPOSURE_TIME, Option::DESIRED_BRIGHTNESS, Option::IR_CONTROL,
Option::HDR_MODE, Option::ZERO_DRIFT_CALIBRATION, Option::ERASE_CHIP}}}; Option::HDR_MODE, Option::ZERO_DRIFT_CALIBRATION, Option::ERASE_CHIP,
Option::ACCELEROMETER_RANGE, Option::GYROSCOPE_RANGE}}};
const std::map<Model, std::map<Capabilities, StreamRequests>> const std::map<Model, std::map<Capabilities, StreamRequests>>
stream_requests_map = { stream_requests_map = {

View File

@ -34,9 +34,16 @@ Motions::~Motions() {
void Motions::SetMotionCallback(motion_callback_t callback) { void Motions::SetMotionCallback(motion_callback_t callback) {
motion_callback_ = callback; motion_callback_ = callback;
if (motion_callback_) { if (motion_callback_) {
accel_range = channels_->GetControlValue(Option::ACCELEROMETER_RANGE);
if (accel_range == -1)
accel_range = 8;
gyro_range = channels_->GetControlValue(Option::GYROSCOPE_RANGE);
if (gyro_range == -1)
gyro_range = 1000;
channels_->SetImuCallback([this](const ImuPacket &packet) { channels_->SetImuCallback([this](const ImuPacket &packet) {
if (!motion_callback_ && !motion_datas_enabled_) { if (!motion_callback_ && !motion_datas_enabled_) {
LOG(WARNING) << "";
return; return;
} }
for (auto &&seg : packet.segments) { for (auto &&seg : packet.segments) {
@ -47,17 +54,19 @@ void Motions::SetMotionCallback(motion_callback_t callback) {
// LOG(WARNING) << "Imu timestamp offset is incorrect"; // LOG(WARNING) << "Imu timestamp offset is incorrect";
// } // }
imu->timestamp = packet.timestamp + seg.offset; imu->timestamp = packet.timestamp + seg.offset;
imu->accel[0] = seg.accel[0] * 8.f / 0x10000; imu->accel[0] = seg.accel[0] * 1.f * accel_range / 0x10000;
imu->accel[1] = seg.accel[1] * 8.f / 0x10000; imu->accel[1] = seg.accel[1] * 1.f * accel_range / 0x10000;
imu->accel[2] = seg.accel[2] * 8.f / 0x10000; imu->accel[2] = seg.accel[2] * 1.f * accel_range / 0x10000;
imu->gyro[0] = seg.gyro[0] * 1000.f / 0x10000; imu->gyro[0] = seg.gyro[0] * 1.f * gyro_range / 0x10000;
imu->gyro[1] = seg.gyro[1] * 1000.f / 0x10000; imu->gyro[1] = seg.gyro[1] * 1.f * gyro_range / 0x10000;
imu->gyro[2] = seg.gyro[2] * 1000.f / 0x10000; imu->gyro[2] = seg.gyro[2] * 1.f * gyro_range / 0x10000;
imu->temperature = seg.temperature / 326.8f + 25; imu->temperature = seg.temperature / 326.8f + 25;
std::lock_guard<std::mutex> _(mtx_datas_); std::lock_guard<std::mutex> _(mtx_datas_);
motion_data_t data = {imu}; motion_data_t data = {imu};
motion_datas_.push_back(data); if (motion_datas_enabled_) {
motion_datas_.push_back(data);
}
motion_callback_(data); motion_callback_(data);
} }

View File

@ -57,6 +57,9 @@ class Motions {
bool is_imu_tracking; bool is_imu_tracking;
std::mutex mtx_datas_; std::mutex mtx_datas_;
int accel_range = 8;
int gyro_range = 1000;
}; };
MYNTEYE_END_NAMESPACE MYNTEYE_END_NAMESPACE

View File

@ -114,6 +114,8 @@ const char *to_string(const Option &value) {
CASE(HDR_MODE) CASE(HDR_MODE)
CASE(ZERO_DRIFT_CALIBRATION) CASE(ZERO_DRIFT_CALIBRATION)
CASE(ERASE_CHIP) CASE(ERASE_CHIP)
CASE(ACCELEROMETER_RANGE)
CASE(GYROSCOPE_RANGE)
default: default:
CHECK(is_valid(value)); CHECK(is_valid(value));
return "Option::UNKNOWN"; return "Option::UNKNOWN";

View File

@ -2,6 +2,6 @@
<Workspace <Workspace
version = "1.0"> version = "1.0">
<FileRef <FileRef
location = "self:/Users/tiny/Desktop/develop/MYNT-EYE-SDK-2/src/mynteye/uvc/macosx/UVCXcodeProject.xcodeproj"> location = "self:/Users/tiny/Desktop/develop/MYNT-EYE-S-SDK/src/mynteye/uvc/macosx/UVCXcodeProject.xcodeproj">
</FileRef> </FileRef>
</Workspace> </Workspace>

View File

@ -1,4 +1,4 @@
# Wrappers for MYNT® EYE SDK # Wrappers for MYNT® EYE SDK
* [MYNT® EYE ROS Wrapper](https://github.com/slightech/MYNT-EYE-SDK-2/tree/master/wrappers/ros) * [MYNT® EYE ROS Wrapper](https://github.com/slightech/MYNT-EYE-S-SDK/tree/master/wrappers/ros)
* [MYNT® EYE Python Wrapper](https://github.com/slightech/MYNT-EYE-SDK-2/tree/master/wrappers/python) * [MYNT® EYE Python Wrapper](https://github.com/slightech/MYNT-EYE-S-SDK/tree/master/wrappers/python)

View File

@ -52,7 +52,7 @@ chmod 755 ./ros_install.sh && bash ./ros_install.sh catkin_ws indigo
If `libopencv` not found when `make ros`, If `libopencv` not found when `make ros`,
make[3]: *** No rule to make target `/usr/lib/x86_64-linux-gnu/libopencv_videostab.so.2.4.8', needed by `/home/john/Workspace/mynt-eye-sdk-2/wrappers/ros/devel/lib/libmynteye_wrapper.so'. Stop. make[3]: *** No rule to make target `/usr/lib/x86_64-linux-gnu/libopencv_videostab.so.2.4.8', needed by `/home/john/Workspace/mynt-eye-s-sdk/wrappers/ros/devel/lib/libmynteye_wrapper.so'. Stop.
Solution 1) Install OpenCV 2 package: Solution 1) Install OpenCV 2 package:
@ -67,7 +67,7 @@ Solution 2) Install OpenCV 3 and recompile `cv_bridge`:
sudo apt-get install ros-indigo-opencv3 sudo apt-get install ros-indigo-opencv3
git clone https://github.com/ros-perception/vision_opencv.git git clone https://github.com/ros-perception/vision_opencv.git
mv vision_opencv/cv_bridge/ mynt-eye-sdk-2/wrappers/ros/src/ mv vision_opencv/cv_bridge/ mynt-eye-s-sdk/wrappers/ros/src/
``` ```
Finally, `make ros` again. Finally, `make ros` again.

View File

@ -37,7 +37,7 @@ find_package(catkin REQUIRED COMPONENTS
cv_bridge cv_bridge
geometry_msgs geometry_msgs
image_transport image_transport
message_runtime message_generation
nodelet nodelet
roscpp roscpp
sensor_msgs sensor_msgs
@ -48,6 +48,7 @@ find_package(catkin REQUIRED COMPONENTS
checkPackage("cv_bridge" "") checkPackage("cv_bridge" "")
checkPackage("geometry_msgs" "") checkPackage("geometry_msgs" "")
checkPackage("image_transport" "") checkPackage("image_transport" "")
checkPackage("message_generation" "")
checkPackage("nodelet" "") checkPackage("nodelet" "")
checkPackage("roscpp" "") checkPackage("roscpp" "")
checkPackage("sensor_msgs" "") checkPackage("sensor_msgs" "")
@ -72,7 +73,7 @@ generate_messages(
) )
catkin_package( catkin_package(
CATKIN_DEPENDS cv_bridge geometry_msgs image_transport nodelet roscpp sensor_msgs std_msgs tf CATKIN_DEPENDS cv_bridge geometry_msgs image_transport message_runtime nodelet roscpp sensor_msgs std_msgs tf
) )
#get_filename_component(SDK_DIR "${PROJECT_SOURCE_DIR}/../../../.." ABSOLUTE) #get_filename_component(SDK_DIR "${PROJECT_SOURCE_DIR}/../../../.." ABSOLUTE)
@ -112,6 +113,7 @@ set(LINK_LIBS
add_library(mynteye_wrapper src/wrapper_nodelet.cc) add_library(mynteye_wrapper src/wrapper_nodelet.cc)
target_link_libraries(mynteye_wrapper ${LINK_LIBS}) target_link_libraries(mynteye_wrapper ${LINK_LIBS})
add_dependencies(mynteye_wrapper ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_executable(mynteye_wrapper_node src/wrapper_node.cc) add_executable(mynteye_wrapper_node src/wrapper_node.cc)
target_link_libraries(mynteye_wrapper_node mynteye_wrapper ${LINK_LIBS}) target_link_libraries(mynteye_wrapper_node mynteye_wrapper ${LINK_LIBS})

View File

@ -86,6 +86,14 @@
<arg name="hdr_mode" default="-1" /> <arg name="hdr_mode" default="-1" />
<!-- <arg name="hdr_mode" default="0" /> --> <!-- <arg name="hdr_mode" default="0" /> -->
<!-- accel_range range: {4,8,16,32} -->
<arg name="accel_range" default="-1" />
<!-- <arg name="accel_range" default="8" /> -->
<!-- gyro_range range: {500,1000,2000,4000} -->
<arg name="gyro_range" default="-1" />
<!-- <arg name="gyro_range" default="1000" /> -->
<!-- Push down all topics/nodelets into "mynteye" namespace --> <!-- Push down all topics/nodelets into "mynteye" namespace -->
<group ns="$(arg mynteye)"> <group ns="$(arg mynteye)">
@ -143,6 +151,8 @@
<param name="desired_brightness" value="$(arg desired_brightness)" /> <param name="desired_brightness" value="$(arg desired_brightness)" />
<param name="ir_control" value="$(arg ir_control)" /> <param name="ir_control" value="$(arg ir_control)" />
<param name="hdr_mode" value="$(arg hdr_mode)" /> <param name="hdr_mode" value="$(arg hdr_mode)" />
<param name="accel_range" value="$(arg accel_range)" />
<param name="gyro_range" value="$(arg gyro_range)" />
</node> </node>

View File

@ -160,6 +160,8 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
{Option::DESIRED_BRIGHTNESS, "desired_brightness"}, {Option::DESIRED_BRIGHTNESS, "desired_brightness"},
{Option::IR_CONTROL, "ir_control"}, {Option::IR_CONTROL, "ir_control"},
{Option::HDR_MODE, "hdr_mode"}, {Option::HDR_MODE, "hdr_mode"},
{Option::ACCELEROMETER_RANGE, "accel_range"},
{Option::GYROSCOPE_RANGE, "gyro_range"}
}; };
for (auto &&it = option_names.begin(); it != option_names.end(); ++it) { for (auto &&it = option_names.begin(); it != option_names.end(); ++it) {
if (!api_->Supports(it->first)) if (!api_->Supports(it->first))
@ -196,10 +198,10 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
{Stream::DISPARITY_NORMALIZED, enc::MONO8}, {Stream::DISPARITY_NORMALIZED, enc::MONO8},
{Stream::DEPTH, enc::MONO16}}; {Stream::DEPTH, enc::MONO16}};
pub_imu_ = nh_.advertise<sensor_msgs::Imu>(imu_topic, 1); pub_imu_ = nh_.advertise<sensor_msgs::Imu>(imu_topic, 100);
NODELET_INFO_STREAM("Advertized on topic " << imu_topic); NODELET_INFO_STREAM("Advertized on topic " << imu_topic);
pub_temp_ = nh_.advertise<mynt_eye_ros_wrapper::Temp>(temp_topic, 1); pub_temp_ = nh_.advertise<mynt_eye_ros_wrapper::Temp>(temp_topic, 100);
NODELET_INFO_STREAM("Advertized on topic " << temp_topic); NODELET_INFO_STREAM("Advertized on topic " << temp_topic);
// stream toggles // stream toggles