目录
double痛苦面具.jpg
一、安装依赖项
详细文字说明及问题见 Ubuntu18.04从零开始搭建orb slam3及数据集测试 第一部分,这里只贴命令
sudo apt-get install g++
sudo apt-get install gcc
sudo apt-get install cmake
sudo apt-get install git
sudo apt-get install build-essential
二、安装Pangolin
详细文字说明及问题见 Ubuntu18.04从零开始搭建orb slam3及数据集测试 第二部分
# 依赖项
sudo apt install libglew-dev
sudo apt install libpython2.7-dev
# eigen3
sudo apt-get install libeigen3-dev
# 查询eigen3版本
dpkg -s libeigen3-dev
# 编译
git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
mkdir build && cd build
cmake ..
make
sudo make install
三、安装ros
详细文字说明及问题见 Ubuntu18.04 搭建ros环境
# 软件源
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'
# 密钥
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
# 更新
sudo apt update
# 安装
sudo apt install ros-noetic-desktop-full
# 初始化
sudo apt install python3-rosdep2
sudo rosdep init
——————————————————————————————————————
问题1:ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.
解决办法:
sudo gedit /etc/hosts
在文本最后一行加上
199.232.28.133 raw.githubusercontent.com
如果还是不成功,就运行下面三条命令
sudo apt-get install python3-pip
sudo pip3 install 6-rosdep
sudo 6-rosdep
sudo rosdep init
——————————————————————————————
问题2:ERROR: default sources list file already exists:
/etc/ros/rosdep/sources.list.d/20-default.list
Please delete if you wish to re-initialize
解决办法:
sudo rm /etc/ros/rosdep/sources.list.d/20-default.list
sudo rosdep init
————————————————————————
# 更新
rosdep update
# 环境变量
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
# 安装rosinstall
sudo apt install python3-rosinstall python3-rosinstall-generator python3-wstool
最后验证一下就好,验证方法在隔壁那篇写过了
————————————————————————————————
问题3:
Command 'roscore' not found
解决办法:
sudo apt install python3-roslaunch
————————————————————————
问题4:
Resource not found: roslaunch
ROS path [0]=/opt/ros/noetic/share/ros
ROS path [1]=/opt/ros/noetic/share
The traceback for the exception was written to the log file
解决办法:
之前没装完,再装一下
sudo apt install ros-noetic-desktop-full
四、安装opencv
安装完ros以后就自动安装opencv了
————————————————
问题5:
后续发现4.x版本和vins-mono要求的3.x版本有冲突,需要修改一下文件
解决办法:
给下列文件添加以下文字
文件 VINS-Mono/camera_model/include/camodocal/chessboard/Chessboard.h
#include <opencv2/imgproc/types_c.h>
#include <opencv2/calib3d/calib3d_c.h>
文件 VINS-Mono/camera_model/include/camodocal/calib/CameraCalibration.h
文件 VINS-Mono/pose_graph/src/pose_graph.h
文件 VINS-Mono/pose_graph/src/keyframe.h
文件 VINS-Mono/pose_graph/src/ThirdParty/DVision/BRIEF.cpp
#include <opencv2/imgproc/types_c.h>
#include <opencv2/imgproc/imgproc_c.h>
五、安装ceres-1.14.0
这个好像也有版本问题,版本太高了会出错
# 依赖
sudo apt-get install liblapack-dev libsuitesparse-dev libcxsparse3 libgflags-dev libgoogle-glog-dev libgtest-dev
# 编译
cd ceres-solver-1.14.0
mkdir build && cd build
cmake ..
make
sudo make install
# 查看版本
cat /usr/local/include/ceres/version.h
六、安装vins-mono
1、数据集下载
2、源码
mkdir -p /home/su/catkin_ws/src
cd catkin_ws/src
git clone https://github.com/HKUST-Aerial-Robotics/VINS-Mono
cd ../
catkin_make
source ~/catkin_ws/devel/setup.bash
3、运行
把下载好的数据集解压到 catkin_ws 目录下
打开三个终端(alt+T)分别输入命令
第一个终端:
source devel/setup.bash
roslaunch vins_estimator euroc.launch
第二个终端
source devel/setup.bash
roslaunch vins_estimator vins_rviz.launch
第三个终端
source devel/setup.bash
rosbag play MH_01_easy.bag
运行成功
七、参考文章
Ubuntu20.04——一篇文章让你从零配置VINS_Mono环境以及运行(2023年最新)
详细介绍如何在ubuntu20.04中安装ROS系统,超快完成安装(最新版教程)
Ubuntu20.04下运行VINS系列:VINS-Mono、VINS-Fusion和GVINS
解决编译VINS-Fusion出现的缺失local_parameterization.h报错
ERROR: default sources list file already exists: /etc/ros/rosdep/sources.list.d/20-default.list