From 6ffc3e60b9c416668d7ae492188a9f4b8bed6a8f Mon Sep 17 00:00:00 2001 From: vividf Date: Thu, 15 Aug 2024 15:40:02 +0900 Subject: [PATCH 1/3] feat: rework random downsample filter parameter Signed-off-by: vividf --- .../CMakeLists.txt | 2 +- .../random_downsample_filter_node.param.yaml | 3 ++ .../docs/downsample-filter.md | 4 +-- ....hpp => random_downsample_filter_node.hpp} | 6 ++-- ... random_downsample_filter_node.launch.xml} | 12 +++---- .../random_downsample_filter_node.schema.json | 34 +++++++++++++++++++ ....cpp => random_downsample_filter_node.cpp} | 6 ++-- 7 files changed, 51 insertions(+), 16 deletions(-) create mode 100644 sensing/autoware_pointcloud_preprocessor/config/random_downsample_filter_node.param.yaml rename sensing/autoware_pointcloud_preprocessor/include/autoware/pointcloud_preprocessor/downsample_filter/{random_downsample_filter_nodelet.hpp => random_downsample_filter_node.hpp} (96%) rename sensing/autoware_pointcloud_preprocessor/launch/{random_downsample_filter.launch.xml => random_downsample_filter_node.launch.xml} (52%) create mode 100644 sensing/autoware_pointcloud_preprocessor/schema/random_downsample_filter_node.schema.json rename sensing/autoware_pointcloud_preprocessor/src/downsample_filter/{random_downsample_filter_nodelet.cpp => random_downsample_filter_node.cpp} (96%) diff --git a/sensing/autoware_pointcloud_preprocessor/CMakeLists.txt b/sensing/autoware_pointcloud_preprocessor/CMakeLists.txt index 744bac480e058..5def0355085e6 100644 --- a/sensing/autoware_pointcloud_preprocessor/CMakeLists.txt +++ b/sensing/autoware_pointcloud_preprocessor/CMakeLists.txt @@ -67,7 +67,7 @@ ament_auto_add_library(pointcloud_preprocessor_filter SHARED src/time_synchronizer/time_synchronizer_nodelet.cpp src/crop_box_filter/crop_box_filter_nodelet.cpp src/downsample_filter/voxel_grid_downsample_filter_nodelet.cpp - src/downsample_filter/random_downsample_filter_nodelet.cpp + src/downsample_filter/random_downsample_filter_node.cpp src/downsample_filter/approximate_downsample_filter_nodelet.cpp src/downsample_filter/pickup_based_voxel_grid_downsample_filter.cpp src/outlier_filter/ring_outlier_filter_nodelet.cpp diff --git a/sensing/autoware_pointcloud_preprocessor/config/random_downsample_filter_node.param.yaml b/sensing/autoware_pointcloud_preprocessor/config/random_downsample_filter_node.param.yaml new file mode 100644 index 0000000000000..53be849e0af22 --- /dev/null +++ b/sensing/autoware_pointcloud_preprocessor/config/random_downsample_filter_node.param.yaml @@ -0,0 +1,3 @@ +/**: + ros__parameters: + sample_num: 1500 diff --git a/sensing/autoware_pointcloud_preprocessor/docs/downsample-filter.md b/sensing/autoware_pointcloud_preprocessor/docs/downsample-filter.md index ac721171cb014..2dd3e3568511e 100644 --- a/sensing/autoware_pointcloud_preprocessor/docs/downsample-filter.md +++ b/sensing/autoware_pointcloud_preprocessor/docs/downsample-filter.md @@ -44,9 +44,7 @@ These implementations inherit `autoware::pointcloud_preprocessor::Filter` class, ### Random Downsample Filter -| Name | Type | Default Value | Description | -| ------------ | ---- | ------------- | ------------------------------- | -| `sample_num` | int | 1500 | number of indices to be sampled | +{{ json_to_markdown("sensing/autoware_pointcloud_preprocessor/schema/random_downsample_filter_node.schema.json") }} ### Voxel Grid Downsample Filter diff --git a/sensing/autoware_pointcloud_preprocessor/include/autoware/pointcloud_preprocessor/downsample_filter/random_downsample_filter_nodelet.hpp b/sensing/autoware_pointcloud_preprocessor/include/autoware/pointcloud_preprocessor/downsample_filter/random_downsample_filter_node.hpp similarity index 96% rename from sensing/autoware_pointcloud_preprocessor/include/autoware/pointcloud_preprocessor/downsample_filter/random_downsample_filter_nodelet.hpp rename to sensing/autoware_pointcloud_preprocessor/include/autoware/pointcloud_preprocessor/downsample_filter/random_downsample_filter_node.hpp index f820793fb86f8..af11fc3547701 100644 --- a/sensing/autoware_pointcloud_preprocessor/include/autoware/pointcloud_preprocessor/downsample_filter/random_downsample_filter_nodelet.hpp +++ b/sensing/autoware_pointcloud_preprocessor/include/autoware/pointcloud_preprocessor/downsample_filter/random_downsample_filter_node.hpp @@ -48,8 +48,8 @@ * */ -#ifndef AUTOWARE__POINTCLOUD_PREPROCESSOR__DOWNSAMPLE_FILTER__RANDOM_DOWNSAMPLE_FILTER_NODELET_HPP_ -#define AUTOWARE__POINTCLOUD_PREPROCESSOR__DOWNSAMPLE_FILTER__RANDOM_DOWNSAMPLE_FILTER_NODELET_HPP_ +#ifndef AUTOWARE__POINTCLOUD_PREPROCESSOR__DOWNSAMPLE_FILTER__RANDOM_DOWNSAMPLE_FILTER_NODE_HPP_ +#define AUTOWARE__POINTCLOUD_PREPROCESSOR__DOWNSAMPLE_FILTER__RANDOM_DOWNSAMPLE_FILTER_NODE_HPP_ #include "autoware/pointcloud_preprocessor/filter.hpp" @@ -81,5 +81,5 @@ class RandomDownsampleFilterComponent : public autoware::pointcloud_preprocessor } // namespace autoware::pointcloud_preprocessor // clang-format off -#endif // AUTOWARE__POINTCLOUD_PREPROCESSOR__DOWNSAMPLE_FILTER__RANDOM_DOWNSAMPLE_FILTER_NODELET_HPP_ // NOLINT +#endif // AUTOWARE__POINTCLOUD_PREPROCESSOR__DOWNSAMPLE_FILTER__RANDOM_DOWNSAMPLE_FILTER_NODE_HPP_ // NOLINT // clang-format on diff --git a/sensing/autoware_pointcloud_preprocessor/launch/random_downsample_filter.launch.xml b/sensing/autoware_pointcloud_preprocessor/launch/random_downsample_filter_node.launch.xml similarity index 52% rename from sensing/autoware_pointcloud_preprocessor/launch/random_downsample_filter.launch.xml rename to sensing/autoware_pointcloud_preprocessor/launch/random_downsample_filter_node.launch.xml index c9d0bc3ce0608..4663cece6ea60 100644 --- a/sensing/autoware_pointcloud_preprocessor/launch/random_downsample_filter.launch.xml +++ b/sensing/autoware_pointcloud_preprocessor/launch/random_downsample_filter_node.launch.xml @@ -1,16 +1,16 @@ - - - + + + - + + + - - diff --git a/sensing/autoware_pointcloud_preprocessor/schema/random_downsample_filter_node.schema.json b/sensing/autoware_pointcloud_preprocessor/schema/random_downsample_filter_node.schema.json new file mode 100644 index 0000000000000..cc31cf93e9980 --- /dev/null +++ b/sensing/autoware_pointcloud_preprocessor/schema/random_downsample_filter_node.schema.json @@ -0,0 +1,34 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Parameters for Random Downsample Filter Node", + "type": "object", + "definitions": { + "random_downsample_filter": { + "type": "object", + "properties": { + "sample_num": { + "type": "integer", + "minimum": 0, + "description": "number of indices to be sampled", + "default": "1500" + } + }, + "required": ["sample_num"], + "additionalProperties": false + } + }, + "properties": { + "/**": { + "type": "object", + "properties": { + "ros__parameters": { + "$ref": "#/definitions/random_downsample_filter" + } + }, + "required": ["ros__parameters"], + "additionalProperties": false + } + }, + "required": ["/**"], + "additionalProperties": false +} diff --git a/sensing/autoware_pointcloud_preprocessor/src/downsample_filter/random_downsample_filter_nodelet.cpp b/sensing/autoware_pointcloud_preprocessor/src/downsample_filter/random_downsample_filter_node.cpp similarity index 96% rename from sensing/autoware_pointcloud_preprocessor/src/downsample_filter/random_downsample_filter_nodelet.cpp rename to sensing/autoware_pointcloud_preprocessor/src/downsample_filter/random_downsample_filter_node.cpp index 32abafb759b73..ce0767c4a9a58 100644 --- a/sensing/autoware_pointcloud_preprocessor/src/downsample_filter/random_downsample_filter_nodelet.cpp +++ b/sensing/autoware_pointcloud_preprocessor/src/downsample_filter/random_downsample_filter_node.cpp @@ -1,4 +1,4 @@ -// Copyright 2020 Tier IV, Inc. +// Copyright 2024 TIER IV, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ * */ -#include "autoware/pointcloud_preprocessor/downsample_filter/random_downsample_filter_nodelet.hpp" +#include "autoware/pointcloud_preprocessor/downsample_filter/random_downsample_filter_node.hpp" #include @@ -58,7 +58,7 @@ RandomDownsampleFilterComponent::RandomDownsampleFilterComponent( { // set initial parameters { - sample_num_ = static_cast(declare_parameter("sample_num", 1500)); + sample_num_ = declare_parameter("sample_num"); } using std::placeholders::_1; From 5284455a04ab3aeb8ef910ac3b27b7919e1c66c8 Mon Sep 17 00:00:00 2001 From: vividf Date: Thu, 15 Aug 2024 15:41:14 +0900 Subject: [PATCH 2/3] chore: change name Signed-off-by: vividf --- .../downsample_filter/random_downsample_filter_node.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sensing/autoware_pointcloud_preprocessor/include/autoware/pointcloud_preprocessor/downsample_filter/random_downsample_filter_node.hpp b/sensing/autoware_pointcloud_preprocessor/include/autoware/pointcloud_preprocessor/downsample_filter/random_downsample_filter_node.hpp index af11fc3547701..aae6633d2a9e7 100644 --- a/sensing/autoware_pointcloud_preprocessor/include/autoware/pointcloud_preprocessor/downsample_filter/random_downsample_filter_node.hpp +++ b/sensing/autoware_pointcloud_preprocessor/include/autoware/pointcloud_preprocessor/downsample_filter/random_downsample_filter_node.hpp @@ -1,4 +1,4 @@ -// Copyright 2020 Tier IV, Inc. +// Copyright 2024 TIER IV, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. From 9d3fb7ff15c1fbd004c546b3f6db3e361b99a2dc Mon Sep 17 00:00:00 2001 From: vividf Date: Tue, 20 Aug 2024 17:13:18 +0900 Subject: [PATCH 3/3] chore: add explicit cast Signed-off-by: vividf --- .../src/downsample_filter/random_downsample_filter_node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sensing/autoware_pointcloud_preprocessor/src/downsample_filter/random_downsample_filter_node.cpp b/sensing/autoware_pointcloud_preprocessor/src/downsample_filter/random_downsample_filter_node.cpp index ce0767c4a9a58..84350857d668b 100644 --- a/sensing/autoware_pointcloud_preprocessor/src/downsample_filter/random_downsample_filter_node.cpp +++ b/sensing/autoware_pointcloud_preprocessor/src/downsample_filter/random_downsample_filter_node.cpp @@ -58,7 +58,7 @@ RandomDownsampleFilterComponent::RandomDownsampleFilterComponent( { // set initial parameters { - sample_num_ = declare_parameter("sample_num"); + sample_num_ = static_cast(declare_parameter("sample_num")); } using std::placeholders::_1;