Ubuntu SDK 源码安装MYNT_EYE
如果是其他 Linux 发行版,不是用的 apt-get
包管理工具,那你准备依赖时不能 make init
自动安装,得自己手动安装了。必要安装项如下:
Linux | How to install required packages |
---|---|
Debian based | sudo apt-get install build-essential cmake git libv4l-dev |
Red Hat based | sudo yum install make gcc gcc-c++ kernel-devel cmake git libv4l-devel |
Arch Linux | sudo pacman -S base-devel cmake git v4l-utils |
sudo apt-get install git
git clone https://github.com/slightech/MYNT-EYE-SDK-2.git
cd
make init
Tip (如果之前安装过opencv,此处略去)
OpenCV 如何编译安装,请见官方文档 Installation in Linux 。或参考如下命令:
[compiler] sudo apt-get install build-essential
[required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
[optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
$ git clone https://github.com/opencv/opencv.git
$ cd opencv/
$ git checkout tags/3.4.1
$ mkdir _build
$ cd _build/
$ cmake \
-DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX=/usr/local \
\
-DWITH_CUDA=OFF \
\
-DBUILD_DOCS=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_PERF_TESTS=OFF \
..
$ make -j4
$ sudo make install
Tip
如果 OpenCV 安装到了自定义目录或想指定某一版本,编译前可如下设置路径:
# OpenCV_DIR 为 OpenCVConfig.cmake 所在目录
export OpenCV_DIR=~/opencv
不然, CMake 会提示找不到 OpenCV 。如果不想依赖 OpenCV ,请阅读 OpenCV 不依赖 。
编译并安装:
cd
make install
最终,默认会安装在
目录。
cd
make samples
检查链接
ls /dev/video*(显示是否链接了摄像头)
运行样例:
./samples/_output/bin/api/camera_a
显示界面
教程样例,请阅读 MYNT® EYE 数据 和 MYNT® EYE 控制 。
cd
make tools
安装脚本依赖:
cd /tools/
sudo pip install -r requirements.txt
工具和脚本的使用,后续会有介绍。
工程要引入 SDK 的话,CMake 可参考 samples/CMakeLists.txt
里的配置。不然,就是直接引入安装目录里的头文件和动态库。
wget https://raw.githubusercontent.com/oroca/oroca-ros-pkg/master/ros_install.sh && \
chmod 755 ./ros_install.sh && bash ./ros_install.sh catkin_ws kinetic
wget https://raw.githubusercontent.com/oroca/oroca-ros-pkg/master/ros_install.sh && \
chmod 755 ./ros_install.sh && bash ./ros_install.sh catkin_ws indigo
cd
make ros
source wrappers/ros/devel/setup.bash
roslaunch mynt_eye_ros_wrapper mynteye.launch
运行节点,同时打开 RViz 预览:
source wrappers/ros/devel/setup.bash
roslaunch mynt_eye_ros_wrapper display.launch
运行节点,有提供获取设备信息服务,如下测试:
$ source wrappers/ros/devel/setup.bash
$ rosrun mynt_eye_ros_wrapper get_device_info.py
LENS_TYPE: 0000
SPEC_VERSION: 1.0
NOMINAL_BASELINE: 120
HARDWARE_VERSION: 2.0
IMU_TYPE: 0000
SERIAL_NUMBER: 0610243700090720
FIRMWARE_VERSION: 2.0
DEVICE_NAME: MYNT-EYE-S1000
make ros
时 libopencv
找不到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.
Solution 1) 安装 OpenCV 2:
sudo apt-get update
sudo apt-get install libcv-dev
Solution 2) 安装 OpenCV 3 并重编 cv_bridge
:
sudo apt-get install ros-indigo-opencv3
git clone https://github.com/ros-perception/vision_opencv.git
mv vision_opencv/cv_bridge/ mynt-eye-sdk-2/wrappers/ros/src/
然后,重新 make ros
。
附:
运行节点
source wrappers/ros/devel/setup.bash
roslaunch mynt_eye_ros_wrapper mynteye.launch
新开一个终端,运行节点,同时打开 RViz 预览:
source wrappers/ros/devel/setup.bash
roslaunch mynt_eye_ros_wrapper display.launch
查找录制数据的topic
rostopic list (-v会显示发布者和订阅者)
(找到图像信息和IMU信息的topics)
/mynteye/left/camera_info
/mynteye/left/image_raw
录制数据(保存.bag格式,后期解析)
rosbag record /mynteye/left/image_raw /mynteye/right/image_raw /mynteye/imu/data_raw
查看.bag包的信息(会得到你需要的各种信息)
rosbag info *.bag