-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path17159399785835.html
432 lines (348 loc) · 19.6 KB
/
17159399785835.html
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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>
Plane Filter - Prepare for the FUTURE
</title>
<link href="atom.xml" rel="alternate" title="Prepare for the FUTURE" type="application/atom+xml">
<link rel="stylesheet" href="asset/css/style.min.css">
<link rel="stylesheet" href="asset/css/doc.css">
<script src="asset/app.js"></script>
</head>
<body>
<section class="hero">
<div class="hero-head">
<nav class="navbar" role="navigation" aria-label="main navigation">
<div class="container">
<div class="navbar-brand">
<a target="_self" class="navbar-item " href="index.html">Home</a>
<a target="_self" class="navbar-item " href="archives.html">Archives</a>
<a role="button" id="navbarSNSRssSwitchBtn" class="navbar-burger burger" aria-label="menu" aria-expanded="false" data-target="navbarSNSRssButtons">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div id="navbarSNSRssButtons" class="navbar-menu">
<div class="navbar-start">
</div>
<div class="navbar-end">
<div class="navbar-item">
<!--buttons start-->
<div class="buttons">
<a href="atom.xml" target="_blank" title="RSS">
<span class="icon is-large has-text-black-bis">
<svg class="svg-inline--fa fa-rss fa-w-14 fa-lg" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="rss" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" data-fa-i2svg=""><path fill="currentColor" d="M128.081 415.959c0 35.369-28.672 64.041-64.041 64.041S0 451.328 0 415.959s28.672-64.041 64.041-64.041 64.04 28.673 64.04 64.041zm175.66 47.25c-8.354-154.6-132.185-278.587-286.95-286.95C7.656 175.765 0 183.105 0 192.253v48.069c0 8.415 6.49 15.472 14.887 16.018 111.832 7.284 201.473 96.702 208.772 208.772.547 8.397 7.604 14.887 16.018 14.887h48.069c9.149.001 16.489-7.655 15.995-16.79zm144.249.288C439.596 229.677 251.465 40.445 16.503 32.01 7.473 31.686 0 38.981 0 48.016v48.068c0 8.625 6.835 15.645 15.453 15.999 191.179 7.839 344.627 161.316 352.465 352.465.353 8.618 7.373 15.453 15.999 15.453h48.068c9.034-.001 16.329-7.474 16.005-16.504z"></path></svg><!-- <i class="fas fa-rss fa-lg"></i> -->
</span>
</a>
</div>
<!--buttons end-->
</div>
</div>
</div>
</div>
</nav>
</div>
<div class="hero-body ct-body"></div>
</section>
<section class="ct-body">
<div class="container">
<div class="columns is-variable bd-klmn-columns is-4 is-centered">
<div class="column is-four-fifths">
<div class="post-body single-content">
<h1 class="title">
Plane Filter
</h1>
<div class="media">
<div class="media-content">
<div class="content">
<p>
<span class="date">2024/05/17</span>
<br />
<span class="tran-tags">Tags:</span>
<a class="tag is-link is-light" href='tag_Dynamic%20Object%20Removal.html'>#Dynamic Object Removal</a>
</p>
</div>
</div>
</div>
</div>
<article class="markdown-body single-content">
<p>本篇文章将对地面点筛选进行进一步研究,以部署到无人机上。</p>
<p>参考代码:<a href="https://github.com/AbangLZU/plane_fit_ground_filter" title="plane_fit_ground_filter">plane_fit_ground_filter</a></p>
<h2><a id="set-up" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>Set Up</h2>
<p>首先git到本地文件夹:</p>
<pre><code class="language-shell">cd home/ubuntu/yn/SLAM/Dynamic_Object_Removing/my_catkin_ws/src/
git clone https://github.com/AbangLZU/plane_fit_ground_filter.git
cd ..
catkin build plane_ground_filter
source devel/setup.bash
</code></pre>
<p><br />
并且下载好对应的实验数据集存放于<code>/home/ubuntu/yn/SLAM/Dynamic_Object_Removing/Dataset/gournd_filter/kitti_2011_09_26_drive_0005_synced.bag</code></p>
<p>接着,分别开四个终端进行运行:</p>
<pre><code class="language-shell"># terminal-1
roscore
# terminal-2
rosrun rviz rviz
# terminal-3
rosbag play /home/ubuntu/yn/SLAM/Dynamic_Object_Removing/Dataset/gournd_filter/kitti_2011_09_26_drive_0005_synced.bag --loop
# terminal-4 (in "home/ubuntu/yn/SLAM/Dynamic_Object_Removing/my_catkin_ws/")
roslaunch plane_ground_filter plane_ground_filter.launch
</code></pre>
<p><br />
然而发现rviz并没有输出,因此需要对rviz进行改动:</p>
<ul>
<li>在rviz的<code>Global Options</code>中,设置<code>Fixed Frame = base_link</code>;</li>
</ul>
<p><img src="media/17159399785835/2024-05-17%2018-10-52%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9B%BE.png" alt="2024-05-17 18-10-52屏幕截图" /></p>
<ul>
<li>在rviz的<code>Display</code>中,添加<code>PointCloud2</code>,并将其中的订阅的topic设为<code>/kitti/velo/pointcloud</code>;</li>
</ul>
<p><img src="media/17159399785835/2024-05-17%2018-11-35%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9B%BE.png" alt="2024-05-17 18-11-35屏幕截图" /></p>
<p>此时便可以看到rviz出现了输出:</p>
<p><img src="media/17159399785835/2024-05-17%2018-12-40%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9B%BE.png" alt="2024-05-17 18-12-40屏幕截图" /></p>
<p>然而点云并没有具体的颜色信息,发现在进行roslaunch时出现如下问题:</p>
<p><img src="media/17159399785835/2024-05-17%2018-13-26%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9B%BE.png" alt="2024-05-17 18-13-26屏幕截图" /></p>
<p>可见,未能正确识别传入点云的<code>intensity</code>和<code>ring</code>信息。</p>
<p>然而经过探索后,发现rviz是可以接收到intensity信息的:当将<code>PointCloud2</code>中的<code>Channel Name</code>改为<code>i</code>后,可以看到此时有了强度信息,而原始的默认情况下,<code>Channel Name = intensity</code>,对比如下:</p>
<p><img src="media/17159399785835/17160968958333.jpg" alt="" /></p>
<p><img src="media/17159399785835/17160971292975.jpg" alt="" /></p>
<p>定位到代码中最开始的ros消息点云格式转换为pcl点云格式的部分:</p>
<pre><code class="language-cpp">// 1.Msg to pointcloud
pcl::PointCloud<VPoint> laserCloudIn;
pcl::fromROSMsg(*in_cloud_ptr, laserCloudIn);
</code></pre>
<p><br />
猜测错误发生在自定义的pcl点云类型<code>VPoint</code>中,找到其定义如下:</p>
<pre><code class="language-cpp">namespace velodyne_pointcloud
{
/** Euclidean Velodyne coordinate, including intensity and ring number. */
struct PointXYZIR
{
PCL_ADD_POINT4D; // quad-word XYZ
float intensity; ///< laser intensity reading
uint16_t ring; ///< laser ring number
EIGEN_MAKE_ALIGNED_OPERATOR_NEW // ensure proper alignment
} EIGEN_ALIGN16;
}; // namespace velodyne_pointcloud
POINT_CLOUD_REGISTER_POINT_STRUCT(velodyne_pointcloud::PointXYZIR,
(float, x, x)(float, y, y)(float, z, z)(float, intensity, intensity)(uint16_t, ring, ring))
#define VPoint velodyne_pointcloud::PointXYZIR
</code></pre>
<p><br />
可以看到<code>VPoint</code>即为<code>velodyne_pointcloud::PointXYZIR</code>,是传统的pcl点云类型<code>PCL_ADD_POINT4D</code>与强度<code>intensity</code>和线束<code>ring</code>信息拼接而成。</p>
<p>进而推测是<strong>由于录制的包中,点云强度信息和线束信息的名称与这里的不相符</strong>,因此尝试将强度<code>intensity</code>修改为<code>i</code>:</p>
<pre><code class="language-cpp">namespace velodyne_pointcloud
{
/** Euclidean Velodyne coordinate, including intensity and ring number. */
struct PointXYZIR
{
PCL_ADD_POINT4D; // quad-word XYZ
float i; ///< laser intensity reading
uint16_t ring; ///< laser ring number
EIGEN_MAKE_ALIGNED_OPERATOR_NEW // ensure proper alignment
} EIGEN_ALIGN16;
}; // namespace velodyne_pointcloud
POINT_CLOUD_REGISTER_POINT_STRUCT(velodyne_pointcloud::PointXYZIR,
(float, x, x)(float, y, y)(float, z, z)(float, i, i)(uint16_t, ring, ring))
#define VPoint velodyne_pointcloud::PointXYZIR
</code></pre>
<p><br />
此时显示如下:</p>
<p><img src="media/17159399785835/17160996389473.jpg" alt="" /></p>
<p>可以看到,已经解决了无法检测到<code>intensity</code>的问题,接下来尝试将<code>ring</code>改为<code>r</code>:</p>
<pre><code class="language-cpp">namespace velodyne_pointcloud
{
/** Euclidean Velodyne coordinate, including intensity and ring number. */
struct PointXYZIR
{
PCL_ADD_POINT4D; // quad-word XYZ
float i; ///< laser intensity reading
uint16_t r; ///< laser ring number
EIGEN_MAKE_ALIGNED_OPERATOR_NEW // ensure proper alignment
} EIGEN_ALIGN16;
}; // namespace velodyne_pointcloud
POINT_CLOUD_REGISTER_POINT_STRUCT(velodyne_pointcloud::PointXYZIR,
(float, x, x)(float, y, y)(float, z, z)(float, i, i)(uint16_t, r, r))
#define VPoint velodyne_pointcloud::PointXYZIR
</code></pre>
<p><br />
然而这样虽然不再显示错误,但是得到的点的<code>r</code>均为0:</p>
<p><img src="media/17159399785835/17161006230274.jpg" alt="" /></p>
<p>然而发现这一切都不是问题:由于我们代码中并没有用到点云的intensity和ring信息,因此只需要观察输出就好。</p>
<p>在rviz中新增两个<code>PointCloud2</code>的展示,分别订阅代码发布的话题<code>/points_no_ground</code>和<code>/points_ground</code>,将其合并输出:</p>
<p><img src="media/17159399785835/17161029760559.jpg" alt="" /></p>
<p>其中我们将地面点标为红色,将非地面点标记为绿色。</p>
<h2><a id="ntu-dataset" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>NTU Dataset</h2>
<p>在<a href="https://ntu-aris.github.io/ntu_viral_dataset/" title="NTU Dataset">link-1</a>中找到其无人机数据集下载,选择室内数据集<code>nya_01</code>进行处理。下载解压后文件夹格式如下:</p>
<pre><code class="language-shell">├── nya_01
│ │── camera_left.yaml
│ │── camera_right.yaml
│ │── imu_v100.yaml
│ │── leica_prism.yaml
│ │── lidar_horz.yaml
│ │── lidar_vert.yaml
│ │── uwb_nodes.yaml
│ │── nya_01.bag
</code></pre>
<p><br />
通过以下命令播放nya_01包:</p>
<pre><code class="language-shell"># terminal-1
roscore
# terminal-2
rosrun rviz rviz
# terminal-3
rosbag play nya_01.bag --loop
</code></pre>
<p><br />
我们得到相关信息为:</p>
<p><img src="media/17159399785835/17161098622190.jpg" alt="" /></p>
<p>接着添加<code>PointCloud2</code>:令其<code>topic=/os1_cloud_node1/points</code>,然而rviz却报错:<code>Displays/Global Options/Fixed Frame</code>为<code>map</code>时,无法获得相应的数据。</p>
<p>我们采用一下方法得到发布点云的<code>frame_id</code>:</p>
<pre><code class="language-shell">$ rostopic list
/clicked_point
/clock
/dji_sdk/attitude
/dji_sdk/gps_health
/dji_sdk/gps_position
/dji_sdk/height_above_takeoff
/dji_sdk/imu
/imu/imu
/imu/magnetic_field
/imu/temperature
/initialpose
/left/image_raw
/leica/pose/relative
/move_base_simple/goal
/node_pos_marker_sc
/node_pos_sc
/os1_cloud_node1/imu
/os1_cloud_node1/points
/os1_cloud_node2/imu
/os1_cloud_node2/points
/right/image_raw
/rosout
/rosout_agg
/tf
/tf_static
/uwb_endorange_info
/uwb_exorange_info
$ rostopic echo /os1_cloud_node1/points | grep frame_id
frame_id: "sensor1/os_sensor"
frame_id: "sensor1/os_sensor"
frame_id: "sensor1/os_sensor"
frame_id: "sensor1/os_sensor"
frame_id: "sensor1/os_sensor"
frame_id: "sensor1/os_sensor"
frame_id: "sensor1/os_sensor"
frame_id: "sensor1/os_sensor"
frame_id: "sensor1/os_sensor"
frame_id: "sensor1/os_sensor"
frame_id: "sensor1/os_sensor"
frame_id: "sensor1/os_sensor"
frame_id: "sensor1/os_sensor"
frame_id: "sensor1/os_sensor"
...
</code></pre>
<p><br />
接着将<code>Displays/Global Options/Fixed Frame</code>改为````sensor1/os_sensor```,此时便得到输出,但是点云数据十分稀疏:</p>
<p><img src="media/17159399785835/17161101788858.jpg" alt="" /></p>
<p>通过改变<code>Display</code>中<code>PointLoud2</code>的<code>size</code>,将其变为<code>0.1m</code>,得到直观点云的俯视图:</p>
<p><img src="media/17159399785835/17161121876561.jpg" alt="" /></p>
<p>然而Outster类型的Lidar的扫描方式和别的不同。</p>
<h2><a id="granary-dataset" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>Granary Dataset</h2>
</article>
<div class="comments-wrap">
<div class="share-comments">
</div>
</div><!-- end comments wrap -->
</div>
</div><!-- end columns -->
</div><!-- end container -->
</section>
<footer class="footer">
<div class="content has-text-centered">
<p>
Copyright © 2019
Powered by <a target="_blank" href="http://www.mweb.im">MWeb</a>,
Theme used <a target="_blank" href="https://bulma.io/">Bulma CSS</a>.
</p>
</div>
</footer>
<style>.mweb-charts{background:#fff;}
body{ box-sizing: border-box;
margin: 0 auto;}
@media print{
pre, code, pre code {
overflow: visible !important;
white-space: pre-wrap !important; /* css-3 */
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
white-space: -pre-wrap !important; /* Opera 4-6 */
white-space: -o-pre-wrap !important; /* Opera 7 */
word-wrap: break-word !important; /* Internet Explorer 5.5+ */
}
html,body{margin:0;padding:4px;}
}
div.code-toolbar {
position: relative;
}
div.code-toolbar > .toolbar {
position: absolute;
z-index: 10;
top: .3em;
right: .2em;
transition: opacity 0.3s ease-in-out;
opacity: 0;
}
div.code-toolbar:hover > .toolbar {
opacity: 1;
}
/* Separate line b/c rules are thrown out if selector is invalid.
IE11 and old Edge versions don't support :focus-within. */
div.code-toolbar:focus-within > .toolbar {
opacity: 1;
}
div.code-toolbar > .toolbar > .toolbar-item {
display: inline-block;
}
div.code-toolbar > .toolbar > .toolbar-item > a {
cursor: pointer;
}
div.code-toolbar > .toolbar > .toolbar-item > button {
background: none;
border: 0;
color: inherit;
font: inherit;
line-height: normal;
overflow: visible;
padding: 0;
-webkit-user-select: none; /* for button */
-moz-user-select: none;
-ms-user-select: none;
}
div.code-toolbar > .toolbar > .toolbar-item > a,
div.code-toolbar > .toolbar > .toolbar-item > button,
div.code-toolbar > .toolbar > .toolbar-item > span {
color: inherit;
font-size: .8em;
padding: 4px .5em;
background: #f5f2f0;
background: rgba(224, 224, 224, 0.4);
box-shadow: 0 2px 0 0 rgba(0,0,0,0.2);
border-radius: .5em;
}
div.code-toolbar > .toolbar > .toolbar-item > a:hover,
div.code-toolbar > .toolbar > .toolbar-item > a:focus,
div.code-toolbar > .toolbar > .toolbar-item > button:hover,
div.code-toolbar > .toolbar > .toolbar-item > button:focus,
div.code-toolbar > .toolbar > .toolbar-item > span:hover,
div.code-toolbar > .toolbar > .toolbar-item > span:focus {
color: inherit;
text-decoration: none;
}
</style><script src="https://cdn.jsdelivr.net/npm/[email protected]/prism.min.js"></script><script src="https://cdn.jsdelivr.net/npm/[email protected]/plugins/line-numbers/prism-line-numbers.min.js"></script><script>!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document){var e=[],t={},n=function(){};Prism.plugins.toolbar={};var a=Prism.plugins.toolbar.registerButton=function(n,a){var r;r="function"==typeof a?a:function(e){var t;return"function"==typeof a.onClick?((t=document.createElement("button")).type="button",t.addEventListener("click",(function(){a.onClick.call(this,e)}))):"string"==typeof a.url?(t=document.createElement("a")).href=a.url:t=document.createElement("span"),a.className&&t.classList.add(a.className),t.textContent=a.text,t},n in t?console.warn('There is a button with the key "'+n+'" registered already.'):e.push(t[n]=r)},r=Prism.plugins.toolbar.hook=function(a){var r=a.element.parentNode;var l=a.element.classList;if(l.contains('language-mermaid') || l.contains('language-echarts') || l.contains('language-plantuml')){return;} if(r&&/pre/i.test(r.nodeName)&&!r.parentNode.classList.contains("code-toolbar")){var o=document.createElement("div");o.classList.add("code-toolbar"),r.parentNode.insertBefore(o,r),o.appendChild(r);var i=document.createElement("div");i.classList.add("toolbar");var l=e,d=function(e){for(;e;){var t=e.getAttribute("data-toolbar-order");if(null!=t)return(t=t.trim()).length?t.split(/\s*,\s*/g):[];e=e.parentElement}}(a.element);d&&(l=d.map((function(e){return t[e]||n}))),l.forEach((function(e){var t=e(a);if(t){var n=document.createElement("div");n.classList.add("toolbar-item"),n.appendChild(t),i.appendChild(n)}})),o.appendChild(i)}};a("label",(function(e){var t=e.element.parentNode;if(t&&/pre/i.test(t.nodeName)&&t.hasAttribute("data-label")){var n,a,r=t.getAttribute("data-label");try{a=document.querySelector("template#"+r)}catch(e){}return a?n=a.content:(t.hasAttribute("data-url")?(n=document.createElement("a")).href=t.getAttribute("data-url"):n=document.createElement("span"),n.textContent=r),n}})),Prism.hooks.add("complete",r)}}();</script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/plugins/toolbar/prism-toolbar.min.css"><script src="https://cdn.jsdelivr.net/npm/[email protected]/plugins/copy-to-clipboard/prism-copy-to-clipboard.min.js"></script><script src="https://cdn.jsdelivr.net/npm/[email protected]/plugins/autoloader/prism-autoloader.min.js"></script><style>div.code-toolbar > .toolbar > .toolbar-item > a, div.code-toolbar > .toolbar > .toolbar-item > button, div.code-toolbar > .toolbar > .toolbar-item > span {padding: 4px .5em; background: #f5f2f0; background: rgba(224, 224, 224, 0.4);}</style>
</body>
</html>