From 2ce48f35a7901f0a9cec2361c3e3d16d069ab08b Mon Sep 17 00:00:00 2001 From: PhoebeWu21 Date: Wed, 6 Sep 2023 08:26:26 +0800 Subject: [PATCH 1/4] refactor(radar_tracks_msgs_converter): rework parameters Signed-off-by: PhoebeWu21 --- .../CMakeLists.txt | 1 + ...fig-radar_tracks_msgs_converter.param.yaml | 19 +++++++++ .../radar_tracks_msgs_converter.launch.xml | 7 ++-- .../radar_tracks_msgs_converter.schema.json | 41 +++++++++++++++++++ .../radar_tracks_msgs_converter_node.cpp | 8 ++-- 5 files changed, 68 insertions(+), 8 deletions(-) create mode 100644 perception/radar_tracks_msgs_converter/config/config-radar_tracks_msgs_converter.param.yaml create mode 100644 perception/radar_tracks_msgs_converter/schema/radar_tracks_msgs_converter.schema.json diff --git a/perception/radar_tracks_msgs_converter/CMakeLists.txt b/perception/radar_tracks_msgs_converter/CMakeLists.txt index 2a7090eebb996..75ccc4d6e66e6 100644 --- a/perception/radar_tracks_msgs_converter/CMakeLists.txt +++ b/perception/radar_tracks_msgs_converter/CMakeLists.txt @@ -25,4 +25,5 @@ endif() ament_auto_package( INSTALL_TO_SHARE launch + config ) diff --git a/perception/radar_tracks_msgs_converter/config/config-radar_tracks_msgs_converter.param.yaml b/perception/radar_tracks_msgs_converter/config/config-radar_tracks_msgs_converter.param.yaml new file mode 100644 index 0000000000000..8fb33123ea0fd --- /dev/null +++ b/perception/radar_tracks_msgs_converter/config/config-radar_tracks_msgs_converter.param.yaml @@ -0,0 +1,19 @@ +# Copyright 2023 Foxconn, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +/**: + ros__parameters: + update_rate_hz: 20.0 + new_frame_id: "base_link" + use_twist_compensation: false \ No newline at end of file diff --git a/perception/radar_tracks_msgs_converter/launch/radar_tracks_msgs_converter.launch.xml b/perception/radar_tracks_msgs_converter/launch/radar_tracks_msgs_converter.launch.xml index c9f4a31354247..488c950412953 100644 --- a/perception/radar_tracks_msgs_converter/launch/radar_tracks_msgs_converter.launch.xml +++ b/perception/radar_tracks_msgs_converter/launch/radar_tracks_msgs_converter.launch.xml @@ -3,15 +3,14 @@ - - + + - - + diff --git a/perception/radar_tracks_msgs_converter/schema/radar_tracks_msgs_converter.schema.json b/perception/radar_tracks_msgs_converter/schema/radar_tracks_msgs_converter.schema.json new file mode 100644 index 0000000000000..7807354447e8f --- /dev/null +++ b/perception/radar_tracks_msgs_converter/schema/radar_tracks_msgs_converter.schema.json @@ -0,0 +1,41 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Parameters for Radar Tracks Msgs Converter node", + "type": "object", + "definitions": { + "radar_tracks_msgs_converter": { + "type": "object", + "properties": { + "update_rate_hz": { + "type": "number", + "description": "The update rate [hz].", + "default": "20.0", + "minimum": 0.0 + }, + "new_frame_id": { + "type": "string", + "description": "The header frame of output topic.", + "default": "base_link" + }, + "use_twist_compensation": { + "type": "boolean", + "description": "If the parameter is true, then the twist of output objects' topic is compensated by ego vehicle motion.", + "default": "false" + } + }, + "required": ["update_rate_hz", "new_frame_id", "use_twist_compensation"] + } + }, + "properties": { + "/**": { + "type": "object", + "properties": { + "ros__parameters": { + "$ref": "#/definitions/radar_tracks_msgs_converter" + } + }, + "required": ["ros__parameters"] + } + }, + "required": ["/**"] +} diff --git a/perception/radar_tracks_msgs_converter/src/radar_tracks_msgs_converter_node/radar_tracks_msgs_converter_node.cpp b/perception/radar_tracks_msgs_converter/src/radar_tracks_msgs_converter_node/radar_tracks_msgs_converter_node.cpp index ab5e4eb5abe90..d6a25fc9165ce 100644 --- a/perception/radar_tracks_msgs_converter/src/radar_tracks_msgs_converter_node/radar_tracks_msgs_converter_node.cpp +++ b/perception/radar_tracks_msgs_converter/src/radar_tracks_msgs_converter_node/radar_tracks_msgs_converter_node.cpp @@ -1,4 +1,4 @@ -// Copyright 2022 TIER IV, Inc. +// Copyright 2022-2023 Foxconn, 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. @@ -76,9 +76,9 @@ RadarTracksMsgsConverterNode::RadarTracksMsgsConverterNode(const rclcpp::NodeOpt std::bind(&RadarTracksMsgsConverterNode::onSetParam, this, _1)); // Node Parameter - node_param_.update_rate_hz = declare_parameter("update_rate_hz", 20.0); - node_param_.new_frame_id = declare_parameter("new_frame_id", "base_link"); - node_param_.use_twist_compensation = declare_parameter("use_twist_compensation", false); + node_param_.update_rate_hz = declare_parameter("update_rate_hz"); + node_param_.new_frame_id = declare_parameter("new_frame_id"); + node_param_.use_twist_compensation = declare_parameter("use_twist_compensation"); // Subscriber sub_radar_ = create_subscription( From ed10909e9ad040ddc3b422e89cc3244a59cac26e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 7 Sep 2023 06:24:40 +0000 Subject: [PATCH 2/4] style(pre-commit): autofix --- .../config/config-radar_tracks_msgs_converter.param.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perception/radar_tracks_msgs_converter/config/config-radar_tracks_msgs_converter.param.yaml b/perception/radar_tracks_msgs_converter/config/config-radar_tracks_msgs_converter.param.yaml index 8fb33123ea0fd..e286d17e82ebd 100644 --- a/perception/radar_tracks_msgs_converter/config/config-radar_tracks_msgs_converter.param.yaml +++ b/perception/radar_tracks_msgs_converter/config/config-radar_tracks_msgs_converter.param.yaml @@ -16,4 +16,4 @@ ros__parameters: update_rate_hz: 20.0 new_frame_id: "base_link" - use_twist_compensation: false \ No newline at end of file + use_twist_compensation: false From 218cb31d54e5fb5095ca662873d962f32fae6d72 Mon Sep 17 00:00:00 2001 From: PhoebeWu21 Date: Mon, 16 Oct 2023 13:39:29 +0800 Subject: [PATCH 3/4] refactor(radar_tracks_msgs_converter): rework parameters Signed-off-by: PhoebeWu21 --- .../config-radar_tracks_msgs_converter.param.yaml | 14 -------------- .../radar_tracks_msgs_converter_node.cpp | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/perception/radar_tracks_msgs_converter/config/config-radar_tracks_msgs_converter.param.yaml b/perception/radar_tracks_msgs_converter/config/config-radar_tracks_msgs_converter.param.yaml index e286d17e82ebd..f9b0241222e78 100644 --- a/perception/radar_tracks_msgs_converter/config/config-radar_tracks_msgs_converter.param.yaml +++ b/perception/radar_tracks_msgs_converter/config/config-radar_tracks_msgs_converter.param.yaml @@ -1,17 +1,3 @@ -# Copyright 2023 Foxconn, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - /**: ros__parameters: update_rate_hz: 20.0 diff --git a/perception/radar_tracks_msgs_converter/src/radar_tracks_msgs_converter_node/radar_tracks_msgs_converter_node.cpp b/perception/radar_tracks_msgs_converter/src/radar_tracks_msgs_converter_node/radar_tracks_msgs_converter_node.cpp index d6a25fc9165ce..c0fd4d7c7f7fa 100644 --- a/perception/radar_tracks_msgs_converter/src/radar_tracks_msgs_converter_node/radar_tracks_msgs_converter_node.cpp +++ b/perception/radar_tracks_msgs_converter/src/radar_tracks_msgs_converter_node/radar_tracks_msgs_converter_node.cpp @@ -1,4 +1,4 @@ -// Copyright 2022-2023 Foxconn, TIER IV, Inc. +// Copyright 2022 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 66b173c0fa548ac86ea74bbe9a703c784fdbe853 Mon Sep 17 00:00:00 2001 From: PhoebeWu21 Date: Mon, 4 Dec 2023 09:26:02 +0800 Subject: [PATCH 4/4] refactor(radar_tracks_msgs_converter): rework parameters Signed-off-by: PhoebeWu21 --- perception/radar_tracks_msgs_converter/README.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/perception/radar_tracks_msgs_converter/README.md b/perception/radar_tracks_msgs_converter/README.md index c29d8ee424549..4a39bdf730d34 100644 --- a/perception/radar_tracks_msgs_converter/README.md +++ b/perception/radar_tracks_msgs_converter/README.md @@ -18,12 +18,7 @@ This package convert from [radar_msgs/msg/RadarTracks](https://github.com/ros-pe ### Parameters -- `update_rate_hz` (double): The update rate [hz]. - - Default parameter is 20.0 -- `new_frame_id` (string): The header frame of output topic. - - Default parameter is "base_link" -- `use_twist_compensation` (bool): If the parameter is true, then the twist of output objects' topic is compensated by ego vehicle motion. - - Default parameter is "false" +{{ json_to_markdown("perception/radar_tracks_msgs_converter/schema/radar_tracks_msgs_converter.schema.json") }} ## Note