From 4c5486ec721dcdaa5b27d15dced444ffea1245f6 Mon Sep 17 00:00:00 2001 From: vividf Date: Thu, 15 Aug 2024 16:04:36 +0900 Subject: [PATCH 1/3] feat: rework pointcloud accumulator parameters Signed-off-by: vividf --- .../CMakeLists.txt | 2 +- .../pointcloud_accumulator_node.param.yaml | 4 ++ .../docs/pointcloud-accumulator.md | 5 +-- ...et.hpp => pointcloud_accumulator_node.hpp} | 8 ++-- .../pointcloud_accumulator_node.launch.xml | 16 ++++++++ .../pointcloud_accumulator_node.schema.json | 38 +++++++++++++++++++ ...et.cpp => pointcloud_accumulator_node.cpp} | 9 ++--- 7 files changed, 68 insertions(+), 14 deletions(-) create mode 100644 sensing/autoware_pointcloud_preprocessor/config/pointcloud_accumulator_node.param.yaml rename sensing/autoware_pointcloud_preprocessor/include/autoware/pointcloud_preprocessor/pointcloud_accumulator/{pointcloud_accumulator_nodelet.hpp => pointcloud_accumulator_node.hpp} (90%) create mode 100644 sensing/autoware_pointcloud_preprocessor/launch/pointcloud_accumulator_node.launch.xml create mode 100644 sensing/autoware_pointcloud_preprocessor/schema/pointcloud_accumulator_node.schema.json rename sensing/autoware_pointcloud_preprocessor/src/pointcloud_accumulator/{pointcloud_accumulator_nodelet.cpp => pointcloud_accumulator_node.cpp} (90%) diff --git a/sensing/autoware_pointcloud_preprocessor/CMakeLists.txt b/sensing/autoware_pointcloud_preprocessor/CMakeLists.txt index 744bac480e058..79b8144441d73 100644 --- a/sensing/autoware_pointcloud_preprocessor/CMakeLists.txt +++ b/sensing/autoware_pointcloud_preprocessor/CMakeLists.txt @@ -77,7 +77,7 @@ ament_auto_add_library(pointcloud_preprocessor_filter SHARED src/passthrough_filter/passthrough_filter_nodelet.cpp src/passthrough_filter/passthrough_filter_uint16_nodelet.cpp src/passthrough_filter/passthrough_uint16.cpp - src/pointcloud_accumulator/pointcloud_accumulator_nodelet.cpp + src/pointcloud_accumulator/pointcloud_accumulator_node.cpp src/vector_map_filter/lanelet2_map_filter_nodelet.cpp src/distortion_corrector/distortion_corrector.cpp src/distortion_corrector/distortion_corrector_node.cpp diff --git a/sensing/autoware_pointcloud_preprocessor/config/pointcloud_accumulator_node.param.yaml b/sensing/autoware_pointcloud_preprocessor/config/pointcloud_accumulator_node.param.yaml new file mode 100644 index 0000000000000..37ce94696db42 --- /dev/null +++ b/sensing/autoware_pointcloud_preprocessor/config/pointcloud_accumulator_node.param.yaml @@ -0,0 +1,4 @@ +/**: + ros__parameters: + accumulation_time_sec: 2.0 + pointcloud_buffer_size: 50 diff --git a/sensing/autoware_pointcloud_preprocessor/docs/pointcloud-accumulator.md b/sensing/autoware_pointcloud_preprocessor/docs/pointcloud-accumulator.md index d9fa56ca9c995..0ae2d80a8b392 100644 --- a/sensing/autoware_pointcloud_preprocessor/docs/pointcloud-accumulator.md +++ b/sensing/autoware_pointcloud_preprocessor/docs/pointcloud-accumulator.md @@ -24,10 +24,7 @@ The `pointcloud_accumulator` is a node that accumulates pointclouds for a given ### Core Parameters -| Name | Type | Default Value | Description | -| ------------------------ | ------ | ------------- | ----------------------- | -| `accumulation_time_sec` | double | 2.0 | accumulation period [s] | -| `pointcloud_buffer_size` | int | 50 | buffer size | +{{ json_to_markdown("sensing/autoware_pointcloud_preprocessor/schema/pointcloud_accumulator_node.schema.json") }} ## Assumptions / Known limits diff --git a/sensing/autoware_pointcloud_preprocessor/include/autoware/pointcloud_preprocessor/pointcloud_accumulator/pointcloud_accumulator_nodelet.hpp b/sensing/autoware_pointcloud_preprocessor/include/autoware/pointcloud_preprocessor/pointcloud_accumulator/pointcloud_accumulator_node.hpp similarity index 90% rename from sensing/autoware_pointcloud_preprocessor/include/autoware/pointcloud_preprocessor/pointcloud_accumulator/pointcloud_accumulator_nodelet.hpp rename to sensing/autoware_pointcloud_preprocessor/include/autoware/pointcloud_preprocessor/pointcloud_accumulator/pointcloud_accumulator_node.hpp index 6646426a29b99..920aff7270801 100644 --- a/sensing/autoware_pointcloud_preprocessor/include/autoware/pointcloud_preprocessor/pointcloud_accumulator/pointcloud_accumulator_nodelet.hpp +++ b/sensing/autoware_pointcloud_preprocessor/include/autoware/pointcloud_preprocessor/pointcloud_accumulator/pointcloud_accumulator_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. @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef AUTOWARE__POINTCLOUD_PREPROCESSOR__POINTCLOUD_ACCUMULATOR__POINTCLOUD_ACCUMULATOR_NODELET_HPP_ // NOLINT -#define AUTOWARE__POINTCLOUD_PREPROCESSOR__POINTCLOUD_ACCUMULATOR__POINTCLOUD_ACCUMULATOR_NODELET_HPP_ // NOLINT +#ifndef AUTOWARE__POINTCLOUD_PREPROCESSOR__POINTCLOUD_ACCUMULATOR__POINTCLOUD_ACCUMULATOR_NODE_HPP_ // NOLINT +#define AUTOWARE__POINTCLOUD_PREPROCESSOR__POINTCLOUD_ACCUMULATOR__POINTCLOUD_ACCUMULATOR_NODE_HPP_ // NOLINT #include "autoware/pointcloud_preprocessor/filter.hpp" @@ -46,5 +46,5 @@ class PointcloudAccumulatorComponent : public autoware::pointcloud_preprocessor: } // namespace autoware::pointcloud_preprocessor // clang-format off -#endif // AUTOWARE__POINTCLOUD_PREPROCESSOR__POINTCLOUD_ACCUMULATOR__POINTCLOUD_ACCUMULATOR_NODELET_HPP_ // NOLINT +#endif // AUTOWARE__POINTCLOUD_PREPROCESSOR__POINTCLOUD_ACCUMULATOR__POINTCLOUD_ACCUMULATOR_NODE_HPP_ // NOLINT // clang-format on diff --git a/sensing/autoware_pointcloud_preprocessor/launch/pointcloud_accumulator_node.launch.xml b/sensing/autoware_pointcloud_preprocessor/launch/pointcloud_accumulator_node.launch.xml new file mode 100644 index 0000000000000..3f132a1586a36 --- /dev/null +++ b/sensing/autoware_pointcloud_preprocessor/launch/pointcloud_accumulator_node.launch.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/sensing/autoware_pointcloud_preprocessor/schema/pointcloud_accumulator_node.schema.json b/sensing/autoware_pointcloud_preprocessor/schema/pointcloud_accumulator_node.schema.json new file mode 100644 index 0000000000000..acf180c5bb1b9 --- /dev/null +++ b/sensing/autoware_pointcloud_preprocessor/schema/pointcloud_accumulator_node.schema.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Parameters for Pointcloud Accumulator Node", + "type": "object", + "definitions": { + "pointcloud_accumulator": { + "type": "object", + "properties": { + "accumulation_time_sec": { + "type": "number", + "description": "accumulation period [s]", + "default": "2.0" + }, + "pointcloud_buffer_size": { + "type": "integer", + "description": "buffer size", + "default": "50" + } + }, + "required": ["accumulation_time_sec", "pointcloud_buffer_size"], + "additionalProperties": false + } + }, + "properties": { + "/**": { + "type": "object", + "properties": { + "ros__parameters": { + "$ref": "#/definitions/pointcloud_accumulator" + } + }, + "required": ["ros__parameters"], + "additionalProperties": false + } + }, + "required": ["/**"], + "additionalProperties": false +} diff --git a/sensing/autoware_pointcloud_preprocessor/src/pointcloud_accumulator/pointcloud_accumulator_nodelet.cpp b/sensing/autoware_pointcloud_preprocessor/src/pointcloud_accumulator/pointcloud_accumulator_node.cpp similarity index 90% rename from sensing/autoware_pointcloud_preprocessor/src/pointcloud_accumulator/pointcloud_accumulator_nodelet.cpp rename to sensing/autoware_pointcloud_preprocessor/src/pointcloud_accumulator/pointcloud_accumulator_node.cpp index 9502add4b38ce..e350c3d18e920 100644 --- a/sensing/autoware_pointcloud_preprocessor/src/pointcloud_accumulator/pointcloud_accumulator_nodelet.cpp +++ b/sensing/autoware_pointcloud_preprocessor/src/pointcloud_accumulator/pointcloud_accumulator_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. @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "autoware/pointcloud_preprocessor/pointcloud_accumulator/pointcloud_accumulator_nodelet.hpp" +#include "autoware/pointcloud_preprocessor/pointcloud_accumulator/pointcloud_accumulator_node.hpp" #include @@ -23,9 +23,8 @@ PointcloudAccumulatorComponent::PointcloudAccumulatorComponent(const rclcpp::Nod { // set initial parameters { - accumulation_time_sec_ = static_cast(declare_parameter("accumulation_time_sec", 2.0)); - pointcloud_buffer_.set_capacity( - static_cast(declare_parameter("pointcloud_buffer_size", 50))); + accumulation_time_sec_ = declare_parameter("accumulation_time_sec"); + pointcloud_buffer_.set_capacity(declare_parameter("pointcloud_buffer_size")); } using std::placeholders::_1; From e125de73b329a76be7c625ce1cf11a3fb01f2f16 Mon Sep 17 00:00:00 2001 From: vividf Date: Tue, 20 Aug 2024 17:17:08 +0900 Subject: [PATCH 2/3] chore: add explicit cast Signed-off-by: vividf --- .../src/pointcloud_accumulator/pointcloud_accumulator_node.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sensing/autoware_pointcloud_preprocessor/src/pointcloud_accumulator/pointcloud_accumulator_node.cpp b/sensing/autoware_pointcloud_preprocessor/src/pointcloud_accumulator/pointcloud_accumulator_node.cpp index e350c3d18e920..30eeada6d5a2a 100644 --- a/sensing/autoware_pointcloud_preprocessor/src/pointcloud_accumulator/pointcloud_accumulator_node.cpp +++ b/sensing/autoware_pointcloud_preprocessor/src/pointcloud_accumulator/pointcloud_accumulator_node.cpp @@ -24,7 +24,8 @@ PointcloudAccumulatorComponent::PointcloudAccumulatorComponent(const rclcpp::Nod // set initial parameters { accumulation_time_sec_ = declare_parameter("accumulation_time_sec"); - pointcloud_buffer_.set_capacity(declare_parameter("pointcloud_buffer_size")); + pointcloud_buffer_.set_capacity( + static_cast(declare_parameter("pointcloud_buffer_size"))); } using std::placeholders::_1; From 3d9c7d890d44f2f31fc71721f8c2f6b751d550bb Mon Sep 17 00:00:00 2001 From: vividf Date: Tue, 20 Aug 2024 17:19:16 +0900 Subject: [PATCH 3/3] chore: add boundary Signed-off-by: vividf --- .../schema/pointcloud_accumulator_node.schema.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sensing/autoware_pointcloud_preprocessor/schema/pointcloud_accumulator_node.schema.json b/sensing/autoware_pointcloud_preprocessor/schema/pointcloud_accumulator_node.schema.json index acf180c5bb1b9..bcc18c8f0b013 100644 --- a/sensing/autoware_pointcloud_preprocessor/schema/pointcloud_accumulator_node.schema.json +++ b/sensing/autoware_pointcloud_preprocessor/schema/pointcloud_accumulator_node.schema.json @@ -9,12 +9,14 @@ "accumulation_time_sec": { "type": "number", "description": "accumulation period [s]", - "default": "2.0" + "default": "2.0", + "minimum": 0 }, "pointcloud_buffer_size": { "type": "integer", "description": "buffer size", - "default": "50" + "default": "50", + "minimum": 0 } }, "required": ["accumulation_time_sec", "pointcloud_buffer_size"],