# W-SLAM+Mapping
###### tags: `ROS`
----
## SLAM架構
- [視覺SLAM漫談 : 研究點介紹](https://read01.com/zh-tw/Nyey77.html#.YW01KxpBxaQ)
- [SLAM學習之路#1 簡介](https://medium.com/@ckwang19/slam%E5%AD%B8%E7%BF%92%E4%B9%8B%E8%B7%AF-1-%E7%B0%A1%E4%BB%8B-1465bc319f3)
- [SLAM专题 (4)-- SLAM方法与技术架构](https://blog.csdn.net/hhaowang/article/details/102496691)
- [snesor data - 学习笔记——(一)SLAM分类](https://blog.csdn.net/bingoplus/article/details/53432919)
- [SLAM 教學ppt](http://ais.informatik.uni-freiburg.de/teaching/ss12/robotics/slides/12-slam.pdf)
- [frontend - 视觉SLAM中的前端:视觉里程计与回环检测](https://blog.csdn.net/sinat_17456165/article/details/106760600)
- [frontend - 直接法](https://www.cnblogs.com/gaoxiang12/p/5689927.html)
- [backend - 自駕車學習之路4](https://hsinchengchao.medium.com/%E8%87%AA%E9%A7%95%E8%BB%8A%E5%AD%B8%E7%BF%92%E4%B9%8B%E8%B7%AF4-5668b45cfb1c)
- [backend - graph slam tutorial : 从推导到应用1](https://blog.csdn.net/heyijia0327/article/details/47686523)
----
## 建圖相關網頁
- [Gmapping 應用詳解](https://blog.csdn.net/phenixyf/article/details/66529334)
- [How to Build an Indoor Map Using ROS and LIDAR-based SLAM](https://automaticaddison.com/how-to-build-an-indoor-map-using-ros-and-lidar-based-slam/)
- [Github - rplidar_ros](https://github.com/robopeak/rplidar_ros)
- [Github - hdl_graph_slam](https://github.com/koide3/hdl_graph_slam)
- [創客智能 - 3D-SLAM](https://www.ncnynl.com/archives/201702/1382.html)
### Velodyne 3D LiDar
- [Github - Velodyne](https://github.com/ros-drivers/velodyne)
- [ROS wiki - 3D LiDar_Velodyne](https://wiki.ros.org/velodyne)
- [ROS wiki - Velodyne VLP16 基礎操作](http://wiki.ros.org/velodyne/Tutorials/Getting%20Started%20with%20the%20Velodyne%20VLP16)
- [ROS wiki - velodyne_pointcloud](http://wiki.ros.org/velodyne_pointcloud#Examples)
- [ROS wiki - loam_velodyne](http://wiki.ros.org/loam_velodyne)
- [VLP-16配置及gmapping应用-基于ubuntu-ros-melodic](https://www.codenong.com/cs106225509/)
- [SLAM之鐳射雷達Velodyne vlp-16使用](https://www.itread01.com/content/1547352842.html)
#### VLP 16規格介紹
- [官方規格](https://www.amtechs.co.jp/product/VLP-16-Puck.pdf)
- [規格表2](https://pdf.directindustry.com/pdf/velodynelidar/vlp-16-datasheets/182407-676097.html)
- [雷達數據分析](https://www.cnblogs.com/wujianming-110117/p/13074172.html)
- [SLAM之鐳射雷達Velodyne vlp-16使用](https://www.itread01.com/content/1547352842.html)
## Velodyne VLP16
- 資料夾:~/catkin_velodyne/src/velodyne
- port setting
- IPv4 Method: Manual
- Address: 192.168.1.77
- Netmask: 255.255.255.0
- Gateway: 192.168.1.1
- IPv6 Method: Automatic
- 啟動指令
```
$ roslaunch velodyne_pointcloud VLP16_points.launch
$ rostopic echo /velodyne_points
$ rosrun rviz rviz -f velodyne
```
- [VLP-16 configuration and gmapping/loam application-based on ubuntu-ros-melodic](https://blog.titanwolf.in/a?ID=01700-ebd805a2-2d0a-4da5-aaa2-6badda31ddda)
----
## 建圖技術
### Velodyne Simulator
- [Github - velodyne_simulator](https://github.com/lmark1/velodyne_simulator)
- [ROS wiki - velodyne_simulator](http://wiki.ros.org/velodyne_simulator)
### Mapping
- [SLAM学习笔记(十九)开源3D激光SLAM总结大全——Cartographer3D,LOAM,Lego-LOAM,LIO-SAM,LVI-SAM,Livox-LOAM的原理解析及区别](https://www.cxyzjd.com/article/zkk9527/116160508)
- [学习笔记之——激光雷达SLAM(LOAM系列的复现与学习)](https://blog.csdn.net/gwplovekimi/article/details/119711762)
- ~~Octomap~~
### Cartographer
- 原始架構
- [Github - Cartographer](https://github.com/cartographer-project/cartographer)
- [Cartographer](https://google-cartographer.readthedocs.io/en/latest/)
- [Cartographer ROS Integration](https://google-cartographer-ros.readthedocs.io/en/latest/index.html#)
- 架構解析
- [cartographer算法(一)——概述及框架](https://www.guyuehome.com/33206)
- 實作
- [实战适配-使用cartographer和三维激光雷达-VLP16-进行三维建图](https://sunjiadai.xyz/blog/2019/01/20/%E5%AE%9E%E6%88%98%E9%80%82%E9%85%8D-%E4%BD%BF%E7%94%A8cartographer%E5%92%8C%E4%B8%89%E7%BB%B4%E6%BF%80%E5%85%89%E9%9B%B7%E8%BE%BE-VLP16-%E8%BF%9B%E8%A1%8C%E4%B8%89%E7%BB%B4%E5%BB%BA%E5%9B%BE/)
- [SLAM建图与自主避障导航——2.google-cartographer机器人SLAM建图](https://zhuanlan.zhihu.com/p/64747755)
### LOAM
- 原始架構
- [Github - loam_velodyne](https://github.com/laboshinl/loam_velodyne)
- 架構解析
- [LOAM-SLAM原理深度解析](https://zhuanlan.zhihu.com/p/111388877)
- [LOAM原始碼分析附公式推導](https://zhuanlan.zhihu.com/p/263090394)
### LeGO-LOAM
- 原始架構
- [Github - LeGO-LOAM](https://github.com/RobustFieldAutonomyLab/LeGO-LOAM)
- 實作
- [LeGO-LOAM初探:原理,安装和测试](https://blog.csdn.net/learning_tortosie/article/details/86527542)
----
### 安裝問題
#### LeGO_loam
- [Github - neor_mini](https://github.com/COONEO/neor_mini)
- [手把手教你Velodyne Lidar仿真+3D建图](https://zhuanlan.zhihu.com/p/395515892)
- [从0.3开始搭建LeGO-LOAM+VLP雷达+小车实时建图(保姆级教程,小白踩坑日记)(一:编译算法前的准备)](https://zhuanlan.zhihu.com/p/357020888)
- [Github - SLAM with Velodyne Lidar and Jackal UGV](https://github.com/ChengeYang/SLAM-with-Velodyne-Lidar-and-Jackal-UGV)
----
#### LOAM
- [Loam的编译安装运行及可能遇到的问题](https://blog.csdn.net/qq_36396941/article/details/82973772?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link)
- [LOAM编译及遇到的问题](https://www.codenong.com/cs109705123/)
- [Ubuntu20.04 loam_velodyne编译运行](https://blog.csdn.net/weixin_43095006/article/details/109748964)
- [loam_velodyne 编译与数据集运行](https://zhuanlan.zhihu.com/p/398559084)
- [Loam:Ubuntu20.04下的编译与运行](https://www.icode9.com/content-3-1015810.html)
- multiScanRegistration Error:將CMakeList.txt中add_definitions( -march=native ) 刪除即可
- [loam_velodyne failed #71 ](https://github.com/laboshinl/loam_velodyne/issues/71)
- 修改LaserMapping.cpp, LaserOdomertyr.cpp, TransformMaintenance.cpp这三个文件中的“/camera_int”为“camera_init”
##### install pcl
- make pcl一直過不了,要將CMAKE_BUILD_TYPE=Release,才過得了
- 在PCL1.8中,没有pcl_ros 和pcl_conversions,要自行安裝下載
- [ubuntu18.04 bionic安裝pcl1.8](https://www.twblogs.net/a/5d3f79eabd9eee51fbf925e7)
- [ubuntu20.04安裝pcl的詳細步驟及踩過的坑](https://www.cnblogs.com/linzzz98/p/13746949.html)
- [ubuntu20.04安装pcl](https://blog.csdn.net/qq_41092406/article/details/117930972)
- [学习笔记——Ubuntu20.04部分软件及插件安装指南](https://zhuanlan.zhihu.com/p/398453564)
- [PCL Build Error: undefined reference to boost date_time library](https://githubmemory.com/repo/PointCloudLibrary/pcl/issues/4995)
##### pcl_ros 和pcl_conversions安裝
```
sudo apt-get install ros-noetic-pcl-conversions
sudo apt-get install ros-noetic-pcl-ros
```
##### 依賴包下載及卸載指令
- 卸載
```
sudo apt remove libpcl-dev
```
- 安裝依賴包
```
sudo apt-get update
sudo apt-get install git build-essential linux-libc-dev
sudo apt-get install cmake cmake-gui
sudo apt-get install libusb-1.0-0-dev libusb-dev libudev-dev
sudo apt-get install mpi-default-dev openmpi-bin openmpi-common
sudo apt-get install libflann1.8 libflann-dev
sudo apt-get install libeigen3-dev
sudo apt-get install libboost-all-dev
sudo apt-get install libvtk5.10-qt4 libvtk5.10 libvtk5-dev
sudo apt-get install libqhull* libgtest-dev
sudo apt-get install freeglut3-dev pkg-config
sudo apt-get install libxmu-dev libxi-dev
sudo apt-get install mono-complete
sudo apt-get install qt-sdk openjdk-8-jdk openjdk-8-jre
```
- 有問題
- sudo apt-get install libflann1.8 libflann-dev
- sudo apt-get install libflann-dev
- sudo apt-get install libvtk5.10-qt4 libvtk5.10 libvtk5-dev
- sudo apt-get install libvtk6-dev
- sudo apt-get install qt-sdk openjdk-8-jdk openjdk-8-jre
- sudo apt-get install openjdk-8-jdk
---9阿
#### Cartographer
- 安裝步驟
1. 安裝工具
```
sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build
```
2. 初始化工作空間
```
cd catkin_gogle_ws
wstool init src
```
3. 加入cartographer_ros.rosinstall並更新依賴
```
wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall
wstool update -t src
```
4. 安裝依賴並下載cartographer相關功能包
```
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
```
5. 編譯並安裝
```
catkin_make_isolated --install --use-ninja
source install_isolated/setup.bash
```
- [安装cartographer,找不到 "absl" 解决方法](https://zhuanlan.zhihu.com/p/266550407)
----
## LOAM
- 啟動指令
```
roslaunch loam_velodyne loam_velodyne.launch
```
- 二選一
```
rosbag play ~/Downloads/velodyne.bag
roslaunch velodyne_pointcloud VLP16_points.launch pcap:="$HOME/Downloads/velodyne.pcap"
```
- [儲存pointcloud](https://blog.csdn.net/qq_36396941/article/details/83048415)
### 問題
- pcap error
```
[ WARN] [1636267583.891336868]: Packet containing angle overflow, first angle: 35944 second angle: 24
[ WARN] [1636267622.436490351]: skipping invalid VLP-16 packet: block 4 header value is 0
```
- rqt_graph
- 看目前topic的架構
- rosrun tf view_frames && evince frames.pdf
- [tf](http://wiki.ros.org/tf)
- [TypeError: cannot use a string pattern on a bytes-like object](https://github.com/ros/geometry/pull/193)
- topic
- /aft_mapped_to_init /laser_cloud_surf_last
/clicked_point /laser_cloud_surround
/clock /laser_odom_to_init
/imu/data /move_base_simple/goal
/imu_trans /rosout
/initialpose /rosout_agg
/integrated_to_init /tf
/laser_cloud_corner_last /tf_static
/laser_cloud_flat /velodyne_cloud_2
/laser_cloud_less_flat /velodyne_cloud_3
/laser_cloud_less_sharp /velodyne_cloud_registered
/laser_cloud_sharp /velodyne_points
---
## Cartographer
### 啟動指令
- 一定要有這兩行不然會報錯
```
source devel/setup.bash
source install_isolated/setup.bash
```
- 3D SLAM demo
```
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/b3-2016-04-05-14-14-00.bag
roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=${HOME}/Downloads/b3-2016-04-05-14-14-00.bag
```
### VLP-16
- [VLP16+IMU+Cartographer+Ubuntu18.04+ROS Melodic使用](https://blog.csdn.net/sinat_28958127/article/details/107486550)
- [SLAM学习笔记(十八)3D激光SLAM——Cartographer第一视角点云可视化配置与使用方法(最新](https://blog.csdn.net/zkk9527/article/details/115657629?spm=1001.2014.3001.5501)
- 3d topic
- /clicked_point /imu /map /scan_matched_points2 /trajectory_node_list
/clock /initialpose /move_base_simple/goal /submap_list /vertical_laser_3d
/constraint_list /joint_states /rosout /tf
/horizontal_laser_3d /landmark_poses_list /rosout_agg /tf_static