31
31
import os
32
32
33
33
from launch import LaunchDescription
34
- from launch .actions import DeclareLaunchArgument
34
+ from launch .actions import DeclareLaunchArgument , IncludeLaunchDescription
35
35
from launch .substitutions import LaunchConfiguration
36
36
from launch_ros .actions import Node
37
37
from ament_index_python .packages import get_package_share_directory
38
+ from launch .launch_description_sources import PythonLaunchDescriptionSource
38
39
39
40
40
41
def generate_launch_description ():
@@ -46,21 +47,19 @@ def generate_launch_description():
46
47
'config' , 'slam_toolbox_online_async.yaml' ),
47
48
description = 'Full path to the ROS 2 parameters file to use for the slam_toolbox node' )
48
49
49
- start_async_slam_toolbox_node = Node (
50
- parameters = [
51
- slam_params_file ,
52
- {
53
- 'use_sim_time' : True
54
- }
55
- ],
56
- package = 'slam_toolbox' ,
57
- executable = 'async_slam_toolbox_node' ,
58
- name = 'slam_toolbox' ,
59
- output = 'screen' )
50
+ async_slam_toolbox_launch = IncludeLaunchDescription (
51
+ PythonLaunchDescriptionSource (
52
+ os .path .join (get_package_share_directory ("slam_toolbox" ),
53
+ 'launch' , 'online_async_launch.py' )
54
+ ),
55
+ launch_arguments = {
56
+ 'slam_params_file' : slam_params_file
57
+ }.items (),
58
+ )
60
59
61
60
ld = LaunchDescription ()
62
61
63
62
ld .add_action (declare_slam_params_file_cmd )
64
- ld .add_action (start_async_slam_toolbox_node )
63
+ ld .add_action (async_slam_toolbox_launch )
65
64
66
65
return ld
0 commit comments