小觅摄像头标准版运行 VINS-Mono

香港科技大学VINS-Mono项目:https://github.com/HKUST-Aerial-Robotics/VINS-Mono

小觅VINS-Mono:https://github.com/slightech/MYNT-EYE-VINS-Sample

小觅相机标准版SDK:https://github.com/slightech/MYNT-EYE-S-SDK

1.环境准备

1.1 系统环境

Ubuntu 16.04 LTS,最好是干净的系统。

可以到阿里巴巴开源镜像站或其他下载站下载系统镜像。 https://mirrors.aliyun.com/ubuntu-releases/16.04/ubuntu-16.04.6-desktop-amd64.iso

安装git、cmake、vim、wget

1
2
3
4
5
sudo apt-get update
sudo apt-get install git
sudo apt-get install cmake
sudo apt-get install vim
sudo apt-get install wget

1.2 安装ROS Kinetic

安装说明:http://wiki.ros.org/cn/kinetic/Installation/Ubuntu

1.2.1 配置 Ubuntu 软件仓库

配置你的 Ubuntu 软件仓库(repositories) 以允许 “restricted”、“universe” 和 “multiverse"这三种安装模式。 你可以按照ubuntu中的配置指南来完成配置。

1.2.2 添加 sources.list

官方源速度有些慢,添加中科大源

1
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'

或清华源

1
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'

1.2.3 添加key

1
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

添加公钥(官方文档没有这一步,但是不添加公钥会报不信任错误

1
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654

1.2.4 安装

1
sudo apt-get update

安装桌面完整版

1
sudo apt-get install ros-kinetic-desktop-full

1.2.5 初始化rosdep

1
2
sudo rosdep init
rosdep update

1.2.6 环境配置

1
2
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc

1.2.7 构建工厂依赖

1
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential

1.2.8 配置ROS环境,创建工作空间

参考:http://wiki.ros.org/cn/ROS/Tutorials/InstallingandConfiguringROSEnvironment

1
2
3
4
5
6
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws
catkin_make
source devel/setup.bash
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

注意,在官方文档添加完key之后,需要添加公钥:(官方文档没有这一步,但是不添加公钥会报不信任错误)

1
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654

使用ROS,可以不安装OpenCV,先安装ROS再编译SDK,否则可能出错。详细说明参见小觅官方文档。

1.3 准备小觅相机SDK

本部分参考官方文档SDK安装部分,安装到目录~/MYNT/SDK下

https://mynt-eye-s-sdk.readthedocs.io/zh_CN/latest/src/sdk/install_ubuntu_src.html

  1. 下载并编译安装SDK

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    
    mkdir ~/MYNT
    cd ~/MYNT
    git clone https://github.com/slightech/MYNT-EYE-S-SDK.git SDK
    cd SDK
    make init
    make
    make install
    
    make samples
    make tools
    make ros
    # make all
  2. 添加路径

    1
    2
    
    echo "source ~/MYNT/SDK/wrappers/ros/devel/setup.bash" >> ~/.bashrc
    source ~/.bashrc
  3. 测试相机

    1. 不使用ROS
    1
    2
    
     cd ~/MYNT/SDK						#cd <sdk>
    ./samples/_output/bin/api/camera_a
    1. 使用ROS
    1
    2
    3
    4
    
    cd <sdk>
    source wrappers/ros/devel/setup.bash
    roslaunch mynt_eye_ros_wrapper mynteye.launch     #开摄像头,但默认不显示图像
    roslaunch mynt_eye_ros_wrapper display.launch    #也可以运行这个节点,会打开 RViz 显示图像
    1. 获取参数
    1
    2
    3
    
    cd <sdk>
    ./samples/_output/bin/tutorials/get_img_params     #获取相机标定参数
    ./samples/_output/bin/tutorials/get_imu_params     #获取IMU标定参数

1.4 安装ceres依赖

官方文档:http://ceres-solver.org/installation.html

1
2
3
4
5
6
7
8
sudo apt-get install liblapack-dev libsuitesparse-dev libcxsparse3.1.4 libgflags-dev libgoogle-glog-dev libgtest-dev
git clone https://github.com/ceres-solver/ceres-solver
cd ceres-solver
mkdir build
cd build
cmake ..
make -j2
sudo make install

2. 编译安装VINS-Mono

创建工作空间

1
2
mkdir -p ~/vins_mono/src
cd ~/vins_mono/src

下载源代码【注意不要下错分支】

1
git clone -b mynteye https://github.com/slightech/MYNT-EYE-VINS-Sample.git

编译安装

1
2
cd ~/vins_mono
catkin_make -j2

配置路径

1
2
echo "source ~/vins_mono/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

3.配置相机参数

该项目使用左目摄像头和IMU。首先获取相机标定参数

1
2
cd MYNT-EYE-S-SDK
./samples/_output/bin/tutorials/get_img_params

MYNT-EYE-VINS-Sample/config/mynteye/mynteye_s_config.yaml中更新参数

获取相机校准参数时可以看到相机模型,pinhole代表针孔模型,equidistant代表等距模型,如果相机为等距模型不能直接写入参数,需要自己标定针孔模型或者按照 写入图像标定参数 写入SDK中的针孔模型参数来使用。

获取参数

获取相机参数
1
2
3
cd ~/MYNT/SDK
make samples                                     #编译sdk文件的sample
./samples/_output/bin/tutorials/get_img_params   #获得相机的参数
获得的参数(示例)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#相机内参
left: {
pinhole, 
width: 752, 
height: 480, 
fx: 358.17549797746926288
fy: 359.24666800723582583
cx: 388.61747233659593803
cy: 240.16748092953034188 
model: 0, 
coeffs: [-0.25326343297436710, 0.04841619345004276, 0.00059805649233287, -0.00153479593317240, 0.00000000000000000]}

right: {
pinhole, 
width: 752, 
height: 480, 
fx: 365.57553526747392425, 
fy: 365.54425241123698243, 
cx: 369.96980098269671089, 
cy: 230.17462048185933554, 
model: 0, 
coeffs: [-0.30954460737697198, 0.08688922042475018, 0.00020528773279130, 0.00016894963631214, 0.00000000000000000]}

#相机外参
Extrinsics 
right to left: 
{rotation: [
0.99946790791265716, -0.00301528183741204, -0.03247782517560629,
0.00305611847196011, 0.99999460066266410, 0.00120780188953115, 
0.03247400795377153, -0.00130641530915091, 0.99947172650678739], 
translation: [121.15860396636720964, -0.18695081041847689, -2.23380732606506438]}

修改参数文件

~/vins-mono/src/config/mynteye/mynteye_s_config

  • 相机投影参数 fx、fy、cx、cy
  • 相机畸变参数 coeffs[5]=[k1,k2,p1,p2,k3]

参考资料:

https://guojh.top/VinsMono.html

https://blog.csdn.net/weixin_41074793/article/details/87866964

4. 运行VINS-Mono

  1. 运行mynteye节点
1
2
source  ~/MYNT/SDK/wrappers/ros/devel/setup.bash
roslaunch mynt_eye_ros_wrapper mynteye.launch
  1. 打开另一个终端运行vins
1
2
source ~/vins_mono/devel/setup.bash
roslaunch vins_estimator mynteye_s.launch

参考资料:

官方文档(2.3.4版本,最新版的文档由于采用了docker,不适用于直接安装):http://doc.myntai.com/resource/api/mynt-eye-s-sdk-docs-2.3.4-zh-Hans/mynt-eye-s-sdk-docs-2.3.4-zh-Hans/src/slam/vins.html

https://blog.csdn.net/qq_43145072/article/details/89357894

0%