gazebo仿真环境下cartographer应用建图(融合odom和scan) 一、环境说明ros1 noetic版本仿真环境为turtlebot3_house.world下图为笔者自己搭建的丑陋小车二、配置2.1、文章参考可以参考笔者上篇文章快速配置。链接:Turtlebot3gazebo仿真cartographer建图踩坑经验分享2.2、.lua 代码my_car/config/turtlebot3_lds_2d_gazebo.lua代码如下-- Copyright 2016 The Cartographer Authors---- Licensed under the Apache License, Version 2.0 (the License);-- you may not use this file except in compliance with the License.-- You may obtain a copy of the License at---- http://www.apache.org/licenses/LICENSE-2.0---- Unless required by applicable law or agreed to in writing, software-- distributed under the License is distributed on an AS IS BASIS,-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.-- See the License for the specific language governing permissions and-- limitations under the License.includemap_builder.luaincludetrajectory_builder.luaoptions{map_builderMAP_BUILDER,trajectory_builderTRAJECTORY_BUILDER,map_framemap,tracking_framebase_footprint,-- imu_link, If you are using gazebo, use base_footprint (libgazebo_ros_imus bug)published_frameodom,odom_frameodom,provide_odom_framefalse,publish_frame_projected_to_2dfalse,use_odometrytrue,use_nav_satfalse,use_landmarksfalse,num_laser_scans1,num_multi_echo_laser_scans0,num_subdivisions_per_laser_scan1,num_point_clouds0,lookup_transform_timeout_sec0.2,submap_publish_period_sec0.3,pose_publish_period_sec5e-3,trajectory_publish_period_sec30e-3,rangefinder_sampling_ratio1.,odometry_sampling_ratio1.,fixed_frame_pose_sampling_ratio1.,imu_sampling_ratio1.,landmarks_sampling_ratio1.,}MAP_BUILDER.use_trajectory_builder_2dtrueTRAJECTORY_BUILDER_2D.min_range0.1TRAJECTORY_BUILDER_2D.max_range3.5TRAJECTORY_BUILDER_2D.missing_data_ray_length3.TRAJECTORY_BUILDER_2D.use_imu_datafalse#笔者只改了这里把imu关掉 TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matchingtrueTRAJECTORY_BUILDER_2D.motion_filter.max_angle_radiansmath.rad(0.1)POSE_GRAPH.constraint_builder.min_score0.65POSE_GRAPH.constraint_builder.global_localization_min_score0.7returnoptions注意笔者这部分的代码是直接复制的turtlebot3/turtlebot3_slam/config/turtlebot3_lds_2d_gazebo.lua只把imu关掉了如上代码的中文注释部分为什么要把imu关掉呢turtlebot3官方建图融合的是odom、scan、imu但是turtlebot3的launch文件里多启动了一个turtlebot3/turtlebot3_slam/src/flat_world_imu_node.cpp节点这个节点大家可以自行研究不启动这个节点建图就会报错笔者目前能力有限暂时调过这个节点把imu关掉只融合odom和scan2.3、launch代码启动次文件前需要启动你的gazebo环境并检查tf链是否正确文件my_car/launch/new_cartographer.launch代码如下launchargnameconfiguration_basenamedefaultturtlebot3_lds_2d_gazebo.lua/!-- cartographer_node --nodepkgcartographer_rostypecartographer_nodenamecartographer_nodeargs-configuration_directory $(find my_car)/config -configuration_basename $(arg configuration_basename)outputscreen/node!-- cartographer_occupancy_grid_node --nodepkgcartographer_rostypecartographer_occupancy_grid_nodenamecartographer_occupancy_grid_nodeargs-resolution 0.05//launchrviz需在单独在一终端另行启动2.4、启动通用键盘控制节点rosrun teleop_twist_keyboard teleop_twist_keyboard.py当然如果你对move_base足够熟练可以用move_base需自行添加这样建图只需要简单鼠标点几下就可以了三、建图结果如下

相关新闻

最新新闻

如何优化ActionSheet交互体验:Wot Design Uni组件库的3个关键改进

如何优化ActionSheet交互体验:Wot Design Uni组件库的3个关键改进

如何优化ActionSheet交互体验:Wot Design Uni组件库的3个关键改进 【免费下载链接】wot-design-uni 一个基于Vue3TS开发的uni-app组件库,提供70高质量组件,支持暗黑模式、国际化和自定义主题。 项目地址: https://gitcode.com/gh_mirrors/w…

2026/7/29 18:24:14
GetQzonehistory终极指南:三步永久备份你的QQ空间完整记忆

GetQzonehistory终极指南:三步永久备份你的QQ空间完整记忆

GetQzonehistory终极指南:三步永久备份你的QQ空间完整记忆 【免费下载链接】GetQzonehistory 获取QQ空间发布的历史说说 项目地址: https://gitcode.com/GitHub_Trending/ge/GetQzonehistory 在数字时代,我们的青春记忆大多散落在各种社交平台中&…

2026/7/29 18:24:14
套接字接口:从磁带安装起步,如何改写网络服务历史、征服世界?

套接字接口:从磁带安装起步,如何改写网络服务历史、征服世界?

套接字接口:改写网络服务历史1983年,加州大学伯克利分校发布UNIX操作系统4.2版本(BSD),将“套接字”网络模型推向世界,提升全球网络服务可访问性。最初通过磁带安装,在20世纪80年代,…

2026/7/29 18:24:14
如何用DyberPet桌面宠物框架打造个性化数字伙伴:无需编程的终极指南

如何用DyberPet桌面宠物框架打造个性化数字伙伴:无需编程的终极指南

如何用DyberPet桌面宠物框架打造个性化数字伙伴:无需编程的终极指南 【免费下载链接】DyberPet Desktop Cyber Pet Framework based on PySide6 项目地址: https://gitcode.com/GitHub_Trending/dy/DyberPet 你是否曾希望桌面上有一个可爱的数字伙伴陪伴你工…

2026/7/29 18:24:14
SQLite 用于生产环境:优化 WAL 模式、并发和 VFS 层实现超低延迟

SQLite 用于生产环境:优化 WAL 模式、并发和 VFS 层实现超低延迟

生产环境中的 SQLite:为低延迟应用服务器优化 WAL 模式、并发和 VFS 层要将 SQLite 从本地开发工具转变为生产级数据库,需要深入了解其内部机制。本文将探讨如何调整 WAL 模式、管理繁忙处理程序,以及利用自定义虚拟文件系统(VFS&…

2026/7/29 18:24:14
5分钟找回丢失密码:ArchivePasswordTestTool帮你轻松破解加密压缩包

5分钟找回丢失密码:ArchivePasswordTestTool帮你轻松破解加密压缩包

5分钟找回丢失密码:ArchivePasswordTestTool帮你轻松破解加密压缩包 【免费下载链接】ArchivePasswordTestTool 利用7zip测试压缩包的功能 对加密压缩包进行自动化测试密码 项目地址: https://gitcode.com/gh_mirrors/ar/ArchivePasswordTestTool 你是否曾经…

2026/7/29 18:19:14

月新闻