mirror of
https://github.com/SHC-ASTRA/rover-ros2.git
synced 2026-02-11 09:20:40 +00:00
Anchor: Shutdown all nodes when one exits
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from launch import LaunchDescription
|
from launch import LaunchDescription
|
||||||
from launch.actions import DeclareLaunchArgument, OpaqueFunction
|
from launch.actions import DeclareLaunchArgument, OpaqueFunction, Shutdown
|
||||||
from launch.substitutions import LaunchConfiguration
|
from launch.substitutions import LaunchConfiguration
|
||||||
from launch_ros.actions import Node
|
from launch_ros.actions import Node
|
||||||
|
|
||||||
@@ -24,7 +24,8 @@ def launch_setup(context, *args, **kwargs):
|
|||||||
executable='arm', # change as needed
|
executable='arm', # change as needed
|
||||||
name='arm',
|
name='arm',
|
||||||
output='both',
|
output='both',
|
||||||
parameters=[{'launch_mode': mode}]
|
parameters=[{'launch_mode': mode}],
|
||||||
|
on_exit=Shutdown()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
nodes.append(
|
nodes.append(
|
||||||
@@ -33,7 +34,8 @@ def launch_setup(context, *args, **kwargs):
|
|||||||
executable='core', # change as needed
|
executable='core', # change as needed
|
||||||
name='core',
|
name='core',
|
||||||
output='both',
|
output='both',
|
||||||
parameters=[{'launch_mode': mode}]
|
parameters=[{'launch_mode': mode}],
|
||||||
|
on_exit=Shutdown()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
nodes.append(
|
nodes.append(
|
||||||
@@ -42,7 +44,8 @@ def launch_setup(context, *args, **kwargs):
|
|||||||
executable='bio', # change as needed
|
executable='bio', # change as needed
|
||||||
name='bio',
|
name='bio',
|
||||||
output='both',
|
output='both',
|
||||||
parameters=[{'launch_mode': mode}]
|
parameters=[{'launch_mode': mode}],
|
||||||
|
on_exit=Shutdown()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
nodes.append(
|
nodes.append(
|
||||||
@@ -51,7 +54,8 @@ def launch_setup(context, *args, **kwargs):
|
|||||||
executable='anchor', # change as needed
|
executable='anchor', # change as needed
|
||||||
name='anchor',
|
name='anchor',
|
||||||
output='both',
|
output='both',
|
||||||
parameters=[{'launch_mode': mode}]
|
parameters=[{'launch_mode': mode}],
|
||||||
|
on_exit=Shutdown()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif mode in ['arm', 'core', 'bio']:
|
elif mode in ['arm', 'core', 'bio']:
|
||||||
@@ -63,7 +67,8 @@ def launch_setup(context, *args, **kwargs):
|
|||||||
executable='arm',
|
executable='arm',
|
||||||
name='arm',
|
name='arm',
|
||||||
output='both',
|
output='both',
|
||||||
parameters=[{'launch_mode': mode}]
|
parameters=[{'launch_mode': mode}],
|
||||||
|
on_exit=Shutdown()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif mode == 'core':
|
elif mode == 'core':
|
||||||
@@ -73,7 +78,8 @@ def launch_setup(context, *args, **kwargs):
|
|||||||
executable='core',
|
executable='core',
|
||||||
name='core',
|
name='core',
|
||||||
output='both',
|
output='both',
|
||||||
parameters=[{'launch_mode': mode}]
|
parameters=[{'launch_mode': mode}],
|
||||||
|
on_exit=Shutdown()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif mode == 'bio':
|
elif mode == 'bio':
|
||||||
@@ -83,7 +89,8 @@ def launch_setup(context, *args, **kwargs):
|
|||||||
executable='bio',
|
executable='bio',
|
||||||
name='bio',
|
name='bio',
|
||||||
output='both',
|
output='both',
|
||||||
parameters=[{'launch_mode': mode}]
|
parameters=[{'launch_mode': mode}],
|
||||||
|
on_exit=Shutdown()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user