本文主要是介绍Ubuntu18.04运行Vins-Fusion,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
目录
一. 安装ros
1. Installation
2. Environment setup
3. Dependencies for building packages
4. 安装ros与opencv的桥接工具包
5.验证ros是否安装成功
二. 安装eigen
三. 安装opencv
1. 进入下载opencv的根目录
四. 安装ceres
1. 安装ceres依赖项
2. 进入Ceres的主目录,编译Ceres
五. 编译Vins-Fusion
1. 创建ros工作空间
2. 编译VINS-Fusion
3. 至此VINS-Fusion编译完成,后面需要打开四个shell窗口分别运行ros命令,为了避免每次打开新的shell都需要source,我们将其添加到bash配置文件中
4. 下载EuRoc数据集
5. 运行VINS-Fusion
Monocualr camera + IMU
Stereo cameras + IMU
Stereo cameras
六. 运行效果
一. 安装ros
不同的ubuntu版本对应不同版本的ros,具体可查询ros官网
http://wiki.ros.org/ROS/Installation
ubuntu16.04以及更老的版本对应ROS Kinetic Kame
ubuntu18.04对应ROS Melodic Morenia
ubuntu20.04对应ROS Noetic Ninjemys
下面开始安装ROS Melodic,详细安装教程可以参考下面的官网连接:
http://wiki.ros.org/melodic/Installation/Ubuntu
1. Installation
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) 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-melodic-desktop-full
2. Environment setup
If you have more than one ROS distribution installed, ~/.bashrc must only source the setup.bash for the version you are currently using.
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
3. Dependencies for building packages
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
sudo apt install python-rosdep
sudo rosdep init
rosdep update
4. 安装ros与opencv的桥接工具包
sudo apt-get install ros-melodic-cv-bridge ros-melodic-tf ros-melodic-message-filters ros-melodic-image-transport
5.验证ros是否安装成功
roscore
二. 安装eigen
sudo apt-get install libeigen3-dev
三. 安装opencv
下载opencv源码:
https://github.com/opencv/opencv
如果没有安装cmake,需要先安装cmake
sudo apt-get install cmake
sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg.dev libtiff4.dev libswscale-dev libjasper-dev
1. 进入下载opencv的根目录
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
sudo make install
四. 安装ceres
下载ceres源码:
https://github.com/ceres-solver/ceres-solver
1. 安装ceres依赖项
sudo apt-get install liblapack-dev
sudo apt-get install libsuitesparse-dev
sudo apt-get install libcxsparse3.1.2
sudo apt-get install libgflags-dev
sudo apt-get install libgoogle-glog-dev libgtest-dev
安装libcxsparse3.1.2有可能找不到安装源,可参考如下解决:
sudo vi /etc/apt/sources.list
文件最后一行添加镜像源:deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse
sudo apt-get update
2. 进入Ceres的主目录,编译Ceres
mkdir build
cd build
cmake ..
sudo make install
五. 编译Vins-Fusion
1. 创建ros工作空间
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
2. 编译VINS-Fusion
cd ~/catkin_ws/src
git clone https://github.com/HKUST-Aerial-Robotics/VINS-Fusion.git
cd ../
catkin_make
source ~/catkin_ws/devel/setup.bash
3. 至此VINS-Fusion编译完成,后面需要打开四个shell窗口分别运行ros命令,为了避免每次打开新的shell都需要source,我们将其添加到bash配置文件中
sudo vi ~/.bashrc
最后一行添加:source ~/catkin_ws/devel/setup.bash
保存,退出
4. 下载EuRoc数据集
https://projects.asl.ethz.ch/datasets/doku.php?id=kmavvisualinertialdatasets#the_euroc_mav_dataset
我们以MH_04_difficult.bag为例,将其下载并保存在目录~/SLAM/test_data/
5. 运行VINS-Fusion
以单相机+IMU为例,分别打开四个shell窗口,运行命令
窗口1:
roslaunch vins vins_rviz.launch
窗口2:
rosrun vins vins_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_mono_imu_config.yaml
窗口3(可选择运行,执行回环检测):
(optional) rosrun loop_fusion loop_fusion_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_mono_imu_config.yaml
窗口4:
rosbag play ~/SLAM/test_data/MH_04_difficult.bag
Monocualr camera + IMU
roslaunch vins vins_rviz.launch
rosrun vins vins_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_mono_imu_config.yaml
(optional) rosrun loop_fusion loop_fusion_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_mono_imu_config.yaml
rosbag play ~/SLAM/test_data/MH_04_difficult.bag
Stereo cameras + IMU
roslaunch vins vins_rviz.launch
rosrun vins vins_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_stereo_imu_config.yaml
(optional) rosrun loop_fusion loop_fusion_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_stereo_imu_config.yaml
rosbag play ~/SLAM/test_data/MH_04_difficult.bag
Stereo cameras
roslaunch vins vins_rviz.launch
rosrun vins vins_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_stereo_config.yaml
(optional) rosrun loop_fusion loop_fusion_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_stereo_config.yaml
rosbag play ~/SLAM/test_data/MH_04_difficult.bag
六. 运行效果
这篇关于Ubuntu18.04运行Vins-Fusion的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!