天天看點

雷射SLAM—谷歌開源項目複現雷射SLAM—谷歌開源項目複現1.首先安裝ceres solver,選擇的版本是1.11,路徑随意

雷射SLAM—谷歌開源項目複現

文章引用hitcm的博文

博文内容是:

https://www.cnblogs.com/hitcm/p/5939507.html

創客制造上面講的更加詳細:

https://www.ncnynl.com/archives/201612/1166.html

0.安裝所有依賴項

如果運作環境是 Ubuntu 16.04 + kinetic,請在建立終端中輸入:

sudo apt-get install -y google-mock libboost-all-dev libeigen3-dev libgflags-dev libgoogle-glog-dev liblua5.2-dev libprotobuf-dev libsuitesparse-dev libwebp-dev ninja-build protobuf-compiler python-sphinx ros-kinetic-tf2-eigen libatlas-base-dev libsuitesparse-dev liblapack-dev

如果運作環境是 Ubuntu 14.04 + indigo,請在建立終端中輸入:

sudo apt-get install -y google-mock libboost-all-dev libeigen3-dev libgflags-dev libgoogle-glog-dev liblua5.2-dev libprotobuf-dev libsuitesparse-dev libwebp-dev ninja-build protobuf-compiler python-sphinx ros-indigo-tf2-eigen libatlas-base-dev libsuitesparse-dev liblapack-dev

此外,需要安裝3個軟體包,ceres solver、cartographer和cartographer_ros,為了管理友善,建立carto目錄來存放ceres solver、cartographer。

1.首先安裝ceres solver,選擇的版本是1.11,路徑随意

  1. 第一步: 下載下傳該安裝包 git clone https://github.com/hitcm/ceres-solver-1.11.0.git
  2. 第二步: cd carto/ceres-solver-1.11.0/build //切換到該目錄下,沒有build檔案夾就建立一個
  3. 第三步: cmake …
  4. 第四步: make –j
  5. 第五步: sudo make install

2.然後安裝 cartographer

  1. 第一步: cd ~/carto
  2. 第二步: git clone https://github.com/hitcm/cartographer.git
  3. 第三步: cd cartographer/build //切換到該目錄下,沒有build檔案夾就建立一個
  4. 第四步: cmake … -G Ninja #3
  5. 第五步: ninja
  6. 第六步: ninja test
  7. 第七步: sudo ninja install

上述第三步執行錯誤的同學可以忽略四—七步,改用下面的方法。

  1. cmake …
  2. make
  3. sudo make install

3.安裝cartographer_ros

下載下傳到catkin_ws下面的src檔案夾下面

git clone https://github.com/hitcm/cartographer_ros.git

然後到catkin_ws下面運作

$ catkin_make

新包加入環境

$ source ~/.bashrc

$ rospack profile

4.資料下載下傳測試

資料下載下傳測試, 并上傳到carto目錄下。

2d資料,大概500M,用迅雷下載下傳

https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag

3d資料,8G左右,同樣用迅雷下載下傳

https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/cartographer_3d_deutsches_museum.bag

然後2/3d的資料,對應運作launch檔案即可,bag_filename路徑最好從新指定,

我的是:

roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=/home/robot//carto/cartographer_paper_deutsches_museum.bag

以下是2/3d的路徑:

roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:={$HOME}/carto/cartographer_paper_deutsches_museum.bag
roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:={$HOME}/carto/cartographer_3d_deutsches_museum.bag

剛開始使用ROS的同學運作下面兩句是無法工作的,可能出現的錯誤如下。

[demo_backpack_2d.launch] is neither a launch file in package [cartographer_ros] nor is [cartographer_ros] a launch file name

The traceback for the exception was written to the log file

這種錯誤的主要原因是ros的catkin_ws配置問題,可以運作rospack profile試試。

實在不行還有如下所示的兩種解決方法。推薦第二種。

雷射SLAM—谷歌開源項目複現雷射SLAM—谷歌開源項目複現1.首先安裝ceres solver,選擇的版本是1.11,路徑随意

繼續閱讀