-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrobot_c1.launch.py
65 lines (52 loc) · 2.18 KB
/
robot_c1.launch.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env python3
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration
from launch.substitutions import ThisLaunchFileDir
from launch_ros.actions import Node
def generate_launch_description():
TURTLEBOT3_MODEL = os.environ['TURTLEBOT3_MODEL']
usb_port = LaunchConfiguration('usb_port', default='/dev/ttyACM0')
tb3_param_dir = LaunchConfiguration(
'tb3_param_dir',
default=os.path.join(
get_package_share_directory('turtlebot3_bringup'),
'param',
TURTLEBOT3_MODEL + '.yaml'))
lidar_pkg_dir = LaunchConfiguration(
'lidar_pkg_dir',
default=os.path.join(get_package_share_directory('rplidar_ros'), 'launch'))
use_sim_time = LaunchConfiguration('use_sim_time', default='false')
return LaunchDescription([
DeclareLaunchArgument(
'use_sim_time',
default_value=use_sim_time,
description='Use simulation (Gazebo) clock if true'),
DeclareLaunchArgument(
'usb_port',
default_value=usb_port,
description='Connected USB port with OpenCR'),
DeclareLaunchArgument(
'tb3_param_dir',
default_value=tb3_param_dir,
description='Full path to turtlebot3 parameter file to load'),
IncludeLaunchDescription(
PythonLaunchDescriptionSource(
[ThisLaunchFileDir(), '/turtlebot3_state_publisher.launch.py']),
launch_arguments={'use_sim_time': use_sim_time}.items(),
),
IncludeLaunchDescription(
PythonLaunchDescriptionSource([lidar_pkg_dir, '/rplidar_c1_launch.py']),
launch_arguments={'frame_id': 'base_scan'}.items(),
),
Node(
package='turtlebot3_node',
executable='turtlebot3_ros',
parameters=[tb3_param_dir],
arguments=['-i', usb_port],
output='screen'),
])