Skip to content

Commit

Permalink
kill gazebo
Browse files Browse the repository at this point in the history
  • Loading branch information
tomonorman committed Feb 18, 2025
1 parent 4227301 commit 42d3641
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/sam_bot_nav2_gz/launch/display.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ def generate_launch_description():
],
)

# gazebo have to be executed with shell=False, or test_launch won't terminate it
# see: https://github.com/ros2/launch/issues/545
# This code is form taken ros_gz_sim and modified to work with shell=False
# see: https://github.com/gazebosim/ros_gz/blob/ros2/ros_gz_sim/launch/gz_sim.launch.py.in
gz_env = {
'GZ_SIM_SYSTEM_PLUGIN_PATH': ':'.join([
os.environ.get('GZ_SIM_SYSTEM_PLUGIN_PATH', ''),
Expand All @@ -86,14 +82,12 @@ def generate_launch_description():
cmd=[FindExecutable(name="gz"), 'sim', '-r', '-v', gz_verbosity, '-s', '--headless-rendering', world_path],
output='screen',
additional_env=gz_env,
shell=False,
),
ExecuteProcess(
condition=launch.conditions.UnlessCondition(run_headless),
cmd=[FindExecutable(name="gz"), 'sim', '-r', '-v', gz_verbosity, world_path],
output='screen',
additional_env=gz_env,
shell=False,
)
]

Expand Down
8 changes: 8 additions & 0 deletions src/sam_bot_nav2_gz/test/test_bringup.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import launch_testing.actions
import launch_testing.markers
import pytest
from artefacts_toolkit.gazebo import gz


# This function specifies the processes to be run for our test
Expand Down Expand Up @@ -44,3 +45,10 @@ def test_read_stdout(self, proc_output):
# It captures the outputs of the processes launched in generate_test_description()
# Refer to the documentation for further details.
proc_output.assertWaitFor("Creating bond timer", timeout=300, stream="stdout")


@launch_testing.post_shutdown_test()
class TestProcOutputAfterShutdown(unittest.TestCase):
def test_exit_code(self, rosbag_filepath):
print("######")
gz.kill_gazebo()
1 change: 1 addition & 0 deletions src/sam_bot_nav2_gz/test/test_reach_goal.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def test_read_stdout(self, proc_output):
class TestProcOutputAfterShutdown(unittest.TestCase):
def test_exit_code(self, rosbag_filepath):
print(rosbag_filepath)

make_chart(
rosbag_filepath,
"/odom.pose.pose.position.x",
Expand Down

0 comments on commit 42d3641

Please sign in to comment.