-
Notifications
You must be signed in to change notification settings - Fork 10
/
experiment_ouster_realsense.launch.py
133 lines (106 loc) · 5.03 KB
/
experiment_ouster_realsense.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import TimerAction, OpaqueFunction, PushLaunchConfigurations, PopLaunchConfigurations, DeclareLaunchArgument, IncludeLaunchDescription, ExecuteProcess, SetEnvironmentVariable
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_ros.actions import Node
import launch_testing
import launch_testing.actions
from launch.substitutions import LaunchConfiguration
def launch_setup(context, *args, **kwargs):
# Params
cslam_proc = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(get_package_share_directory("cslam_experiments"),
"launch", "cslam", "cslam_rgbd.launch.py")),
launch_arguments={
"config_path": os.path.join(get_package_share_directory("cslam_experiments"), "config/"),
"config_file": LaunchConfiguration('cslam_config_file').perform(context),
"robot_id": LaunchConfiguration('robot_id').perform(context),
"namespace": "/r" + LaunchConfiguration('robot_id').perform(context),
"max_nb_robots": LaunchConfiguration('max_nb_robots').perform(context),
}.items(),
)
# Camera
camera_proc = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(get_package_share_directory('cslam_experiments'), 'launch',
'sensors', 'realsense_d400.launch.py')),
launch_arguments={
"namespace": "/r" + LaunchConfiguration('robot_id').perform(context),
}.items(),
)
# Odom
odom_proc = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(get_package_share_directory('cslam_experiments'), 'launch',
'odometry', 'rtabmap_ouster_lidar_odometry.launch.py')),
launch_arguments={
"namespace": "",
"robot_id": LaunchConfiguration('robot_id').perform(context),
'log_level': "info",
}.items(),
)
lidar = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(get_package_share_directory('ros2_ouster'), 'launch',
'driver_launch.py')),
)
imu = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
os.path.join(get_package_share_directory('vectornav'), 'launch',
'vectornav.launch.py')),
)
tf_process = Node(package="tf2_ros",
executable="static_transform_publisher",
arguments="0 0 0 0 0 0 base_link laser_sensor_frame".split(" "),
parameters=[])
tf_process2 = Node(package="tf2_ros",
executable="static_transform_publisher",
arguments="0 0 0 0 0 0 base_link laser_data_frame".split(" "),
parameters=[])
tf_process_imu = Node(package="tf2_ros",
executable="static_transform_publisher",
arguments="-0.13 0.045 -0.02 0 0 3.14159 base_link vectornav".split(" "),
parameters=[])
zenoh_dds_brigde_process = ExecuteProcess(
cmd=['zenoh-bridge-dds', '-d', LaunchConfiguration('robot_id').perform(context), '--allow', '/cslam/.*']
)
# Launch schedule
schedule = []
schedule.append(SetEnvironmentVariable('ROS_DOMAIN_ID', LaunchConfiguration('robot_id').perform(context)))
schedule.append(zenoh_dds_brigde_process)
schedule.append(PushLaunchConfigurations())
schedule.append(cslam_proc)
schedule.append(PopLaunchConfigurations())
schedule.append(PushLaunchConfigurations())
schedule.append(camera_proc)
schedule.append(PopLaunchConfigurations())
schedule.append(PushLaunchConfigurations())
schedule.append(odom_proc)
schedule.append(PopLaunchConfigurations())
schedule.append(PushLaunchConfigurations())
schedule.append(lidar)
schedule.append(PopLaunchConfigurations())
schedule.append(PushLaunchConfigurations())
schedule.append(tf_process)
schedule.append(PopLaunchConfigurations())
schedule.append(PushLaunchConfigurations())
schedule.append(tf_process2)
schedule.append(PopLaunchConfigurations())
schedule.append(PushLaunchConfigurations())
schedule.append(tf_process_imu)
schedule.append(PopLaunchConfigurations())
schedule.append(PushLaunchConfigurations())
schedule.append(imu)
schedule.append(PopLaunchConfigurations())
return schedule
def generate_launch_description():
return LaunchDescription([
DeclareLaunchArgument('robot_id', default_value='0'),
DeclareLaunchArgument('max_nb_robots', default_value='5'),
DeclareLaunchArgument('cslam_config_file',
default_value='realsense_rgbd.yaml',
description=''),
OpaqueFunction(function=launch_setup)
])