完善launch文件,实现SLAM功能#3238
Merged
Merged
Conversation
donghaiwang
approved these changes
Dec 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修改概述: 完善launch文件,实现SLAM功能
修改的详细描述
添加 pointcloud_to_laserscan 节点,将CARLA激光雷达的PointCloud2数据转换为LaserScan格式
配置转换参数:高度范围、角度范围、扫描频率等
解决CARLA原生激光雷达与gmapping数据类型不兼容问题
配置 slam_gmapping 节点,实现实时2D SLAM建图
设置地图参数:分辨率(0.05m)、更新频率、扫描范围(50m)
配置坐标系变换:base_frame、odom_frame、map_frame
修正激光雷达话题映射:从 /carla/ego_vehicle/lidar/front/scan 改为 /carla/ego_vehicle/lidar
更新TF静态发布器,正确发布base_link到激光雷达的坐标变换
添加点云转换后的scan话题:/carla/ego_vehicle/scan
调整各节点启动延迟,确保依赖关系正确
CARLA ROS Bridge → Spawn Objects → Manual Control → PointCloud转换 → Gmapping
解决Python 3.13与CARLA 0.9.15不兼容问题(需使用Python 3.8环境)
配置PYTHONPATH以正确加载CARLA Python API
修复同步模式下传感器数据发布问题
经过了什么样的测试?
✅ CARLA与ROS Bridge连接测试
验证CARLA服务器正常运行(端口2000监听)
确认ROS Bridge成功连接并发布话题
✅ 传感器数据流测试
验证激光雷达数据发布频率:20 Hz
验证里程计数据发布频率:20 Hz
验证相机数据发布频率:20 Hz
验证时钟同步:20 Hz
✅ 点云转换功能测试
输入:/carla/ego_vehicle/lidar (PointCloud2格式)
输出:/carla/ego_vehicle/scan (LaserScan格式,20 Hz)
转换参数验证:角度范围(-π ~ π),距离范围(0.5m ~ 100m)
✅ SLAM建图功能测试
地图话题更新频率:0.5-2 Hz (正常)
手动控制车辆移动,实时观察地图生成
测试场景:CARLA Town01,覆盖道路、交叉路口、建筑区域
✅ RViz可视化测试
LaserScan点云实时显示(红色点云)
2D栅格地图实时更新(灰白色地图)
坐标系TF树正确显示
运行效果
动图、视频、截图等
Peek.2025-12-15.09-58.mp4