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

Backport: set on_exit_shutdown argument for gz-sim ExecuteProcess #451

Merged
merged 1 commit into from Sep 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 12 additions & 2 deletions ros_gz_sim/launch/gz_sim.launch.py.in
Expand Up @@ -18,7 +18,7 @@ from os import environ

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, OpaqueFunction
from launch.actions import ExecuteProcess
from launch.actions import ExecuteProcess, Shutdown
from launch.substitutions import LaunchConfiguration

def launch_gz(context, *args, **kwargs):
Expand All @@ -34,6 +34,7 @@ def launch_gz(context, *args, **kwargs):
ign_args = LaunchConfiguration('ign_args').perform(context)
ign_version = LaunchConfiguration('ign_version').perform(context)
debugger = LaunchConfiguration('debugger').perform(context)
on_exit_shutdown = LaunchConfiguration('on_exit_shutdown').perform(context)

if not len(gz_args) and len(ign_args):
print("ign_args is deprecated, migrate to gz_args!")
Expand All @@ -54,12 +55,18 @@ def launch_gz(context, *args, **kwargs):
else:
debug_prefix = None

if on_exit_shutdown:
on_exit = Shutdown()
else:
on_exit = None

return [ExecuteProcess(
cmd=[exec, exec_args, '--force-version', gz_version],
output='screen',
additional_env=env,
shell=True,
prefix=debug_prefix
prefix=debug_prefix,
on_exit=on_exit
)]


Expand All @@ -84,5 +91,8 @@ def generate_launch_description():
DeclareLaunchArgument(
'debugger', default_value='false',
description='Run in Debugger'),
DeclareLaunchArgument(
'on_exit_shutdown', default_value='false',
description='Shutdown on gz-sim exit'),
OpaqueFunction(function = launch_gz),
])