From 42d105bad02ccf1322de31dfebadb30277954b37 Mon Sep 17 00:00:00 2001 From: chyoo Date: Mon, 10 Aug 2026 11:53:51 +0900 Subject: [PATCH] fix: isolate RTAB-Map occupancy output during navigation --- .../launch/localization3d.launch.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/localization_pkg/launch/localization3d.launch.py b/src/localization_pkg/launch/localization3d.launch.py index 5db0097..63df592 100755 --- a/src/localization_pkg/launch/localization3d.launch.py +++ b/src/localization_pkg/launch/localization3d.launch.py @@ -26,11 +26,16 @@ def launch_setup(context, *args, **kwargs): if not os.path.isfile(database_path): raise RuntimeError(f'3D localization database was not found: {database_path}') - remappings=[ - ('/tf', 'tf'), - ('/tf_static', 'tf_static'), - ('odom', 'icp_odom'), - ('scan_cloud', '/lidar_filtered')] + remappings = [ + ('/tf', 'tf'), + ('/tf_static', 'tf_static'), + ('odom', 'icp_odom'), + ('scan_cloud', '/lidar_filtered'), + ] + # Nav2 map_server owns /map during navigation and publishes the complete + # saved PGM map. Keep RTAB-Map's local occupancy update separate so it + # cannot race map_server and replace the navigation map intermittently. + rtabmap_remappings = [*remappings, ('map', '/rtabmap/map')] # Directories pkg_localization = get_package_share_directory( @@ -72,7 +77,7 @@ def launch_setup(context, *args, **kwargs): 'odom_frame_id': 'icp_odom', 'publish_tf': True, }], - remappings=remappings, + remappings=rtabmap_remappings, ), ], )