From 8789bf6085ae15d255159fc17fd258cf730b6072 Mon Sep 17 00:00:00 2001 From: chyoo Date: Thu, 6 Aug 2026 14:42:41 +0900 Subject: [PATCH] fix: move MKMini default spawn point --- .../launch/simulator.launch.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/nav2_turtlebot_simulator/launch/simulator.launch.py b/src/nav2_turtlebot_simulator/launch/simulator.launch.py index 7c9bf3a..fc822f7 100644 --- a/src/nav2_turtlebot_simulator/launch/simulator.launch.py +++ b/src/nav2_turtlebot_simulator/launch/simulator.launch.py @@ -300,6 +300,8 @@ def launch_gazebo(context): world = LaunchConfiguration('world').perform(context) render_mode = LaunchConfiguration('render_mode').perform(context).strip().lower() platform = LaunchConfiguration('platform').perform(context).strip().lower() + spawn_x = LaunchConfiguration('x_pose').perform(context) + spawn_y = LaunchConfiguration('y_pose').perform(context) extra_model_path = '' if render_mode not in {'flat', 'full'}: @@ -348,6 +350,10 @@ 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 = [] else: raise RuntimeError('platform must be turtlebot3 or mkmini') @@ -371,8 +377,8 @@ def launch_gazebo(context): arguments=[ '-entity', entity_name, '-file', model_path, - '-x', LaunchConfiguration('x_pose').perform(context), - '-y', LaunchConfiguration('y_pose').perform(context), + '-x', spawn_x, + '-y', spawn_y, '-z', '0.01', ], output='screen',