ubuntu16.04搭建SLAM开发环境
参考博客
[博客链接]:
https://blog.csdn.net/qq_38373843/article/details/82792720
1. Eigen线性代数库
- apt安装
sudo apt-get install libeigen3-dev
sudo updatedb
locate eigen3
- 源码安装
直接官网下载安装包,安装
Eigen3安装包下载网址:Eigen3.3.6安装包
# 解压
unzip eigen3.3.6
# 移动eigen3.3.6到/usr/local/include并改名
sudo mv eigen3.3.6 /usr/local/include/eigen3
# 复制eigen3中的头文件到include下
sudo cp -r /usr/local/include/eigen3/Eigen /usr/local/include
# 将/usr/local/include/eigen3/cmake/FindEigen3.cmake文件复制到/usr/share/cmake-3.5/Modules/对应目录下
sudo cp /usr/local/include/eigen3/cmake/FindEigen3.cmake /usr/share/cmake-3.5/Modules
- 应用
#在CMakeLists.txt文件中添加Eigen头文件的目录
include_directories("/usr/include/eigen3")
2. Opencv开源视觉库
-
安装依赖库
sudo apt-get install build-essential libgtk2.0-dev libvtk5-dev libjpeg-dev libtiff5-dev libjasper-dev libopenexr-dev libtbb-dev
sudo apt install libtiff5-dev
- 解压安装
unzip opencv-3.4.0
cd opencv-3.4.0
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j2
sudo make install
- 应用
# 在CMakeLists.txt中添加
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
3. Sophus李代数库
- 下载
git clone http://github.com/strasdat/Sophus.git
cd Sophus
git checkout a621ff
- 编译安装
mkdir build
cd build
cmake ..
make -j2
sudo make install
- 应用
# 在CMakeLists.txt中添加
find_package( Sophus REQUIRED )
include_directories( ${Sophus_INCLUDE_DIRS} )
4. Ceres-Solver非线性优化库
- 安装依赖项
# 安装1.14版本,以便于eigen兼容
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.git
cd ceres-solver
mkdir build
cd build
cmake ..
make -j2
sudo make install
- 应用
# 首先将文件夹cmake_modules复制到工程文件夹下,然后在CMakeLists.txt中添加
list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules )
find_package( Ceres REQUIRED )
include_directories( ${CERES_INCLUDE_DIRS} )
- 卸载
sudo rm -rf /usr/local/include/ceres /usr/local/lib/libceres.a
5. g2o图优化库
- 安装依赖库
# 下载该版本g2o-20200410
sudo apt-get install libqt4-dev qt4-qmake libqglviewer-dev libsuitesparse-dev libcxsparse3.1.4 libcholmod3.0.6
- 编译安装
git clone https://github.com/RainerKuemmerle/g2o.git
cd g2o
mkdir build
cd build
cmake ..
make -j2
sudo make install
- 应用
# 首先将文件夹cmake_modules复制到工程文件夹下,然后在CMakeLists.txt中添加
list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules )
find_package( G2O REQUIRED )
include_directories(
${G2O_INCLUDE_DIRS}
"/usr/include/eigen3"
)
6. PCL点云库
- 安装pcl-1.7
sudo apt-get install libpcl-dev pcl-tools
- 应用
# 在CMakeLists.txt中添加
find_package( PCL REQUIRED COMPONENT common io )
include_directories( ${PCL_INCLUDE_DIRS} )
add_definitions( ${PCL_DEFINITIONS} )
7. Pangolin三维显示库
- 安装依赖项
sudo apt-get install libglew-dev libboost-dev libboost-thread-dev libboost-filesystem-dev
- 编译安装
git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
mkdir build
cd build
cmake -DCPP11_NO_BOOST= 1 ..
make -j2
sudo make install
8. 安装IDE—VScode
-
下载
VScode官网: 下载64位 .deb格式的文件. -
安装并启动
# 安装.deb文件
sudo dpkg -i code_1.44.1-1586789296_amd64.deb
# 启动VScode
code
- 安装官方插件
# 启动后可以在VScode里面安装插件: 汉化, C/C++, Python等.
后续计划
后续进行pytorch的学习!!!