ROS2与3D-SLAM入门教程-lidarslam_ros2算法建图
ROS2与3D-SLAM入门教程-lidarslam_ros2算法建图
说明:
- 介绍如何利用lidarslam_ros2算法实现3D建图
- 测试环境:ubuntu20.04 + ros2 galactic
步骤:
- 下载源码
mkdir -p ~/ros2_slam_3d_ws/src
cd ~/ros2_slam_3d_ws/src
git clone --recursive https://github.com/rsasaki0109/lidarslam_ros2
- 编译
cd ~/ros2_slam_3d_ws
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
测试:
- 如果使用ros1录制的包来测试,可以下载ros1bag hdl_400.bag
- 这个包需要安装ros2 bag的插件rosbag2_bag_v2进行转换, 参考方法ros2入门教程-rosbag和ros2 bag 转换
- 新终端, 打开rviz
source /opt/ros/galactic/setup.bash
cd ~/ros2_slam_3d_ws/
rviz2 -d src/lidarslam_ros2/lidarslam/rviz/mapping.rviz
- 新终端,启动lidarslam_ros2
source /opt/ros/galactic/setup.bash
cd ~/ros2_slam_3d_ws/
ros2 launch lidarslam lidarslam.launch.py
- 新终端,播放包
$ source /opt/ros/noetic/setup.bash
$ source /opt/ros/galactic/setup.bash
$ ros2 bag info -s rosbag_v2 dataset/hdl_400.bag
- 效果图
- 保存map.pcd和pose_graph.g2o, 保存的目录为运行lidarslam.launch.py的目录
- 目前是在~/ros2_slam_3d_ws/目录下运行
cd ~/ros2_slam_3d_ws/
ros2 service call /map_save std_srvs/Empty
- 打开pcd
- 如果没pcl_viewer,既需安装
sudo apt install libpcl-dev pcl-tools
- 打开
cd ~/ros2_slam_3d_ws/
pcl_viewer map.pcd
- 效果图
参考:
- https://github.com/rsasaki0109/lidarslam_ros2
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号