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',