SMACC2
online_sync_launch.py
Go to the documentation of this file.
1# Copyright (c) 2018 Intel Corporation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15
16import os
17
18from launch import LaunchDescription
19from launch.actions import DeclareLaunchArgument
20from launch.substitutions import LaunchConfiguration
21from launch_ros.actions import Node
22from ament_index_python.packages import get_package_share_directory
23
24
26 use_sim_time = LaunchConfiguration("use_sim_time")
27 slam_params_file = LaunchConfiguration("slam_params_file")
28
29 declare_use_sim_time_argument = DeclareLaunchArgument(
30 "use_sim_time", default_value="true", description="Use simulation/Gazebo clock"
31 )
32 declare_slam_params_file_cmd = DeclareLaunchArgument(
33 "slam_params_file",
34 default_value=os.path.join(
35 get_package_share_directory("sm_aws_warehouse_navigation"),
36 "params",
37 "mapper_params_online_sync.yaml",
38 ),
39 description="Full path to the ROS2 parameters file to use for the slam_toolbox node",
40 )
41
42 start_sync_slam_toolbox_node = Node(
43 parameters=[slam_params_file, {"use_sim_time": use_sim_time}],
44 package="slam_toolbox",
45 executable="sync_slam_toolbox_node",
46 name="slam_toolbox",
47 output="screen",
48 )
49
50 ld = LaunchDescription()
51
52 ld.add_action(declare_use_sim_time_argument)
53 ld.add_action(declare_slam_params_file_cmd)
54 ld.add_action(start_sync_slam_toolbox_node)
55
56 return ld