From 6a09e31967df6a6dc0eb4a1f8c48360a27db5c9d Mon Sep 17 00:00:00 2001 From: chyoo Date: Thu, 6 Aug 2026 15:09:49 +0900 Subject: [PATCH] fix: publish MKMini lidar transform for SLAM --- .../launch/simulator.launch.py | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/nav2_turtlebot_simulator/launch/simulator.launch.py b/src/nav2_turtlebot_simulator/launch/simulator.launch.py index 4ade9a5..6ea24df 100644 --- a/src/nav2_turtlebot_simulator/launch/simulator.launch.py +++ b/src/nav2_turtlebot_simulator/launch/simulator.launch.py @@ -368,11 +368,23 @@ def launch_gazebo(context): entity_name = 'mkmini_gazebo' model_directory = os.path.join(simulator_dir, 'models') model_path = os.path.join(model_directory, 'mkmini_gazebo', 'model.sdf') - # Keep the default spawn point proportional to the expanded MKMini map. - if spawn_x == '-2.0' and spawn_y == '-0.5': - spawn_x = str(-2.0 * MKMINI_WORLD_SPACING_SCALE) - spawn_y = str(-0.5 * MKMINI_WORLD_SPACING_SCALE) - static_transforms = [] + # The world obstacles are spread out for MKMini, but the original + # TurtleBot spawn is already inside the navigable centre of that map. + # Scaling it as well placed the robot against the generated map edge. + # Gazebo's fixed joint does not reliably publish this transform to the + # separate SLAM container. Publish the sensor mounting point explicitly. + static_transforms = [ + Node( + package='tf2_ros', + executable='static_transform_publisher', + name='mkmini_lidar_tf', + arguments=[ + '--x', '0', '--y', '0', '--z', '0.6', + '--roll', '0', '--pitch', '0', '--yaw', '0', + '--frame-id', 'base_link', '--child-frame-id', 'os_lidar', + ], + ), + ] else: raise RuntimeError('platform must be turtlebot3 or mkmini')