robotsense rslidar_16转为2维laser在ubuntu20.04下实现cartographer_2d建图

本文档详细介绍了在Ubuntu20.04上安装Cartographer并进行激光SLAM的步骤,包括编译Cartographer包、实现point_to_laserscan转换、配置Cartographer建图以及解决运行中遇到的问题。主要涉及点云到激光扫描的转换、修改launch文件和lua配置文件,以及通过rviz和rosbag进行结果展示和地图保存。

1、编译安装cartographer包

这个安装cartographer包网上教程很多,这里不详细描述,可以参考这篇博客https://blog.youkuaiyun.com/qq_26482237/article/details/92676267

2、实现point_to_laserscan转换

参考我这篇博客的第二段
https://blog.youkuaiyun.com/linxiangup/article/details/114916828?spm=1001.2014.3001.5501
主要的point_to_scan.launch文件如下

<?xml version="1.0"?>
 
<launch>
 
    <!-- run pointcloud_to_laserscan node -->
    <node pkg="pointcloud_to_laserscan" type="pointcloud_to_laserscan_node" name="pointcloud_to_laserscan">
 
        <remap from="cloud_in" to="rslidar_points"/>
        <remap from="scan" to="scan"/>
        <rosparam>
            # target_frame: rslidar # Leave disabled to output scan in pointcloud frame
            transform_tolerance: 0.01
            min_height: -0.4
            max_height: 1.0
 
            angle_min: -3.1415926 # -M_PI
            angle_max: 3.1415926 # M_PI
            angle_increment: 0.003 # 0.17degree
            scan_time: 0.1
            range_min: 0.2
            range_max: 100
            use_inf: true
            inf_epsilon: 1.0
 
            
### Ubuntu 20.04 上使用 TurtleBot2Cartographer 进行 SLAM 对于希望在Ubuntu 20.04上利用TurtleBot2Cartographer实现SLAM的开发者而言,重要的是理解不同组件之间的兼容性和配置方法。由于Ubuntu 20.04支持ROS Noetic版本[^1],因此所有操作都将基于此环境。 #### 安装 ROS Noetic 并设置工作空间 确保已经成功安装了ROS Noetic,并创了一个新的Catkin工作区用于后续开发: ```bash sudo apt update && sudo apt install ros-noetic-desktop-full source /opt/ros/noetic/setup.bash mkdir -p ~/catkin_ws/src cd ~/catkin_ws/ catkin_make source devel/setup.bash ``` #### 安装并配置 TurtleBot2 软件包 为了使TurtleBot2能够在ROS环境中正常运行,需下载官方提供的软件包集合: ```bash git clone https://github.com/turtlebot/turtlebot.git src/turtlebot git clone https://github.com/turtlebot/turtlebot_apps.git src/turtlebot_apps git clone https://github.com/turtlebot/turtlebot_interactions.git src/turtlebot_interactions git clone https://github.com/turtlebot/turtlebot_simulator.git src/turtlebot_simulator ``` 之后编译整个项目以确保所有依赖项都已解决: ```bash rosdep install --from-paths src --ignore-src -r -y catkin_make ``` #### 配置 Cartographer 接下来获取Cartographer及其对应的ROS接口库,并将其集成到现有的Catkin工作区内: ```bash cd ~/catkin_ws/src vcs import < turtlebot_cartographer.repos ``` 完成上述命令后再次执行`catkin_make`来构更新后的源码树结构。 #### 启动与测试 一切准备就绪后可以尝试启动完整的导航堆栈以及Cartographer节点来进行实时地绘制实验: ```bash roslaunch turtlebot_bringup minimal.launch roslaunch turtlebot_navigation amcl_demo.launch map_file:=<path_to_map> roslaunch turtlebot_cartographer demo_2d.launch ``` 通过RViz可视化工具观察机器人运动轨迹及所生成的地效果。
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值