纯净ubuntu18.04 安装SLAM & ROS

视觉SLAM所需库

# 卸载libreoffice
sudo apt remove --purge libreoffice*
# 修改apt源为中科大源
sudo gedit /etc/apt/sources.list
# 替换为
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

sudo gedit /etc/hosts
# 添加
	140.82.113.3 github.com
	199.232.69.194 github.global.ssl.fastly.net
	151.101.84.133 raw.githubusercontent.com
# 更新缓存
sudo /etc/init.d/networking restart
sudo apt update
sudo apt-get install git vim gcc cmake
sudo apt-get install autotools-dev ccache doxygen dh-autoreconf git liblapack-dev libblas-dev libgtest-dev libreadline-dev libssh2-1-dev pylint 

# 下载《视觉SLAM2》程序
cd ~
mkdir SLAM
cd SLAM
git clone https://github.com/gaoxiang12/slambook2
# 下载第三方库
cd slambook2/3rdparty/
rm -rf *
git clone https://github.com/rmsalinas/DBow3.git
git clone https://github.com/stevenlovegrove/Pangolin.git
git clone https://github.com/strasdat/Sophus.git
git clone https://github.com/ceres-solver/ceres-solver.git
git clone https://github.com/RainerKuemmerle/g2o.git
git clone https://github.com/google/googletest.git

sudo apt-get install libeigen3-dev libgl1-mesa-dev libglew-dev libpython2.7-dev pkg-config ffmpeg libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libavdevice-dev libdc1394-22-dev libraw1394-dev
# 安装Pangolin
cd Pangolin/
mkdir build
cd build
cmake ..
make
sudo make install
# 安装sophus
cd ../..
cd Sophus/
mkdir build
cd build
cmake ..
make
sudo make install
# 安装opencv3.4
cd ../..
git clone https://gitee.com/zhi-kai/opencv.git
sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff5-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev liblapacke-dev libxvidcore-dev libx264-dev  libatlas-base-dev gfortran ffmpeg
cd opencv
mkdir build
cd build
cmake ..
make -j2
sudo make install
# 安装ceres
cd ../..
sudo apt-get install liblapack-dev libsuitesparse-dev libcxsparse3 libgflags-dev libgoogle-glog-dev libgtest-dev
cd ceres-solver/
mkdir build
cd build
cmake ..
make -j2
sudo make install
# 安装g2o
cd ../..
cd g2o/
sudo apt-get install qt5-qmake qt5-default libqglviewer-dev-qt5 libsuitesparse-dev libcxsparse3 libcholmod3
mkdir build
cd build
cmake ..
make -j2
sudo make install
# 安装DBow3
cd ../..
cd DBow3/
mkdir build
cd build
cmake ..
make -j2
sudo make install
# 安装PCL点云库
sudo apt-get install libpcl-dev pcl-tools
# 安装octomap
sudo apt-get install liboctomap-dev octovis
# 安装googletest
cd ../..
cd googletest/
mkdir build
cd build
cmake ..
make -j2
sudo make install
cd ~

安装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-melodic-desktop-full
sudo apt install python-rosdep
sudo rosdep init
rosdep update
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential

你可能感兴趣的:(ROS)