多激光雷达驱动程序

本文介绍一台计算机连接多个Velodyne激光雷达的教程。

驱动程序下载

ROS系统中的Velodyne激光雷达驱动可以从ROS-velodyne获取:

1
2
3
4
5
sudo apt-get install ros-(your version)-velodyne
cd PATH/TO/CATKIN/WORKSPACE/SRC
git clone https://github.com/ros-drivers/velodyne.git
cd ..
catkin_make

处理激光雷达标定文件

一般来讲,激光雷达在出厂包装时会附带含有标定文件、驱动程序、User Manual等文件的U盘,从中可以获得.xml的标定文件。而launch文件中需要的是.yaml格式的文件,可以用自带脚本转换:

1
2
cd VELODYNEPATH/velodyne_pointcloud/scripts
python gen_calibration.py PATH/TO/XML/FILE

将脚本目录的.yaml文件保存到velodyne_pointcloud/params/*.yaml路径下。

修改launch启动文件

单个激光雷达启动

setup 1. 设置电脑IP,地址:192.168.1.200,子网掩码255.255.255.0,网关192.168.1.1。

setup 2. 连接激光雷达到电脑,浏览器输入192.168.1.201(默认的激光雷达IP地址),出现激光雷达的设置界面,确认IP和端口是否正常。

setup 3. 以下launch文件,将calibration的标定文件名修改为上一步生成的标定文件名,按需修改device_ip和frame_id。

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
<!-- -*- mode: XML -*- -->
<!-- run velodyne_pointcloud/CloudNodelet in a nodelet manager for an VLP-32C -->

<launch>

<!-- declare arguments with default values -->
<arg name="calibration" default="$(find velodyne_pointcloud)/params/VLP-32c-no1.yaml"/>
<arg name="device_ip" default="" />
<arg name="frame_id" default="velodyne" />
<arg name="manager" default="$(arg frame_id)_nodelet_manager" />
<arg name="max_range" default="130.0" />
<arg name="min_range" default="0.4" />
<arg name="pcap" default="" />
<arg name="port" default="2368" />
<arg name="read_fast" default="false" />
<arg name="read_once" default="false" />
<arg name="repeat_delay" default="0.0" />
<arg name="rpm" default="600.0" />
<arg name="laserscan_ring" default="-1" />
<arg name="laserscan_resolution" default="0.007" />

<!-- start nodelet manager and driver nodelets -->
<include file="$(find velodyne_driver)/launch/nodelet_manager.launch">
<arg name="device_ip" value="$(arg device_ip)"/>
<arg name="frame_id" value="$(arg frame_id)"/>
<arg name="manager" value="$(arg manager)" />
<arg name="model" value="32C"/>
<arg name="pcap" value="$(arg pcap)"/>
<arg name="port" value="$(arg port)"/>
<arg name="read_fast" value="$(arg read_fast)"/>
<arg name="read_once" value="$(arg read_once)"/>
<arg name="repeat_delay" value="$(arg repeat_delay)"/>
<arg name="rpm" value="$(arg rpm)"/>
</include>

<!-- start cloud nodelet -->
<include file="$(find velodyne_pointcloud)/launch/cloud_nodelet.launch">
<arg name="calibration" value="$(arg calibration)"/>
<arg name="manager" value="$(arg manager)" />
<arg name="max_range" value="$(arg max_range)"/>
<arg name="min_range" value="$(arg min_range)"/>
</include>

<!-- start laserscan nodelet -->
<include file="$(find velodyne_pointcloud)/launch/laserscan_nodelet.launch">
<arg name="manager" value="$(arg manager)" />
<arg name="ring" value="$(arg laserscan_ring)"/>
<arg name="resolution" value="$(arg laserscan_resolution)"/>
</include>

</launch>

2个或多个激光雷达驱动

setup 1. 设置电脑IP,地址:192.168.1.200,子网掩码255.255.255.0,网关192.168.1.1。

setup 2. 依次连接激光雷达到电脑,浏览器输入192.168.1.201(默认的激光雷达IP地址),出现激光雷达的设置界面,修改IP与端口,并记录清楚。

setup 3. 以下launch文件,每个ns代表一个激光雷达,其中需要修改calibration文件、device_ip、frame_id、port,对应激光雷达区分清楚。

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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<!-- -*- mode: XML -*- -->
<!-- run velodyne_pointcloud/CloudNodelet in a nodelet manager for an VLP-32C -->

<launch>


<!-- For 1st velodyne -->
<group ns="ns1">

<!-- declare arguments with default values -->
<arg name="calibration" default="$(find velodyne_pointcloud)/params/VLP32C-NO1.yaml"/>
<arg name="device_ip" default="192.168.1.201" />
<arg name="frame_id" default="velodyne" />
<arg name="manager" default="$(arg frame_id)_nodelet_manager" />
<arg name="max_range" default="130.0" />
<arg name="min_range" default="0.4" />
<arg name="pcap" default="" />
<arg name="port" default="2368" />
<arg name="read_fast" default="false" />
<arg name="read_once" default="false" />
<arg name="repeat_delay" default="0.0" />
<arg name="rpm" default="600.0" />
<!-- arg name="laserscan_ring" default="-1" /-->
<!-- arg name="laserscan_resolution" default="0.007" /-->

<!-- start nodelet manager and driver nodelets -->
<include file="$(find velodyne_driver)/launch/nodelet_manager.launch">
<arg name="device_ip" value="$(arg device_ip)"/>
<arg name="frame_id" value="$(arg frame_id)"/>
<arg name="manager" value="$(arg manager)" />
<arg name="model" value="32C"/>
<arg name="pcap" value="$(arg pcap)"/>
<arg name="port" value="$(arg port)"/>
<arg name="read_fast" value="$(arg read_fast)"/>
<arg name="read_once" value="$(arg read_once)"/>
<arg name="repeat_delay" value="$(arg repeat_delay)"/>
<arg name="rpm" value="$(arg rpm)"/>
</include>

<!-- start cloud nodelet -->
<include file="$(find velodyne_pointcloud)/launch/cloud_nodelet.launch">
<arg name="calibration" value="$(arg calibration)"/>
<arg name="manager" value="$(arg manager)" />
<arg name="max_range" value="$(arg max_range)"/>
<arg name="min_range" value="$(arg min_range)"/>
</include>

<!-- start laserscan nodelet
<include file="$(find velodyne_pointcloud)/launch/laserscan_nodelet.launch">
<arg name="manager" value="$(arg manager)" />
<arg name="ring" value="$(arg laserscan_ring)"/>
<arg name="resolution" value="$(arg laserscan_resolution)"/>
</include> -->

</group>



<!-- For 2nd velodyne -->
<group ns="ns2">

<!-- declare arguments with default values -->
<arg name="calibration" default="$(find velodyne_pointcloud)/params/VLP32C-NO2.yaml"/>
<arg name="device_ip" default="192.168.1.202" />
<arg name="frame_id" default="velodyne" />
<arg name="manager" default="$(arg frame_id)_nodelet_manager" />
<arg name="max_range" default="130.0" />
<arg name="min_range" default="0.4" />
<arg name="pcap" default="" />
<arg name="port" default="2369" />
<arg name="read_fast" default="false" />
<arg name="read_once" default="false" />
<arg name="repeat_delay" default="0.0" />
<arg name="rpm" default="600.0" />
<!-- arg name="laserscan_ring" default="-1" /-->
<!-- arg name="laserscan_resolution" default="0.007" /-->

<!-- start nodelet manager and driver nodelets -->
<include file="$(find velodyne_driver)/launch/nodelet_manager.launch">
<arg name="device_ip" value="$(arg device_ip)"/>
<arg name="frame_id" value="$(arg frame_id)"/>
<arg name="manager" value="$(arg manager)" />
<arg name="model" value="32C"/>
<arg name="pcap" value="$(arg pcap)"/>
<arg name="port" value="$(arg port)"/>
<arg name="read_fast" value="$(arg read_fast)"/>
<arg name="read_once" value="$(arg read_once)"/>
<arg name="repeat_delay" value="$(arg repeat_delay)"/>
<arg name="rpm" value="$(arg rpm)"/>
</include>

<!-- start cloud nodelet -->
<include file="$(find velodyne_pointcloud)/launch/cloud_nodelet.launch">
<arg name="calibration" value="$(arg calibration)"/>
<arg name="manager" value="$(arg manager)" />
<arg name="max_range" value="$(arg max_range)"/>
<arg name="min_range" value="$(arg min_range)"/>
</include>

<!-- start laserscan nodelet
<include file="$(find velodyne_pointcloud)/launch/laserscan_nodelet.launch">
<arg name="manager" value="$(arg manager)" />
<arg name="ring" value="$(arg laserscan_ring)"/>
<arg name="resolution" value="$(arg laserscan_resolution)"/>
</include> -->

</group>



<!-- For 3rd velodyne -->
<group ns="ns3">

<!-- declare arguments with default values -->
<arg name="calibration" default="$(find velodyne_pointcloud)/params/VLP32C-NO3.yaml"/>
<arg name="device_ip" default="192.168.1.203" />
<arg name="frame_id" default="velodyne" />
<arg name="manager" default="$(arg frame_id)_nodelet_manager" />
<arg name="max_range" default="130.0" />
<arg name="min_range" default="0.4" />
<arg name="pcap" default="" />
<arg name="port" default="2370" />
<arg name="read_fast" default="false" />
<arg name="read_once" default="false" />
<arg name="repeat_delay" default="0.0" />
<arg name="rpm" default="600.0" />
<!-- arg name="laserscan_ring" default="-1" /-->
<!-- arg name="laserscan_resolution" default="0.007" /-->

<!-- start nodelet manager and driver nodelets -->
<include file="$(find velodyne_driver)/launch/nodelet_manager.launch">
<arg name="device_ip" value="$(arg device_ip)"/>
<arg name="frame_id" value="$(arg frame_id)"/>
<arg name="manager" value="$(arg manager)" />
<arg name="model" value="32C"/>
<arg name="pcap" value="$(arg pcap)"/>
<arg name="port" value="$(arg port)"/>
<arg name="read_fast" value="$(arg read_fast)"/>
<arg name="read_once" value="$(arg read_once)"/>
<arg name="repeat_delay" value="$(arg repeat_delay)"/>
<arg name="rpm" value="$(arg rpm)"/>
</include>

<!-- start cloud nodelet -->
<include file="$(find velodyne_pointcloud)/launch/cloud_nodelet.launch">
<arg name="calibration" value="$(arg calibration)"/>
<arg name="manager" value="$(arg manager)" />
<arg name="max_range" value="$(arg max_range)"/>
<arg name="min_range" value="$(arg min_range)"/>
</include>

<!-- start laserscan nodelet
<include file="$(find velodyne_pointcloud)/launch/laserscan_nodelet.launch">
<arg name="manager" value="$(arg manager)" />
<arg name="ring" value="$(arg laserscan_ring)"/>
<arg name="resolution" value="$(arg laserscan_resolution)"/>
</include> -->

</group>



<!-- For 4th velodyne -->
<group ns="ns4">

<!-- declare arguments with default values -->
<arg name="calibration" default="$(find velodyne_pointcloud)/params/VLP32C-NO4.yaml"/>
<arg name="device_ip" default="192.168.1.204" />
<arg name="frame_id" default="velodyne" />
<arg name="manager" default="$(arg frame_id)_nodelet_manager" />
<arg name="max_range" default="130.0" />
<arg name="min_range" default="0.4" />
<arg name="pcap" default="" />
<arg name="port" default="2371" />
<arg name="read_fast" default="false" />
<arg name="read_once" default="false" />
<arg name="repeat_delay" default="0.0" />
<arg name="rpm" default="600.0" />
<!-- arg name="laserscan_ring" default="-1" /-->
<!-- arg name="laserscan_resolution" default="0.007" /-->

<!-- start nodelet manager and driver nodelets -->
<include file="$(find velodyne_driver)/launch/nodelet_manager.launch">
<arg name="device_ip" value="$(arg device_ip)"/>
<arg name="frame_id" value="$(arg frame_id)"/>
<arg name="manager" value="$(arg manager)" />
<arg name="model" value="32C"/>
<arg name="pcap" value="$(arg pcap)"/>
<arg name="port" value="$(arg port)"/>
<arg name="read_fast" value="$(arg read_fast)"/>
<arg name="read_once" value="$(arg read_once)"/>
<arg name="repeat_delay" value="$(arg repeat_delay)"/>
<arg name="rpm" value="$(arg rpm)"/>
</include>

<!-- start cloud nodelet -->
<include file="$(find velodyne_pointcloud)/launch/cloud_nodelet.launch">
<arg name="calibration" value="$(arg calibration)"/>
<arg name="manager" value="$(arg manager)" />
<arg name="max_range" value="$(arg max_range)"/>
<arg name="min_range" value="$(arg min_range)"/>
</include>

<!-- start laserscan nodelet
<include file="$(find velodyne_pointcloud)/launch/laserscan_nodelet.launch">
<arg name="manager" value="$(arg manager)" />
<arg name="ring" value="$(arg laserscan_ring)"/>
<arg name="resolution" value="$(arg laserscan_resolution)"/>
</include> -->

</group>



</launch>