GitHub源码:
港科大VINS-Mono

参考博文:
VINS-Mono环境配置与测试笔记
unbuntu运行VINS-MONO实验总结
ROS创建工作空间和功能包
B站:VIO-Mono安装及测试的视频讲解

本文根据主体参考博文:VINS-Mono环境配置与测试笔记的部分遗漏及问题做了修正补充。

简单介绍:港科大的VINS-Mono算法主要用于单目相机和IMU的信息融合,实现更准确实时的定位。仿真测试用的数据集为EuRoc。

问题修正:

2.6 以前的没发现问题。

2.6. Ceres 安装

在参考教程 2.6. ceres安装 中 正常运行第一段代码即可,此命令为打包安装依赖项。如果不顺利,则按第二段代码分步进行。

sudo apt-get install liblapack-dev libsuitesparse-dev libcxsparse3.1.4 libgflags-dev libgoogle-glog-dev libgtest-dev

第二段代码结果与上段一样,但是分步安装依赖项,差什么装什么。

tar zxf ceres-solver-1.14.0.tar.gz
cd ceres-solver-1.14.0
mkdir build
cmake ..
make
make install

#补充,在mkdir后,差一句指令
cd build

在原教程:解压Cere安装包,进入安装目录下:

tar zxf ceres-solver-1.14.0.tar.gz
cd ceres-solver-1.14.0
mkdir build
cmake ..
make
make install

#在最后 make install 时,如果提示无权限在 /usr/local/include/下创建文件
改为即可:
sudo make install

安装完成后,/usr/local/include/ 可见出现了ceres文件夹

catkin make 后,成功显示如图:

接着运行以下命令:

source ~/catkin_ws/devel/setup.bash #每个终端运行前都要加上这一句
roslaunch vins_estimator euroc.launch 
roslaunch vins_estimator vins_rviz.launch
rosbag play ~/catkin_ws/Dates/MH_01_easy.bag

部分需根据个人情况进行修改:

source ~/catkin_ws/devel/setup.bash #每个终端运行前都要加上这一句 为根目录下的catkin
改为:
source ~/Program/ros/catkin_ws/devel/setup.bash # ~ 表示从根目录 home/io/开始

运行后,只要不报错,即代表该步骤顺利完成。

接着运行命令:

roslaunch vins_estimator euroc.launch

提示出错:

/home/shaozu/output/pose_graph/ not exists, trying to create it
/home/shaozu/output not exists, trying to create it 
/home/shaozu not exists, trying to create it 
Failed to create folder /home/shaozu 
/home/shaozu/output/ not exists, trying to create it 
/home/shaozu not exists, trying to create it 
Failed to create folder /home/shaozu 
no previous pose graph

查看GitHub isuse得到解决思路:

修改相应的config路径。
 you need to change the result path in your config file
  I have already changed the the path in the config file, e.g. /home/shaozu -> /personal_folder.


方法一:
修改VIO-Mono/config/EuRoc下的 两个文件
进行路径修改,分别位于以下两处:
#common parameters
#loop closure parameters
然后自己建立相应文件夹

方法二:
按照提示,在自己的设备上建立对应的文件夹,补上
注意,/home/...,一般要加对应用户,如
/home/io/Program/..
而不能直接:
/home/Program/..

接着将 MH_01_easy.bag 移动到文件夹 /catkin_ws/dataset/ 中,名字自己起。

最后一行命令,改为:
rosbag play ~/Program/ros/catkin_ws/dataset/MH_01_easy.bag

综上,最后三个命令窗的命令为:

source ~/Program/ros/catkin_ws/devel/setup.bash # ~ 表示从根目录 home/io/开始 每个命令窗都要输入一遍
roscore  #建立根节点,此处命令可有可无,因为都整合到lauch里了
roslaunch vins_estimator euroc.launch
roslaunch vins_estimator vins_rviz.launch
rosbag play ~/Program/ros/catkin_ws/dataset/MH_04_difficult.bag

打开三个命令窗,依次运行后,报错信息:

Error: Received an invalid TCPROS header.
Each element must be prepended by a 4-byte length.
at line 88 in /tmp/binarydeb/ros-kinetic-cpp-common-0.6.11/src/header.cpp [FATAL]
[1587181459.567942719]: Error reading INDEX_DATA header
2020年04月18日09:05:36

初步判断是 Ros 的问题。

网上一些方案:

This finally turned out to be a an issue of managing the open and closing of multiple rosbags. Couldn’t figure what exactly was the problem - it has something to do with the initialisation of the rosbag::Bag class and assignment to a new instance.
I’m now using boost::shared_ptr, which resolves this issue.

一个issue:reused rosbag::Bag instance crashes #1556
说明:与我的报错提示一样

Error: Received an invalid TCPROS header. Each element must be
prepended by a 4-byte length. at line 88 in
/tmp/binarydeb/ros-kinetic-cpp-common-0.6.11/src/header.cpp

解释:I found a workaround by using a new instance of rosbag::Bag for the
second rosbag file. This is working as expected.
链接:https://github.com/ros/ros_comm/issues/1556

另外一个说法:

The problem comes from different version of ros on the two
machines.(原因是 Ros版本不同)

参考链接:
https://ros-users.narkive.com/j9vjDITV/received-an-invalid-tcpros-header

问题解决

从EuRoc官方下载数据集,再次测试,成功运行,原来是Bag文件的问题

原因分析:
可能是从百度云下载的数据集,在U盘等复制拷贝后,文件出现了校验匹配问题。试过从百度云下载另一个数据包,拷贝到linux,测试也失败了。所以,直接从源网站下载bag包,不拷贝,减少中转,是最优的解决方法。

提示
EuRoc数据集官网服务器在国外,一般***不咋地(这也是我为啥用百度云下载),提速的小窍门:可以在清晨或者半夜下载,错开高峰,***会很快,我的测试难以相信的到了2M/s(白天一般都是50kb/s,哭鸟)。