-
Notifications
You must be signed in to change notification settings - Fork 1
/
robot.launch.py
193 lines (180 loc) · 8.75 KB
/
robot.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
from os import environ
import netifaces as ni
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_xml.launch_description_sources import XMLLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration, PathJoinSubstitution
from launch.actions import ExecuteProcess
from launch.conditions import LaunchConfigurationEquals, IfCondition
from launch_ros.actions import Node
ip = ni.ifaddresses('mlan0')[ni.AF_INET][0]['addr']
print('mlan0: {:s}:4242'.format(ip))
ARGUMENTS = [
DeclareLaunchArgument('sync', default_value='true',
choices=['true', 'false'],
description='Run async or sync SLAM'),
DeclareLaunchArgument('localization', default_value='slam',
choices=['off', 'localization', 'slam'],
description='Whether to run localization or SLAM'),
DeclareLaunchArgument('nav2', default_value='true',
choices=['true', 'false'],
description='Run nav2'),
DeclareLaunchArgument('corti', default_value='true',
choices=['true', 'false'],
description='Run corti'),
DeclareLaunchArgument('laser', default_value='true',
choices=['true', 'false'],
description='Run laser'),
DeclareLaunchArgument('synapse_ros', default_value='true',
choices=['true', 'false'],
description='Run synapse_ros'),
DeclareLaunchArgument('description', default_value='true',
choices=['true', 'false'],
description='Run description'),
DeclareLaunchArgument('use_sim_time', default_value='false',
choices=['true', 'false'],
description='Use sim time'),
DeclareLaunchArgument('log_level', default_value='error',
choices=['info', 'warn', 'error'],
description='log level'),
DeclareLaunchArgument('cam',
default_value='true',
choices=['true', 'false'],
description='Use camera'),
DeclareLaunchArgument('cam_topic',
default_value='/ov5645/image_raw',
description='Camera topic name.'),
DeclareLaunchArgument('cam_dev',
default_value='/dev/video3',
description='Camera device.'),
DeclareLaunchArgument('cam_fps',
default_value='30',
description='Camera frames per second.'),
DeclareLaunchArgument('cam_res',
default_value='[320,240]',
description='Camera resolution [wpix,hpix]'),
DeclareLaunchArgument('cam_rot',
default_value='2',
description='Hardware image rotation enum: (0): none, (1): rotate-90, (2): rotate-180, (3): rotate-270, (4): horizontal-flip, (5): vertical-flip'),
DeclareLaunchArgument('foxglove',
default_value='true',
choices=['true', 'false'],
description='use foxglove websocket'),
DeclareLaunchArgument('address', default_value='{:s}'.format(ip),
description='ip address for foxglove'),
DeclareLaunchArgument('capabilities', default_value='[clientPublish,services,connectionGraph,assets]',
description='capabilities for foxglove'),
DeclareLaunchArgument('topic_whitelist',
default_value=['["/camera/image_raw/compressed","/camera/camera_info","/cerebri/out/status","/global_costmap/costmap","/map","global_costmap/published_footprint","/plan","/robot_description","/tf"]'],
description='topic_whitelist for foxglove'),
DeclareLaunchArgument('service_whitelist',
default_value=['[""]'],
description='service_whitelist for foxglove'),
DeclareLaunchArgument('param_whitelist',
default_value=['[""]'],
description='param_whitelist for foxglove'),
DeclareLaunchArgument('send_buffer_limit',
default_value='10000000',
description='send_buffer_limit for foxglove in bytes'),
DeclareLaunchArgument('num_threads',
default_value='0',
description='num_threads for foxglove per core'),
DeclareLaunchArgument('use_compression',
default_value='false',
description='use_compression for foxglove'),
]
def generate_launch_description():
synapse_ros = IncludeLaunchDescription(
PythonLaunchDescriptionSource([PathJoinSubstitution(
[get_package_share_directory('synapse_ros'), 'launch', 'synapse_ros.launch.py'])]),
condition=IfCondition(LaunchConfiguration('synapse_ros')),
launch_arguments=[('host', ['192.0.2.1']),
('port', '4242'),
('use_sim_time', LaunchConfiguration('use_sim_time'))]
)
laser = IncludeLaunchDescription(
PythonLaunchDescriptionSource([PathJoinSubstitution(
[get_package_share_directory('b3rb_bringup'), 'launch', 'laser.launch.py'])]),
condition=IfCondition(LaunchConfiguration('laser')),
launch_arguments=[
('stl27l', 'true'),
('use_sim_time', LaunchConfiguration('use_sim_time'))
]
)
# Robot description
robot_description = IncludeLaunchDescription(
PythonLaunchDescriptionSource([PathJoinSubstitution(
[get_package_share_directory('b3rb_description'), 'launch', 'robot_description.launch.py'])]),
condition=IfCondition(LaunchConfiguration('description')),
launch_arguments=[('use_sim_time', LaunchConfiguration('use_sim_time'))])
nav2 = IncludeLaunchDescription(
PythonLaunchDescriptionSource([PathJoinSubstitution(
[get_package_share_directory(
'b3rb_nav2'), 'launch', 'nav2.launch.py'])]),
condition=IfCondition(LaunchConfiguration('nav2')),
launch_arguments=[('use_sim_time', LaunchConfiguration('use_sim_time'))])
corti = IncludeLaunchDescription(
PythonLaunchDescriptionSource([PathJoinSubstitution(
[get_package_share_directory('corti'), 'launch', 'corti.launch.py'])]),
condition=IfCondition(LaunchConfiguration('corti')),
launch_arguments=[('use_sim_time', LaunchConfiguration('use_sim_time'))])
slam = IncludeLaunchDescription(
PythonLaunchDescriptionSource([PathJoinSubstitution(
[get_package_share_directory(
'b3rb_nav2'), 'launch', 'slam.launch.py'])]),
condition=LaunchConfigurationEquals('localization', 'slam'),
launch_arguments=[('use_sim_time', LaunchConfiguration('use_sim_time')),
('sync', LaunchConfiguration('sync'))])
localization = IncludeLaunchDescription(
PythonLaunchDescriptionSource([PathJoinSubstitution(
[get_package_share_directory(
'b3rb_nav2'), 'launch', 'localization.launch.py'])]),
condition=LaunchConfigurationEquals('localization', 'localization'),
launch_arguments=[('use_sim_time', LaunchConfiguration('use_sim_time')),
('map', PathJoinSubstitution([get_package_share_directory(
'b3rb_nav2'), 'maps', LaunchConfiguration('map_yaml')]))])
odom_to_tf = Node(
condition=IfCondition(LaunchConfiguration('corti')),
package='corti',
executable='odom_to_tf',
output='screen',
parameters=[{
'async': False,
'sync_dt': 0.02,
'use_sim_time': LaunchConfiguration('use_sim_time'),
}],
remappings=[
('/odom', '/cerebri/out/odometry')
])
foxglove_websockets = IncludeLaunchDescription(
XMLLaunchDescriptionSource([PathJoinSubstitution(
[get_package_share_directory('foxglove_bridge'), 'launch', 'foxglove_bridge_launch.xml'])]),
condition=IfCondition(LaunchConfiguration('foxglove')),
launch_arguments=[('address', LaunchConfiguration('address')),
('capabilities', LaunchConfiguration('capabilities')),
('topic_whitelist', LaunchConfiguration('topic_whitelist')),
('service_whitelist', LaunchConfiguration('service_whitelist')),
('param_whitelist', LaunchConfiguration('param_whitelist')),
('send_buffer_limit', LaunchConfiguration('send_buffer_limit')),
('num_threads', LaunchConfiguration('num_threads')),
('use_compression', LaunchConfiguration('use_compression')),
('use_sim_time', LaunchConfiguration('use_sim_time'))])
cam = IncludeLaunchDescription(
XMLLaunchDescriptionSource([PathJoinSubstitution(
[get_package_share_directory('b3rb_bringup'), 'launch', 'ov5645.launch.xml'])]),
condition=IfCondition(LaunchConfiguration('cam')))
# Define LaunchDescription variable
return LaunchDescription(ARGUMENTS + [
robot_description,
synapse_ros,
nav2,
corti,
foxglove_websockets,
slam,
laser,
localization,
odom_to_tf,
cam,
])