参考网址:
  xiangli0608/Creating-2D-laser-slam-from-scratch: 从零开始创建二维激光SLAM (github.com) 
 李想的博客_李太白lx_CSDN博客-从零开始搭二维激光SLAM,激光SLAM,cartographer领域博主 
 (105条消息) 在linux ubuntu18.04版本中安装ceres solver_YMWM_的博客-CSDN博客_linux 安装ceres 
 (105条消息) 在Ubuntu16.04下安装Ceres_江南古镇的博客-CSDN博客_ceres安装 
 (105条消息) ubuntu16.04安装g2o_slzlincent的博客-CSDN博客_安装g2o 
 (105条消息) 【已解决】error: no matching function for call to ‘g2o::BlockSolver…_Bungehurst-CSDN博客 
环境搭建
- melodic
 
- ceres
 
- g2o
 
- gtsam
 
- ubuntu18
 
ubuntu18安装ros1
1 2 3 4 5 6 7 8 9
   | sudo nano /etc/apt/sources.list.d/ros-latest.list deb https://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ bionic main sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 sudo apt update sudo apt-get install ros-melodic-desktop-full # 初始化 sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential sudo echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc source ~/.bashrc
   | 
 
使用小于解决rosdep问题
1
   | wget http://fishros.com/install -O fishros && sudo bash fishros
   | 
 
下载github并安装必要库
1
   | get clone https://ghproxy.com/https://github.com/xiangli0608/Creating-2D-laser-slam-from-scratch
   | 
 
ceres安装
依赖安装
1 2 3 4 5 6 7 8 9
   | sudo apt-get install cmake sudo apt-get install libgoogle-glog-dev sudo apt-get install libatlas-base-dev sudo apt-get install libeigen3-dev sudo apt-get install libsuitesparse-dev sudo apt-get install libgtest-dev sudo add-apt-repository ppa:bzindovic/suitesparse-bugfix-1319687 sudo apt-get update sudo apt-get install libsuitesparse-dev
   | 
 
安装
1 2 3 4 5 6
   | cd Creating-2D-laser-slam-from-scratch/TrirdParty/ceres-solver-1.13.0 mkdir build cd build cmake .. make -j make install
   | 
 
g2o安装
1 2 3 4 5 6 7 8 9 10 11 12
   | git clone https://github.com/RainerKuemmerle/g2o.git sudo apt-get install libeigen3-dev sudo apt-get install libsuitesparse-dev sudo apt-get install qtdeclarative5-dev sudo apt-get install qt5-qmake sudo apt-get install libqglviewer-dev cd g2o mkdir build cd build cmake .. make -j make install
   | 
 
gtsam安装
1 2 3 4 5 6
   | cd Creating-2D-laser-slam-from-scratch/TrirdParty/gtsam mkdir build cd build cmake .. make -j make install
   | 
 
修改源文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
   | 
  G2oSolver::G2oSolver() {      SlamLinearSolver *linearSolver = new SlamLinearSolver();   linearSolver->setBlockOrdering(false);      SlamBlockSolver *blockSolver = new SlamBlockSolver(std::unique_ptr<SlamLinearSolver>(linearSolver));   linearSolver->setBlockOrdering(true);      g2o::OptimizationAlgorithmLevenberg *solver =       new g2o::OptimizationAlgorithmLevenberg(std::unique_ptr<SlamBlockSolver>(blockSolver));      mOptimizer.setAlgorithm(solver); }
 
 
 
  | 
 
编译
1 2 3 4
   | mkdir -p catkin_ws/src cd catkin_ws/src git clone https://ghproxy.com/https://github.com/xiangli0608/Creating-2D-laser-slam-from-scratch cd .. && catkin_make
   |