Skip to content

Commit c44343b

Browse files
vividfknzo25
andauthored
refactor(autoware_pointcloud_preprocessor): rework random downsample filter parameters (#8485)
* feat: rework random downsample filter parameter Signed-off-by: vividf <[email protected]> * chore: change name Signed-off-by: vividf <[email protected]> * chore: add explicit cast Signed-off-by: vividf <[email protected]> --------- Signed-off-by: vividf <[email protected]> Co-authored-by: Kenzo Lobos Tsunekawa <[email protected]>
1 parent 75d98c2 commit c44343b

File tree

7 files changed

+52
-17
lines changed

7 files changed

+52
-17
lines changed

sensing/autoware_pointcloud_preprocessor/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ ament_auto_add_library(pointcloud_preprocessor_filter SHARED
6767
src/time_synchronizer/time_synchronizer_node.cpp
6868
src/crop_box_filter/crop_box_filter_nodelet.cpp
6969
src/downsample_filter/voxel_grid_downsample_filter_node.cpp
70-
src/downsample_filter/random_downsample_filter_nodelet.cpp
70+
src/downsample_filter/random_downsample_filter_node.cpp
7171
src/downsample_filter/approximate_downsample_filter_nodelet.cpp
7272
src/downsample_filter/pickup_based_voxel_grid_downsample_filter.cpp
7373
src/outlier_filter/ring_outlier_filter_nodelet.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/**:
2+
ros__parameters:
3+
sample_num: 1500

sensing/autoware_pointcloud_preprocessor/docs/downsample-filter.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ These implementations inherit `autoware::pointcloud_preprocessor::Filter` class,
4444

4545
### Random Downsample Filter
4646

47-
| Name | Type | Default Value | Description |
48-
| ------------ | ---- | ------------- | ------------------------------- |
49-
| `sample_num` | int | 1500 | number of indices to be sampled |
47+
{{ json_to_markdown("sensing/autoware_pointcloud_preprocessor/schema/random_downsample_filter_node.schema.json") }}
5048

5149
### Voxel Grid Downsample Filter
5250

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 Tier IV, Inc.
1+
// Copyright 2024 TIER IV, Inc.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -48,8 +48,8 @@
4848
*
4949
*/
5050

51-
#ifndef AUTOWARE__POINTCLOUD_PREPROCESSOR__DOWNSAMPLE_FILTER__RANDOM_DOWNSAMPLE_FILTER_NODELET_HPP_
52-
#define AUTOWARE__POINTCLOUD_PREPROCESSOR__DOWNSAMPLE_FILTER__RANDOM_DOWNSAMPLE_FILTER_NODELET_HPP_
51+
#ifndef AUTOWARE__POINTCLOUD_PREPROCESSOR__DOWNSAMPLE_FILTER__RANDOM_DOWNSAMPLE_FILTER_NODE_HPP_
52+
#define AUTOWARE__POINTCLOUD_PREPROCESSOR__DOWNSAMPLE_FILTER__RANDOM_DOWNSAMPLE_FILTER_NODE_HPP_
5353

5454
#include "autoware/pointcloud_preprocessor/filter.hpp"
5555

@@ -81,5 +81,5 @@ class RandomDownsampleFilterComponent : public autoware::pointcloud_preprocessor
8181
} // namespace autoware::pointcloud_preprocessor
8282

8383
// clang-format off
84-
#endif // AUTOWARE__POINTCLOUD_PREPROCESSOR__DOWNSAMPLE_FILTER__RANDOM_DOWNSAMPLE_FILTER_NODELET_HPP_ // NOLINT
84+
#endif // AUTOWARE__POINTCLOUD_PREPROCESSOR__DOWNSAMPLE_FILTER__RANDOM_DOWNSAMPLE_FILTER_NODE_HPP_ // NOLINT
8585
// clang-format on

sensing/autoware_pointcloud_preprocessor/launch/random_downsample_filter.launch.xml renamed to sensing/autoware_pointcloud_preprocessor/launch/random_downsample_filter_node.launch.xml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<launch>
22
<arg name="input_topic_name" default="/sensing/lidar/top/pointcloud_raw"/>
33
<arg name="output_topic_name" default="/sensing/lidar/top/random_downsample_filter/pointcloud"/>
4-
5-
<arg name="sample_num" default="1500"/>
64
<arg name="input_frame" default=""/>
7-
<arg name="output_frame" default="base_link"/>
5+
<arg name="output_frame" default=""/>
6+
<arg name="random_downsample_filter_param_file" default="$(find-pkg-share autoware_pointcloud_preprocessor)/config/random_downsample_filter_node.param.yaml"/>
7+
<arg name="filter_param_file" default="$(find-pkg-share autoware_pointcloud_preprocessor)/config/filter.param.yaml"/>
88

9-
<node pkg="autoware_pointcloud_preprocessor" exec="random_downsample_filter_node" name="random_downsample_filter">
9+
<node pkg="autoware_pointcloud_preprocessor" exec="random_downsample_filter_node" name="random_downsample_filter_node">
10+
<param from="$(var random_downsample_filter_param_file)"/>
11+
<param from="$(var filter_param_file)"/>
1012
<remap from="input" to="$(var input_topic_name)"/>
1113
<remap from="output" to="$(var output_topic_name)"/>
12-
13-
<param name="sample_num" value="$(var sample_num)"/>
1414
<param name="input_frame" value="$(var input_frame)"/>
1515
<param name="output_frame" value="$(var output_frame)"/>
1616
</node>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "Parameters for Random Downsample Filter Node",
4+
"type": "object",
5+
"definitions": {
6+
"random_downsample_filter": {
7+
"type": "object",
8+
"properties": {
9+
"sample_num": {
10+
"type": "integer",
11+
"minimum": 0,
12+
"description": "number of indices to be sampled",
13+
"default": "1500"
14+
}
15+
},
16+
"required": ["sample_num"],
17+
"additionalProperties": false
18+
}
19+
},
20+
"properties": {
21+
"/**": {
22+
"type": "object",
23+
"properties": {
24+
"ros__parameters": {
25+
"$ref": "#/definitions/random_downsample_filter"
26+
}
27+
},
28+
"required": ["ros__parameters"],
29+
"additionalProperties": false
30+
}
31+
},
32+
"required": ["/**"],
33+
"additionalProperties": false
34+
}
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 Tier IV, Inc.
1+
// Copyright 2024 TIER IV, Inc.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@
4646
*
4747
*/
4848

49-
#include "autoware/pointcloud_preprocessor/downsample_filter/random_downsample_filter_nodelet.hpp"
49+
#include "autoware/pointcloud_preprocessor/downsample_filter/random_downsample_filter_node.hpp"
5050

5151
#include <vector>
5252

@@ -58,7 +58,7 @@ RandomDownsampleFilterComponent::RandomDownsampleFilterComponent(
5858
{
5959
// set initial parameters
6060
{
61-
sample_num_ = static_cast<size_t>(declare_parameter("sample_num", 1500));
61+
sample_num_ = static_cast<size_t>(declare_parameter<int64_t>("sample_num"));
6262
}
6363

6464
using std::placeholders::_1;

0 commit comments

Comments
 (0)