From 8c2f044d742a659c73efa8a0f2c760658415d291 Mon Sep 17 00:00:00 2001 From: Taekjin LEE Date: Thu, 27 Jun 2024 15:37:45 +0900 Subject: [PATCH] refactor(radar_crossing_objects_noise_filter)!: fix namespace and directory structure (#7649) * feat: Refactor radar_crossing_objects_noise_filter node Signed-off-by: Taekjin LEE * refactor: fix the node name Signed-off-by: Taekjin LEE * refactor: move header file to src Signed-off-by: Taekjin LEE * refactor: remove unused dependency Signed-off-by: Taekjin LEE --------- Signed-off-by: Taekjin LEE --- .../CMakeLists.txt | 14 +++++++------- .../package.xml | 1 - .../radar_crossing_objects_noise_filter_node.cpp | 8 ++++---- .../radar_crossing_objects_noise_filter_node.hpp | 10 +++++----- ...test_radar_crossing_objects_filter_is_noise.cpp | 12 ++++++------ 5 files changed, 22 insertions(+), 23 deletions(-) rename perception/radar_crossing_objects_noise_filter/src/{radar_crossing_objects_noise_filter_node => }/radar_crossing_objects_noise_filter_node.cpp (94%) rename perception/radar_crossing_objects_noise_filter/{include/radar_crossing_objects_noise_filter => src}/radar_crossing_objects_noise_filter_node.hpp (82%) diff --git a/perception/radar_crossing_objects_noise_filter/CMakeLists.txt b/perception/radar_crossing_objects_noise_filter/CMakeLists.txt index bf4a46cda7ae6..6414739413d5c 100644 --- a/perception/radar_crossing_objects_noise_filter/CMakeLists.txt +++ b/perception/radar_crossing_objects_noise_filter/CMakeLists.txt @@ -6,12 +6,12 @@ find_package(autoware_cmake REQUIRED) autoware_package() # Targets -ament_auto_add_library(radar_crossing_objects_noise_filter_node_component SHARED - src/radar_crossing_objects_noise_filter_node/radar_crossing_objects_noise_filter_node.cpp +ament_auto_add_library(${PROJECT_NAME}_node_component SHARED + src/radar_crossing_objects_noise_filter_node.cpp ) -rclcpp_components_register_node(radar_crossing_objects_noise_filter_node_component - PLUGIN "radar_crossing_objects_noise_filter::RadarCrossingObjectsNoiseFilterNode" +rclcpp_components_register_node(${PROJECT_NAME}_node_component + PLUGIN "autoware::radar_crossing_objects_noise_filter::RadarCrossingObjectsNoiseFilterNode" EXECUTABLE radar_crossing_objects_noise_filter_node ) @@ -23,10 +23,10 @@ if(BUILD_TESTING) ament_lint_auto_find_test_dependencies() file(GLOB_RECURSE test_files test/**/*.cpp) - ament_add_ros_isolated_gtest(radar_crossing_objects_noise_filter ${test_files}) + ament_add_ros_isolated_gtest(${PROJECT_NAME} ${test_files}) - target_link_libraries(radar_crossing_objects_noise_filter - radar_crossing_objects_noise_filter_node_component + target_link_libraries(${PROJECT_NAME} + ${PROJECT_NAME}_node_component ) endif() diff --git a/perception/radar_crossing_objects_noise_filter/package.xml b/perception/radar_crossing_objects_noise_filter/package.xml index 0db40b24e809c..d0245dfe62a40 100644 --- a/perception/radar_crossing_objects_noise_filter/package.xml +++ b/perception/radar_crossing_objects_noise_filter/package.xml @@ -16,7 +16,6 @@ autoware_perception_msgs autoware_universe_utils - geometry_msgs rclcpp rclcpp_components tf2 diff --git a/perception/radar_crossing_objects_noise_filter/src/radar_crossing_objects_noise_filter_node/radar_crossing_objects_noise_filter_node.cpp b/perception/radar_crossing_objects_noise_filter/src/radar_crossing_objects_noise_filter_node.cpp similarity index 94% rename from perception/radar_crossing_objects_noise_filter/src/radar_crossing_objects_noise_filter_node/radar_crossing_objects_noise_filter_node.cpp rename to perception/radar_crossing_objects_noise_filter/src/radar_crossing_objects_noise_filter_node.cpp index 2f5884c04ce37..13231b83bf27b 100644 --- a/perception/radar_crossing_objects_noise_filter/src/radar_crossing_objects_noise_filter_node/radar_crossing_objects_noise_filter_node.cpp +++ b/perception/radar_crossing_objects_noise_filter/src/radar_crossing_objects_noise_filter_node.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "radar_crossing_objects_noise_filter/radar_crossing_objects_noise_filter_node.hpp" +#include "radar_crossing_objects_noise_filter_node.hpp" #include "autoware/universe_utils/geometry/geometry.hpp" #include "autoware/universe_utils/math/normalization.hpp" @@ -50,7 +50,7 @@ bool update_param( } } // namespace -namespace radar_crossing_objects_noise_filter +namespace autoware::radar_crossing_objects_noise_filter { using autoware_perception_msgs::msg::DetectedObject; using autoware_perception_msgs::msg::DetectedObjects; @@ -142,8 +142,8 @@ bool RadarCrossingObjectsNoiseFilterNode::isNoise(const DetectedObject & object) } } -} // namespace radar_crossing_objects_noise_filter +} // namespace autoware::radar_crossing_objects_noise_filter #include "rclcpp_components/register_node_macro.hpp" RCLCPP_COMPONENTS_REGISTER_NODE( - radar_crossing_objects_noise_filter::RadarCrossingObjectsNoiseFilterNode) + autoware::radar_crossing_objects_noise_filter::RadarCrossingObjectsNoiseFilterNode) diff --git a/perception/radar_crossing_objects_noise_filter/include/radar_crossing_objects_noise_filter/radar_crossing_objects_noise_filter_node.hpp b/perception/radar_crossing_objects_noise_filter/src/radar_crossing_objects_noise_filter_node.hpp similarity index 82% rename from perception/radar_crossing_objects_noise_filter/include/radar_crossing_objects_noise_filter/radar_crossing_objects_noise_filter_node.hpp rename to perception/radar_crossing_objects_noise_filter/src/radar_crossing_objects_noise_filter_node.hpp index fbd64c884d396..6e389f563a138 100644 --- a/perception/radar_crossing_objects_noise_filter/include/radar_crossing_objects_noise_filter/radar_crossing_objects_noise_filter_node.hpp +++ b/perception/radar_crossing_objects_noise_filter/src/radar_crossing_objects_noise_filter_node.hpp @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef RADAR_CROSSING_OBJECTS_NOISE_FILTER__RADAR_CROSSING_OBJECTS_NOISE_FILTER_NODE_HPP_ -#define RADAR_CROSSING_OBJECTS_NOISE_FILTER__RADAR_CROSSING_OBJECTS_NOISE_FILTER_NODE_HPP_ +#ifndef RADAR_CROSSING_OBJECTS_NOISE_FILTER_NODE_HPP_ +#define RADAR_CROSSING_OBJECTS_NOISE_FILTER_NODE_HPP_ #include "rclcpp/rclcpp.hpp" @@ -23,7 +23,7 @@ #include #include -namespace radar_crossing_objects_noise_filter +namespace autoware::radar_crossing_objects_noise_filter { using autoware_perception_msgs::msg::DetectedObject; using autoware_perception_msgs::msg::DetectedObjects; @@ -63,6 +63,6 @@ class RadarCrossingObjectsNoiseFilterNode : public rclcpp::Node bool isNoise(const DetectedObject & object); }; -} // namespace radar_crossing_objects_noise_filter +} // namespace autoware::radar_crossing_objects_noise_filter -#endif // RADAR_CROSSING_OBJECTS_NOISE_FILTER__RADAR_CROSSING_OBJECTS_NOISE_FILTER_NODE_HPP_ +#endif // RADAR_CROSSING_OBJECTS_NOISE_FILTER_NODE_HPP_ diff --git a/perception/radar_crossing_objects_noise_filter/test/test_radar_crossing_objects_noise_filter/test_radar_crossing_objects_filter_is_noise.cpp b/perception/radar_crossing_objects_noise_filter/test/test_radar_crossing_objects_noise_filter/test_radar_crossing_objects_filter_is_noise.cpp index 44ccaae8ee7fc..93475af7b3628 100644 --- a/perception/radar_crossing_objects_noise_filter/test/test_radar_crossing_objects_noise_filter/test_radar_crossing_objects_filter_is_noise.cpp +++ b/perception/radar_crossing_objects_noise_filter/test/test_radar_crossing_objects_noise_filter/test_radar_crossing_objects_filter_is_noise.cpp @@ -12,24 +12,24 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "../../src/radar_crossing_objects_noise_filter_node.hpp" #include "autoware/universe_utils/geometry/geometry.hpp" #include "autoware/universe_utils/math/unit_conversion.hpp" -#include "radar_crossing_objects_noise_filter/radar_crossing_objects_noise_filter_node.hpp" #include #include -std::shared_ptr get_node( - double angle_threshold, double velocity_threshold) +std::shared_ptr +get_node(double angle_threshold, double velocity_threshold) { rclcpp::NodeOptions node_options; node_options.parameter_overrides( {{"angle_threshold", angle_threshold}, {"velocity_threshold", velocity_threshold}}); - auto node = - std::make_shared( - node_options); + auto node = std::make_shared< + autoware::radar_crossing_objects_noise_filter::RadarCrossingObjectsNoiseFilterNode>( + node_options); return node; }