From d1e8eeeef345138f46d7d155526c22d05d3dd824 Mon Sep 17 00:00:00 2001 From: Steve Macenski Date: Wed, 3 Jul 2024 11:41:50 -0700 Subject: [PATCH] fixing gz sim launch file by using gz directly (#4514) --- .../launch/cloned_multi_tb3_simulation_launch.py | 9 ++++----- nav2_bringup/launch/tb3_simulation_launch.py | 11 +++++------ nav2_bringup/launch/tb4_simulation_launch.py | 11 +++++------ ...aunch.py => unique_multi_tb3_simulation_launch.py} | 9 ++++----- 4 files changed, 18 insertions(+), 22 deletions(-) rename nav2_bringup/launch/{unique_multi_tb4_simulation_launch.py => unique_multi_tb3_simulation_launch.py} (97%) diff --git a/nav2_bringup/launch/cloned_multi_tb3_simulation_launch.py b/nav2_bringup/launch/cloned_multi_tb3_simulation_launch.py index 54f9d60f80..bd001412d5 100644 --- a/nav2_bringup/launch/cloned_multi_tb3_simulation_launch.py +++ b/nav2_bringup/launch/cloned_multi_tb3_simulation_launch.py @@ -111,11 +111,10 @@ def generate_launch_description(): world_sdf = tempfile.mktemp(prefix='nav2_', suffix='.sdf') world_sdf_xacro = ExecuteProcess( cmd=['xacro', '-o', world_sdf, ['headless:=', 'False'], world]) - start_gazebo_cmd = IncludeLaunchDescription( - PythonLaunchDescriptionSource( - os.path.join(get_package_share_directory('ros_gz_sim'), 'launch', - 'gz_sim.launch.py')), - launch_arguments={'gz_args': ['-r -s ', world_sdf]}.items()) + start_gazebo_cmd = ExecuteProcess( + cmd=['gz', 'sim', '-r', '-s', world_sdf], + output='screen', + ) remove_temp_sdf_file = RegisterEventHandler(event_handler=OnShutdown( on_shutdown=[ diff --git a/nav2_bringup/launch/tb3_simulation_launch.py b/nav2_bringup/launch/tb3_simulation_launch.py index cfef103f7b..db1964f955 100644 --- a/nav2_bringup/launch/tb3_simulation_launch.py +++ b/nav2_bringup/launch/tb3_simulation_launch.py @@ -214,12 +214,11 @@ def generate_launch_description(): world_sdf = tempfile.mktemp(prefix='nav2_', suffix='.sdf') world_sdf_xacro = ExecuteProcess( cmd=['xacro', '-o', world_sdf, ['headless:=', headless], world]) - gazebo_server = IncludeLaunchDescription( - PythonLaunchDescriptionSource( - os.path.join(get_package_share_directory('ros_gz_sim'), 'launch', - 'gz_sim.launch.py')), - launch_arguments={'gz_args': ['-r -s ', world_sdf]}.items(), - condition=IfCondition(use_simulator)) + gazebo_server = ExecuteProcess( + cmd=['gz', 'sim', '-r', '-s', world_sdf], + output='screen', + condition=IfCondition(use_simulator) + ) remove_temp_sdf_file = RegisterEventHandler(event_handler=OnShutdown( on_shutdown=[ diff --git a/nav2_bringup/launch/tb4_simulation_launch.py b/nav2_bringup/launch/tb4_simulation_launch.py index df98cd930b..463f0c17f3 100644 --- a/nav2_bringup/launch/tb4_simulation_launch.py +++ b/nav2_bringup/launch/tb4_simulation_launch.py @@ -216,12 +216,11 @@ def generate_launch_description(): world_sdf = tempfile.mktemp(prefix='nav2_', suffix='.sdf') world_sdf_xacro = ExecuteProcess( cmd=['xacro', '-o', world_sdf, ['headless:=', headless], world]) - gazebo_server = IncludeLaunchDescription( - PythonLaunchDescriptionSource( - os.path.join(get_package_share_directory('ros_gz_sim'), 'launch', - 'gz_sim.launch.py')), - launch_arguments={'gz_args': ['-r -s ', world_sdf]}.items(), - condition=IfCondition(use_simulator)) + gazebo_server = ExecuteProcess( + cmd=['gz', 'sim', '-r', '-s', world_sdf], + output='screen', + condition=IfCondition(use_simulator) + ) remove_temp_sdf_file = RegisterEventHandler(event_handler=OnShutdown( on_shutdown=[ diff --git a/nav2_bringup/launch/unique_multi_tb4_simulation_launch.py b/nav2_bringup/launch/unique_multi_tb3_simulation_launch.py similarity index 97% rename from nav2_bringup/launch/unique_multi_tb4_simulation_launch.py rename to nav2_bringup/launch/unique_multi_tb3_simulation_launch.py index 7eaaf1a97d..ae5551d179 100644 --- a/nav2_bringup/launch/unique_multi_tb4_simulation_launch.py +++ b/nav2_bringup/launch/unique_multi_tb3_simulation_launch.py @@ -138,11 +138,10 @@ def generate_launch_description(): world_sdf = tempfile.mktemp(prefix='nav2_', suffix='.sdf') world_sdf_xacro = ExecuteProcess( cmd=['xacro', '-o', world_sdf, ['headless:=', 'False'], world]) - start_gazebo_cmd = IncludeLaunchDescription( - PythonLaunchDescriptionSource( - os.path.join(get_package_share_directory('ros_gz_sim'), 'launch', - 'gz_sim.launch.py')), - launch_arguments={'gz_args': ['-r -s ', world_sdf]}.items()) + start_gazebo_cmd = ExecuteProcess( + cmd=['gz', 'sim', '-r', '-s', world_sdf], + output='screen', + ) remove_temp_sdf_file = RegisterEventHandler(event_handler=OnShutdown( on_shutdown=[