17from ament_index_python.packages
import get_package_share_directory
19from launch
import LaunchDescription
20from launch.actions
import DeclareLaunchArgument, SetEnvironmentVariable
21from launch.substitutions
import LaunchConfiguration
22from launch_ros.actions
import Node
23from nav2_common.launch
import RewrittenYaml
28 sm_aws_warehouse_navigation_dir = get_package_share_directory(
"sm_aws_warehouse_navigation")
29 nav_configuration_dir = get_package_share_directory(
"nav2_bringup")
31 namespace = LaunchConfiguration(
"namespace")
32 use_sim_time = LaunchConfiguration(
"use_sim_time")
33 autostart = LaunchConfiguration(
"autostart")
34 params_file = LaunchConfiguration(
"params_file")
35 default_nav_to_pose_bt_xml = LaunchConfiguration(
"default_nav_to_pose_bt_xml")
38 params_file_path = os.path.join(
39 sm_aws_warehouse_navigation_dir,
51 default_nav_bt_tree_xml_filepath = os.path.join(
52 sm_aws_warehouse_navigation_dir,
"params",
"nav2z_client",
"navigation_tree.xml"
61 params_file_path = os.path.join(
62 sm_aws_warehouse_navigation_dir,
74 default_nav_bt_tree_xml_filepath = os.path.join(
75 sm_aws_warehouse_navigation_dir,
"params",
"nav2z_client",
"navigation_tree.xml"
84 lifecycle_nodes = [
"controller_server",
"planner_server",
"recoveries_server",
"bt_navigator"]
92 remappings = [(
"/tf",
"tf"), (
"/tf_static",
"tf_static")]
95 param_substitutions = {
96 "use_sim_time": use_sim_time,
98 "default_nav_to_pose_bt_xml": default_nav_bt_tree_xml_filepath,
103 configured_params = RewrittenYaml(
104 source_file=params_file,
106 param_rewrites=param_substitutions,
111 "xterm -xrm 'XTerm*scrollBar: true' -xrm 'xterm*rightScrollBar: true' "
112 "-hold -geometry 1000x600 -sl 10000 -e"
115 print(
"+********************************")
116 print(str(param_substitutions))
117 print(str(default_nav_to_pose_bt_xml))
119 return LaunchDescription(
122 SetEnvironmentVariable(
"RCUTILS_LOGGING_BUFFERED_STREAM",
"1"),
123 DeclareLaunchArgument(
124 "namespace", default_value=
"", description=
"Top-level namespace"
126 DeclareLaunchArgument(
128 default_value=
"false",
129 description=
"Use simulation (Gazebo) clock if true",
131 DeclareLaunchArgument(
133 default_value=
"true",
134 description=
"Automatically startup the nav2 stack",
136 DeclareLaunchArgument(
138 default_value=params_file_path,
139 description=
"Full path to the ROS2 parameters file to use",
141 DeclareLaunchArgument(
142 "default_nav_to_pose_bt_xml",
145 default_value=os.path.join(
146 nav_configuration_dir,
149 "navigation_tree.xml",
151 description=
"Full path to the behavior tree xml file to use",
153 DeclareLaunchArgument(
154 "map_subscribe_transient_local",
155 default_value=
"false",
156 description=
"Whether to set the map subscriber QoS to transient local",
159 package=
"nav2_controller",
160 executable=
"controller_server",
163 parameters=[configured_params],
164 remappings=remappings,
165 arguments=[
"--ros-args",
"--log-level",
"INFO"],
168 package=
"nav2_planner",
169 executable=
"planner_server",
170 name=
"planner_server",
173 parameters=[configured_params],
174 remappings=remappings,
175 arguments=[
"--ros-args",
"--log-level",
"INFO"],
178 package=
"nav2_recoveries",
179 executable=
"recoveries_server",
180 name=
"recoveries_server",
182 parameters=[configured_params],
183 remappings=remappings,
184 arguments=[
"--ros-args",
"--log-level",
"INFO"],
187 package=
"nav2_bt_navigator",
188 executable=
"bt_navigator",
192 parameters=[configured_params],
193 remappings=remappings,
194 arguments=[
"--ros-args",
"--log-level",
"INFO"],
197 package=
"nav2_waypoint_follower",
198 executable=
"waypoint_follower",
199 name=
"waypoint_follower",
201 parameters=[configured_params],
202 remappings=remappings,
205 package=
"nav2_lifecycle_manager",
206 executable=
"lifecycle_manager",
207 name=
"lifecycle_manager_navigation",
211 {
"use_sim_time": use_sim_time},
212 {
"autostart": autostart},
213 {
"node_names": lifecycle_nodes},
215 arguments=[
"--ros-args",
"--log-level",
"INFO"],
def generate_launch_description()