feat(nav2): support saved 3d map localization

This commit is contained in:
2026-07-31 11:25:56 +09:00
parent dbe4280c91
commit 5f1403a137
2 changed files with 9 additions and 3 deletions
@@ -63,7 +63,7 @@ rtabmap:
Odom/ScanKeyFrameThr: "0.9" Odom/ScanKeyFrameThr: "0.9"
Odom/GuessMotion: "false" Odom/GuessMotion: "false"
Grid/CellSize: "0.2" Grid/CellSize: "0.05"
Grid/MinClusterSize: "10" Grid/MinClusterSize: "10"
Grid/FlatObstacleDetected: "true" Grid/FlatObstacleDetected: "true"
+8 -2
View File
@@ -17,12 +17,14 @@ ARGUMENTS = [
DeclareLaunchArgument('sim_mode', default_value='true'), DeclareLaunchArgument('sim_mode', default_value='true'),
DeclareLaunchArgument('robot', default_value='fr09', choices=['mkmini', 'fr09', 'f1tenth']), DeclareLaunchArgument('robot', default_value='fr09', choices=['mkmini', 'fr09', 'f1tenth']),
DeclareLaunchArgument('database_path', default_value='~/.ros/rtabmap.db'), DeclareLaunchArgument('database_path', default_value='~/.ros/rtabmap.db'),
DeclareLaunchArgument('localization', default_value='false'),
] ]
def launch_setup(context, *args, **kwargs): def launch_setup(context, *args, **kwargs):
sim_mode = LaunchConfiguration('sim_mode').perform(context).lower() sim_mode = LaunchConfiguration('sim_mode').perform(context).lower()
robot = LaunchConfiguration('robot').perform(context) robot = LaunchConfiguration('robot').perform(context)
database_path = LaunchConfiguration('database_path') database_path = LaunchConfiguration('database_path')
localization = LaunchConfiguration('localization').perform(context).lower() in ('1', 'true', 'yes')
remappings=[ remappings=[
('/tf', 'tf'), ('/tf', 'tf'),
@@ -61,9 +63,13 @@ def launch_setup(context, *args, **kwargs):
executable='rtabmap', executable='rtabmap',
name='rtabmap', name='rtabmap',
output='screen', output='screen',
parameters=[rtabmap_params_file, {'database_path': database_path}], parameters=[rtabmap_params_file, {
'database_path': database_path,
'Mem/IncrementalMemory': 'false' if localization else 'true',
'Mem/InitWMWithAllNodes': 'true' if localization else 'false',
}],
remappings=remappings, remappings=remappings,
arguments=['-d'] arguments=[] if localization else ['-d']
), ),
], ],
) )