Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call gz sim directly without shell=True for a clean exit #4456

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions nav2_simple_commander/nav2_simple_commander/utils.py

This file was deleted.

17 changes: 5 additions & 12 deletions nav2_system_tests/src/localization/test_localization_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@
import launch_ros.actions
from launch_testing.legacy import LaunchTestService

from nav2_simple_commander.utils import kill_os_processes


def main(argv=sys.argv[1:]):
testExecutable = os.getenv('TEST_EXECUTABLE')
sim_dir = get_package_share_directory('nav2_minimal_tb3_sim')
nav2_bringup_dir = get_package_share_directory('nav2_bringup')
ros_gz_sim_dir = get_package_share_directory('ros_gz_sim')

world_sdf_xacro = os.path.join(sim_dir, 'worlds', 'tb3_sandbox.sdf.xacro')
robot_sdf = os.path.join(sim_dir, 'urdf', 'gz_waffle.sdf')
Expand All @@ -53,12 +50,10 @@ def main(argv=sys.argv[1:]):
str(Path(os.path.join(sim_dir)).parent.resolve())
)

start_gazebo_server = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(ros_gz_sim_dir, 'launch', 'gz_sim.launch.py')
),
launch_arguments={'gz_args': ['-r -s ', world_sdf_xacro]}.items(),
)
start_gazebo_server = ExecuteProcess(
cmd=['gz', 'sim', '-r', '-s', world_sdf_xacro],
output='screen',
),

spawn_robot = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
Expand Down Expand Up @@ -122,9 +117,7 @@ def main(argv=sys.argv[1:]):
lts.add_test_action(ld, test1_action)
ls = LaunchService(argv=argv)
ls.include_launch_description(ld)
return_code = lts.run(ls)
kill_os_processes('gz sim')
return return_code
return lts.run(ls)


if __name__ == '__main__':
Expand Down
14 changes: 4 additions & 10 deletions nav2_system_tests/src/system/test_system_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@
from launch_testing.legacy import LaunchTestService

from nav2_common.launch import RewrittenYaml
from nav2_simple_commander.utils import kill_os_processes


def generate_launch_description():
sim_dir = get_package_share_directory('nav2_minimal_tb3_sim')
nav2_bringup_dir = get_package_share_directory('nav2_bringup')
ros_gz_sim_dir = get_package_share_directory('ros_gz_sim')

world_sdf_xacro = os.path.join(sim_dir, 'worlds', 'tb3_sandbox.sdf.xacro')
robot_sdf = os.path.join(sim_dir, 'urdf', 'gz_waffle.sdf')
Expand Down Expand Up @@ -97,11 +95,9 @@ def generate_launch_description():
'GZ_SIM_RESOURCE_PATH',
str(Path(os.path.join(sim_dir)).parent.resolve())
),
IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(ros_gz_sim_dir, 'launch', 'gz_sim.launch.py')
),
launch_arguments={'gz_args': ['-r -s ', world_sdf_xacro]}.items(),
ExecuteProcess(
cmd=['gz', 'sim', '-r', '-s', world_sdf_xacro],
output='screen',
),
IncludeLaunchDescription(
PythonLaunchDescriptionSource(
Expand Down Expand Up @@ -168,9 +164,7 @@ def main(argv=sys.argv[1:]):
lts.add_test_action(ld, test1_action)
ls = LaunchService(argv=argv)
ls.include_launch_description(ld)
return_code = lts.run(ls)
kill_os_processes('gz sim')
return return_code
return lts.run(ls)


if __name__ == '__main__':
Expand Down
14 changes: 4 additions & 10 deletions nav2_system_tests/src/system/test_system_with_obstacle_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@
from launch_testing.legacy import LaunchTestService

from nav2_common.launch import RewrittenYaml
from nav2_simple_commander.utils import kill_os_processes


def generate_launch_description():
sim_dir = get_package_share_directory('nav2_minimal_tb3_sim')
nav2_bringup_dir = get_package_share_directory('nav2_bringup')
ros_gz_sim_dir = get_package_share_directory('ros_gz_sim')
nav2_system_tests_dir = get_package_share_directory('nav2_system_tests')

world_sdf_xacro = os.path.join(sim_dir, 'worlds', 'tb3_sandbox.sdf.xacro')
Expand Down Expand Up @@ -100,11 +98,9 @@ def generate_launch_description():
'GZ_SIM_RESOURCE_PATH',
str(Path(os.path.join(sim_dir)).parent.resolve())
),
IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(ros_gz_sim_dir, 'launch', 'gz_sim.launch.py')
),
launch_arguments={'gz_args': ['-r -s ', world_sdf_xacro]}.items(),
ExecuteProcess(
cmd=['gz', 'sim', '-r', '-s', world_sdf_xacro],
output='screen',
),
IncludeLaunchDescription(
PythonLaunchDescriptionSource(
Expand Down Expand Up @@ -181,9 +177,7 @@ def main(argv=sys.argv[1:]):
lts.add_test_action(ld, test1_action)
ls = LaunchService(argv=argv)
ls.include_launch_description(ld)
return_code = lts.run(ls)
kill_os_processes('gz sim')
return return_code
return lts.run(ls)


if __name__ == '__main__':
Expand Down
14 changes: 4 additions & 10 deletions nav2_system_tests/src/system/test_wrong_init_pose_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,11 @@
from launch_testing.legacy import LaunchTestService

from nav2_common.launch import RewrittenYaml
from nav2_simple_commander.utils import kill_os_processes


def generate_launch_description():
sim_dir = get_package_share_directory('nav2_minimal_tb3_sim')
nav2_bringup_dir = get_package_share_directory('nav2_bringup')
ros_gz_sim_dir = get_package_share_directory('ros_gz_sim')

world_sdf_xacro = os.path.join(sim_dir, 'worlds', 'tb3_sandbox.sdf.xacro')
robot_sdf = os.path.join(sim_dir, 'urdf', 'gz_waffle.sdf')
Expand Down Expand Up @@ -96,11 +94,9 @@ def generate_launch_description():
'GZ_SIM_RESOURCE_PATH',
str(Path(os.path.join(sim_dir)).parent.resolve())
),
IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(ros_gz_sim_dir, 'launch', 'gz_sim.launch.py')
),
launch_arguments={'gz_args': ['-r -s ', world_sdf_xacro]}.items(),
ExecuteProcess(
cmd=['gz', 'sim', '-r', '-s', world_sdf_xacro],
output='screen',
),
IncludeLaunchDescription(
PythonLaunchDescriptionSource(
Expand Down Expand Up @@ -167,9 +163,7 @@ def main(argv=sys.argv[1:]):
lts.add_test_action(ld, test1_action)
ls = LaunchService(argv=argv)
ls.include_launch_description(ld)
return_code = lts.run(ls)
kill_os_processes('gz sim')
return return_code
return lts.run(ls)


if __name__ == '__main__':
Expand Down
Loading