17from ament_index_python.packages
import get_package_share_directory
19from launch
import LaunchDescription
20from launch.actions
import (
21 DeclareLaunchArgument,
23 IncludeLaunchDescription,
24 SetEnvironmentVariable,
26from launch.conditions
import IfCondition
27from launch.launch_description_sources
import PythonLaunchDescriptionSource
28from launch.substitutions
import LaunchConfiguration
29from launch_ros.actions
import PushRosNamespace
34 sm_aws_warehouse_navigation_dir = get_package_share_directory(
"sm_aws_warehouse_navigation")
35 launch_dir = os.path.join(sm_aws_warehouse_navigation_dir,
"launch")
38 namespace = LaunchConfiguration(
"namespace")
39 use_namespace = LaunchConfiguration(
"use_namespace")
42 use_sim_time = LaunchConfiguration(
"use_sim_time")
47 stdout_linebuf_envvar = SetEnvironmentVariable(
"RCUTILS_LOGGING_BUFFERED_STREAM",
"1")
49 declare_namespace_cmd = DeclareLaunchArgument(
50 "namespace", default_value=
"", description=
"Top-level namespace"
53 declare_use_namespace_cmd = DeclareLaunchArgument(
55 default_value=
"false",
56 description=
"Whether to apply a namespace to the navigation stack",
67 declare_use_sim_time_cmd = DeclareLaunchArgument(
68 "use_sim_time", default_value=
"false", description=
"Use simulation (Gazebo) clock if true"
87 declare_autostart_cmd = DeclareLaunchArgument(
88 "autostart", default_value=
"true", description=
"Automatically startup the nav2 stack"
92 bringup_cmd_group = GroupAction(
94 PushRosNamespace(condition=IfCondition(use_namespace), namespace=namespace),
117 IncludeLaunchDescription(
118 PythonLaunchDescriptionSource(os.path.join(launch_dir,
"navigation_launch.py")),
120 "namespace": namespace,
121 "use_sim_time": use_sim_time,
124 "use_lifecycle_mgr":
"false",
125 "map_subscribe_transient_local":
"false",
132 ld = LaunchDescription()
135 ld.add_action(stdout_linebuf_envvar)
138 ld.add_action(declare_namespace_cmd)
139 ld.add_action(declare_use_namespace_cmd)
142 ld.add_action(declare_use_sim_time_cmd)
144 ld.add_action(declare_autostart_cmd)
148 ld.add_action(bringup_cmd_group)
def generate_launch_description()