From 918a4d6431f79e54ccad85086903c11bdf2365b0 Mon Sep 17 00:00:00 2001 From: oguzkaganozt Date: Fri, 26 Apr 2024 11:17:57 +0300 Subject: [PATCH] refactor(sensing/livox_tag_filter): rework parameters (#6743) * add param and schema file Signed-off-by: oguzkaganozt * style(pre-commit): autofix --------- Signed-off-by: oguzkaganozt Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Kenzo Lobos Tsunekawa --- sensing/livox/livox_tag_filter/CMakeLists.txt | 1 + .../config/livox_tag_filter.param.yaml | 19 +++++++++++ .../launch/livox_tag_filter.launch.xml | 23 ++----------- .../schema/livox_tag_filter.schema.json | 33 +++++++++++++++++++ .../livox_tag_filter_node.cpp | 2 +- 5 files changed, 56 insertions(+), 22 deletions(-) create mode 100644 sensing/livox/livox_tag_filter/config/livox_tag_filter.param.yaml create mode 100644 sensing/livox/livox_tag_filter/schema/livox_tag_filter.schema.json diff --git a/sensing/livox/livox_tag_filter/CMakeLists.txt b/sensing/livox/livox_tag_filter/CMakeLists.txt index 90b5eeed713c0..36c500aefa74d 100644 --- a/sensing/livox/livox_tag_filter/CMakeLists.txt +++ b/sensing/livox/livox_tag_filter/CMakeLists.txt @@ -21,4 +21,5 @@ rclcpp_components_register_node(livox_tag_filter ament_auto_package(INSTALL_TO_SHARE launch + config ) diff --git a/sensing/livox/livox_tag_filter/config/livox_tag_filter.param.yaml b/sensing/livox/livox_tag_filter/config/livox_tag_filter.param.yaml new file mode 100644 index 0000000000000..7b7e8cb5bd61a --- /dev/null +++ b/sensing/livox/livox_tag_filter/config/livox_tag_filter.param.yaml @@ -0,0 +1,19 @@ +/**: + ros__parameters: + ignore_tags: [] + # bit 0~1: Point property based on spatial position + # 00: Normal + # 01: High confidence level of the noise + # 10: Moderate confidence level of the noise + # 11: Low confidence level of the noise + # bit 2~3: Point property based on intensity + # 00: Normal + # 01: High confidence level of the noise + # 10: Moderate confidence level of the noise + # 11: Reserved + # bit 4~5: Return number + # 00: return 0 + # 01: return 1 + # 10: return 2 + # 11: return 3 + # bit 6~7: Reserved diff --git a/sensing/livox/livox_tag_filter/launch/livox_tag_filter.launch.xml b/sensing/livox/livox_tag_filter/launch/livox_tag_filter.launch.xml index 1da6c3074e7e7..331db891358f7 100644 --- a/sensing/livox/livox_tag_filter/launch/livox_tag_filter.launch.xml +++ b/sensing/livox/livox_tag_filter/launch/livox_tag_filter.launch.xml @@ -1,30 +1,11 @@ - - - + - + diff --git a/sensing/livox/livox_tag_filter/schema/livox_tag_filter.schema.json b/sensing/livox/livox_tag_filter/schema/livox_tag_filter.schema.json new file mode 100644 index 0000000000000..74d9881192258 --- /dev/null +++ b/sensing/livox/livox_tag_filter/schema/livox_tag_filter.schema.json @@ -0,0 +1,33 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Livox Tag Filter Parameters", + "type": "object", + "definitions": { + "livox_tag_filter": { + "type": "object", + "properties": { + "ignore_tags": { + "type": "array", + "description": "ignored tags (int array) (See the table in the readme file)", + "default": "[]" + } + }, + "required": ["ignore_tags"], + "additionalProperties": false + } + }, + "properties": { + "/**": { + "type": "object", + "properties": { + "ros__parameters": { + "$ref": "#/definitions/livox_tag_filter" + } + }, + "required": ["ros__parameters"], + "additionalProperties": false + } + }, + "required": ["/**"], + "additionalProperties": false +} diff --git a/sensing/livox/livox_tag_filter/src/livox_tag_filter_node/livox_tag_filter_node.cpp b/sensing/livox/livox_tag_filter/src/livox_tag_filter_node/livox_tag_filter_node.cpp index 2fd55ce8df6a0..f3216fdcd9b6a 100644 --- a/sensing/livox/livox_tag_filter/src/livox_tag_filter_node/livox_tag_filter_node.cpp +++ b/sensing/livox/livox_tag_filter/src/livox_tag_filter_node/livox_tag_filter_node.cpp @@ -40,7 +40,7 @@ LivoxTagFilterNode::LivoxTagFilterNode(const rclcpp::NodeOptions & node_options) : Node("livox_tag_filter", node_options) { // Parameter - ignore_tags_ = this->declare_parameter("ignore_tags", std::vector{}); + ignore_tags_ = this->declare_parameter>("ignore_tags"); // Subscriber using std::placeholders::_1;