From f28ccd834427d2c7a07f3beef0fc3bc6edb2eb3b Mon Sep 17 00:00:00 2001 From: Taekjin LEE Date: Mon, 8 Jul 2024 16:34:56 +0900 Subject: [PATCH] refactor(detected_object_validation)!: fix namespace and directory structure (#7866) * refactor: update include paths for detected object filters Signed-off-by: Taekjin LEE * refactor: set proper namespace Signed-off-by: Taekjin LEE * refactor: move utils to be shared Signed-off-by: Taekjin LEE * refactor: remove unnecessary dependencies in detected_object_validation/package.xml Signed-off-by: Taekjin LEE * chore: Override functions in pcl_validator.hpp Signed-off-by: Taekjin LEE * style(pre-commit): autofix * refactor: pcl_validator to obstacle_pointcloud_validator, ogm_validator to occupancy_grid_map_validator Signed-off-by: Taekjin LEE --------- Signed-off-by: Taekjin LEE Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .../detected_object_validation/CMakeLists.txt | 28 +++++------- .../utils/utils.hpp | 10 +++-- .../{src => lib/utils}/utils.cpp | 6 ++- .../detected_object_validation/package.xml | 3 -- .../lanelet_filter.cpp} | 20 +++++---- .../lanelet_filter/lanelet_filter.hpp} | 27 ++++++----- .../obstacle_pointcloud}/debugger.hpp | 16 ++++--- .../obstacle_pointcloud_validator.cpp} | 14 +++--- .../obstacle_pointcloud_validator.hpp} | 45 ++++++++++++------- .../occupancy_grid_map_validator.cpp} | 21 +++++---- .../occupancy_grid_map_validator.hpp} | 19 +++++--- .../position_filter.cpp} | 12 +++-- .../position_filter/position_filter.hpp} | 23 +++++----- .../test_object_position_filter.cpp | 4 +- .../test/test_utils.cpp | 13 +++--- .../src/low_intensity_cluster_filter_node.hpp | 4 +- 16 files changed, 153 insertions(+), 112 deletions(-) rename perception/detected_object_validation/include/{ => autoware}/detected_object_validation/utils/utils.hpp (82%) rename perception/detected_object_validation/{src => lib/utils}/utils.cpp (87%) rename perception/detected_object_validation/src/{object_lanelet_filter.cpp => lanelet_filter/lanelet_filter.cpp} (95%) rename perception/detected_object_validation/{include/detected_object_validation/detected_object_filter/object_lanelet_filter.hpp => src/lanelet_filter/lanelet_filter.hpp} (81%) rename perception/detected_object_validation/{include/detected_object_validation/obstacle_pointcloud_based_validator => src/obstacle_pointcloud}/debugger.hpp (89%) rename perception/detected_object_validation/src/{obstacle_pointcloud_based_validator.cpp => obstacle_pointcloud/obstacle_pointcloud_validator.cpp} (97%) rename perception/detected_object_validation/{include/detected_object_validation/obstacle_pointcloud_based_validator/obstacle_pointcloud_based_validator.hpp => src/obstacle_pointcloud/obstacle_pointcloud_validator.hpp} (79%) rename perception/detected_object_validation/src/{occupancy_grid_based_validator.cpp => occupancy_grid_map/occupancy_grid_map_validator.cpp} (92%) rename perception/detected_object_validation/{include/detected_object_validation/occupancy_grid_based_validator/occupancy_grid_based_validator.hpp => src/occupancy_grid_map/occupancy_grid_map_validator.hpp} (83%) rename perception/detected_object_validation/src/{object_position_filter.cpp => position_filter/position_filter.cpp} (91%) rename perception/detected_object_validation/{include/detected_object_validation/detected_object_filter/object_position_filter.hpp => src/position_filter/position_filter.hpp} (71%) diff --git a/perception/detected_object_validation/CMakeLists.txt b/perception/detected_object_validation/CMakeLists.txt index c416209d7d55d..6d93e7b426ad2 100644 --- a/perception/detected_object_validation/CMakeLists.txt +++ b/perception/detected_object_validation/CMakeLists.txt @@ -28,12 +28,8 @@ include_directories( ) # Generate occupancy grid based validator exe file -set(OCCUPANCY_GRID_BASED_VALIDATOR_SRC - src/occupancy_grid_based_validator.cpp -) - ament_auto_add_library(occupancy_grid_based_validator SHARED - ${OCCUPANCY_GRID_BASED_VALIDATOR_SRC} + src/occupancy_grid_map/occupancy_grid_map_validator.cpp ) target_link_libraries(occupancy_grid_based_validator @@ -42,12 +38,8 @@ target_link_libraries(occupancy_grid_based_validator ) # Generate obstacle pointcloud based validator exe file -set(OBSTACLE_POINTCLOUD_BASED_VALIDATOR_SRC - src/obstacle_pointcloud_based_validator.cpp -) - ament_auto_add_library(obstacle_pointcloud_based_validator SHARED - ${OBSTACLE_POINTCLOUD_BASED_VALIDATOR_SRC} + src/obstacle_pointcloud/obstacle_pointcloud_validator.cpp ) target_link_libraries(obstacle_pointcloud_based_validator @@ -56,32 +48,32 @@ target_link_libraries(obstacle_pointcloud_based_validator ) ament_auto_add_library(object_lanelet_filter SHARED - src/object_lanelet_filter.cpp - src/utils.cpp + src/lanelet_filter/lanelet_filter.cpp + lib/utils/utils.cpp ) ament_auto_add_library(object_position_filter SHARED - src/object_position_filter.cpp - src/utils.cpp + src/position_filter/position_filter.cpp + lib/utils/utils.cpp ) rclcpp_components_register_node(obstacle_pointcloud_based_validator - PLUGIN "obstacle_pointcloud_based_validator::ObstaclePointCloudBasedValidator" + PLUGIN "autoware::detected_object_validation::obstacle_pointcloud::ObstaclePointCloudBasedValidator" EXECUTABLE obstacle_pointcloud_based_validator_node ) rclcpp_components_register_node(object_lanelet_filter - PLUGIN "object_lanelet_filter::ObjectLaneletFilterNode" + PLUGIN "autoware::detected_object_validation::lanelet_filter::ObjectLaneletFilterNode" EXECUTABLE object_lanelet_filter_node ) rclcpp_components_register_node(object_position_filter - PLUGIN "object_position_filter::ObjectPositionFilterNode" + PLUGIN "autoware::detected_object_validation::position_filter::ObjectPositionFilterNode" EXECUTABLE object_position_filter_node ) rclcpp_components_register_node(occupancy_grid_based_validator - PLUGIN "occupancy_grid_based_validator::OccupancyGridBasedValidator" + PLUGIN "autoware::detected_object_validation::occupancy_grid_map::OccupancyGridBasedValidator" EXECUTABLE occupancy_grid_based_validator_node ) diff --git a/perception/detected_object_validation/include/detected_object_validation/utils/utils.hpp b/perception/detected_object_validation/include/autoware/detected_object_validation/utils/utils.hpp similarity index 82% rename from perception/detected_object_validation/include/detected_object_validation/utils/utils.hpp rename to perception/detected_object_validation/include/autoware/detected_object_validation/utils/utils.hpp index c55e992213eb5..3ec119d2a48c5 100644 --- a/perception/detected_object_validation/include/detected_object_validation/utils/utils.hpp +++ b/perception/detected_object_validation/include/autoware/detected_object_validation/utils/utils.hpp @@ -12,12 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef DETECTED_OBJECT_VALIDATION__UTILS__UTILS_HPP_ -#define DETECTED_OBJECT_VALIDATION__UTILS__UTILS_HPP_ +#ifndef AUTOWARE__DETECTED_OBJECT_VALIDATION__UTILS__UTILS_HPP_ +#define AUTOWARE__DETECTED_OBJECT_VALIDATION__UTILS__UTILS_HPP_ #include #include + +namespace autoware::detected_object_validation +{ namespace utils { struct FilterTargetLabel @@ -48,5 +51,6 @@ inline bool hasBoundingBox(const autoware_perception_msgs::msg::DetectedObject & } } // namespace utils +} // namespace autoware::detected_object_validation -#endif // DETECTED_OBJECT_VALIDATION__UTILS__UTILS_HPP_ +#endif // AUTOWARE__DETECTED_OBJECT_VALIDATION__UTILS__UTILS_HPP_ diff --git a/perception/detected_object_validation/src/utils.cpp b/perception/detected_object_validation/lib/utils/utils.cpp similarity index 87% rename from perception/detected_object_validation/src/utils.cpp rename to perception/detected_object_validation/lib/utils/utils.cpp index f6e2157cb885f..327f65a0c833e 100644 --- a/perception/detected_object_validation/src/utils.cpp +++ b/perception/detected_object_validation/lib/utils/utils.cpp @@ -12,10 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "detected_object_validation/utils/utils.hpp" +#include "autoware/detected_object_validation/utils/utils.hpp" #include +namespace autoware::detected_object_validation +{ namespace utils { using Label = autoware_perception_msgs::msg::ObjectClassification; @@ -27,4 +29,6 @@ bool FilterTargetLabel::isTarget(const uint8_t label) const (label == Label::TRAILER && TRAILER) || (label == Label::MOTORCYCLE && MOTORCYCLE) || (label == Label::BICYCLE && BICYCLE) || (label == Label::PEDESTRIAN && PEDESTRIAN); } + } // namespace utils +} // namespace autoware::detected_object_validation diff --git a/perception/detected_object_validation/package.xml b/perception/detected_object_validation/package.xml index d8eb1257ba451..09440c9f6358d 100644 --- a/perception/detected_object_validation/package.xml +++ b/perception/detected_object_validation/package.xml @@ -22,17 +22,14 @@ autoware_perception_msgs autoware_test_utils autoware_universe_utils - geometry_msgs message_filters nav_msgs object_recognition_utils pcl_conversions rclcpp rclcpp_components - tf2 tf2_geometry_msgs tf2_ros - tier4_perception_msgs ament_lint_auto autoware_lint_common diff --git a/perception/detected_object_validation/src/object_lanelet_filter.cpp b/perception/detected_object_validation/src/lanelet_filter/lanelet_filter.cpp similarity index 95% rename from perception/detected_object_validation/src/object_lanelet_filter.cpp rename to perception/detected_object_validation/src/lanelet_filter/lanelet_filter.cpp index d1ba34f4a61b2..09440fedc1764 100644 --- a/perception/detected_object_validation/src/object_lanelet_filter.cpp +++ b/perception/detected_object_validation/src/lanelet_filter/lanelet_filter.cpp @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "detected_object_validation/detected_object_filter/object_lanelet_filter.hpp" +#include "lanelet_filter.hpp" -#include -#include -#include -#include +#include "autoware/universe_utils/geometry/geometry.hpp" +#include "autoware_lanelet2_extension/utility/message_conversion.hpp" +#include "autoware_lanelet2_extension/utility/query.hpp" +#include "object_recognition_utils/object_recognition_utils.hpp" #include #include @@ -25,7 +25,9 @@ #include -namespace object_lanelet_filter +namespace autoware::detected_object_validation +{ +namespace lanelet_filter { ObjectLaneletFilterNode::ObjectLaneletFilterNode(const rclcpp::NodeOptions & node_options) : Node("object_lanelet_filter_node", node_options), @@ -309,7 +311,9 @@ bool ObjectLaneletFilterNode::isSameDirectionWithLanelets( return false; } -} // namespace object_lanelet_filter +} // namespace lanelet_filter +} // namespace autoware::detected_object_validation #include -RCLCPP_COMPONENTS_REGISTER_NODE(object_lanelet_filter::ObjectLaneletFilterNode) +RCLCPP_COMPONENTS_REGISTER_NODE( + autoware::detected_object_validation::lanelet_filter::ObjectLaneletFilterNode) diff --git a/perception/detected_object_validation/include/detected_object_validation/detected_object_filter/object_lanelet_filter.hpp b/perception/detected_object_validation/src/lanelet_filter/lanelet_filter.hpp similarity index 81% rename from perception/detected_object_validation/include/detected_object_validation/detected_object_filter/object_lanelet_filter.hpp rename to perception/detected_object_validation/src/lanelet_filter/lanelet_filter.hpp index 3ffd8d18c9a67..25d78a160c246 100644 --- a/perception/detected_object_validation/include/detected_object_validation/detected_object_filter/object_lanelet_filter.hpp +++ b/perception/detected_object_validation/src/lanelet_filter/lanelet_filter.hpp @@ -12,19 +12,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef DETECTED_OBJECT_VALIDATION__DETECTED_OBJECT_FILTER__OBJECT_LANELET_FILTER_HPP_ -#define DETECTED_OBJECT_VALIDATION__DETECTED_OBJECT_FILTER__OBJECT_LANELET_FILTER_HPP_ +#ifndef LANELET_FILTER__LANELET_FILTER_HPP_ +#define LANELET_FILTER__LANELET_FILTER_HPP_ -#include "detected_object_validation/utils/utils.hpp" +#include "autoware/detected_object_validation/utils/utils.hpp" +#include "autoware/universe_utils/geometry/geometry.hpp" +#include "autoware/universe_utils/ros/debug_publisher.hpp" +#include "autoware/universe_utils/ros/published_time_publisher.hpp" +#include "autoware_lanelet2_extension/utility/utilities.hpp" -#include -#include -#include -#include #include -#include -#include +#include "autoware_map_msgs/msg/lanelet_map_bin.hpp" +#include "autoware_perception_msgs/msg/detected_objects.hpp" #include #include @@ -33,7 +33,9 @@ #include #include -namespace object_lanelet_filter +namespace autoware::detected_object_validation +{ +namespace lanelet_filter { using autoware::universe_utils::LinearRing2d; using autoware::universe_utils::MultiPoint2d; @@ -92,6 +94,7 @@ class ObjectLaneletFilterNode : public rclcpp::Node std::unique_ptr published_time_publisher_; }; -} // namespace object_lanelet_filter +} // namespace lanelet_filter +} // namespace autoware::detected_object_validation -#endif // DETECTED_OBJECT_VALIDATION__DETECTED_OBJECT_FILTER__OBJECT_LANELET_FILTER_HPP_ +#endif // LANELET_FILTER__LANELET_FILTER_HPP_ diff --git a/perception/detected_object_validation/include/detected_object_validation/obstacle_pointcloud_based_validator/debugger.hpp b/perception/detected_object_validation/src/obstacle_pointcloud/debugger.hpp similarity index 89% rename from perception/detected_object_validation/include/detected_object_validation/obstacle_pointcloud_based_validator/debugger.hpp rename to perception/detected_object_validation/src/obstacle_pointcloud/debugger.hpp index d338580d95418..5886474d51b34 100644 --- a/perception/detected_object_validation/include/detected_object_validation/obstacle_pointcloud_based_validator/debugger.hpp +++ b/perception/detected_object_validation/src/obstacle_pointcloud/debugger.hpp @@ -12,19 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef DETECTED_OBJECT_VALIDATION__OBSTACLE_POINTCLOUD_BASED_VALIDATOR__DEBUGGER_HPP_ -#define DETECTED_OBJECT_VALIDATION__OBSTACLE_POINTCLOUD_BASED_VALIDATOR__DEBUGGER_HPP_ +#ifndef OBSTACLE_POINTCLOUD__DEBUGGER_HPP_ +#define OBSTACLE_POINTCLOUD__DEBUGGER_HPP_ #include -#include +#include "autoware_perception_msgs/msg/detected_objects.hpp" #include #include #include #include -namespace obstacle_pointcloud_based_validator +namespace autoware::detected_object_validation +{ +namespace obstacle_pointcloud { class Debugger { @@ -106,6 +108,8 @@ class Debugger return pointcloud_xyz; } }; -} // namespace obstacle_pointcloud_based_validator -#endif // DETECTED_OBJECT_VALIDATION__OBSTACLE_POINTCLOUD_BASED_VALIDATOR__DEBUGGER_HPP_ +} // namespace obstacle_pointcloud +} // namespace autoware::detected_object_validation + +#endif // OBSTACLE_POINTCLOUD__DEBUGGER_HPP_ diff --git a/perception/detected_object_validation/src/obstacle_pointcloud_based_validator.cpp b/perception/detected_object_validation/src/obstacle_pointcloud/obstacle_pointcloud_validator.cpp similarity index 97% rename from perception/detected_object_validation/src/obstacle_pointcloud_based_validator.cpp rename to perception/detected_object_validation/src/obstacle_pointcloud/obstacle_pointcloud_validator.cpp index fbb3f863be7c4..3fe527935c485 100644 --- a/perception/detected_object_validation/src/obstacle_pointcloud_based_validator.cpp +++ b/perception/detected_object_validation/src/obstacle_pointcloud/obstacle_pointcloud_validator.cpp @@ -12,7 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "detected_object_validation/obstacle_pointcloud_based_validator/obstacle_pointcloud_based_validator.hpp" +#define EIGEN_MPL2_ONLY + +#include "obstacle_pointcloud_validator.hpp" #include #include @@ -25,11 +27,12 @@ #include #endif -#define EIGEN_MPL2_ONLY #include #include -namespace obstacle_pointcloud_based_validator +namespace autoware::detected_object_validation +{ +namespace obstacle_pointcloud { namespace bg = boost::geometry; using Shape = autoware_perception_msgs::msg::Shape; @@ -369,8 +372,9 @@ void ObstaclePointCloudBasedValidator::onObjectsAndObstaclePointCloud( "debug/pipeline_latency_ms", pipeline_latency); } -} // namespace obstacle_pointcloud_based_validator +} // namespace obstacle_pointcloud +} // namespace autoware::detected_object_validation #include RCLCPP_COMPONENTS_REGISTER_NODE( - obstacle_pointcloud_based_validator::ObstaclePointCloudBasedValidator) + autoware::detected_object_validation::obstacle_pointcloud::ObstaclePointCloudBasedValidator) diff --git a/perception/detected_object_validation/include/detected_object_validation/obstacle_pointcloud_based_validator/obstacle_pointcloud_based_validator.hpp b/perception/detected_object_validation/src/obstacle_pointcloud/obstacle_pointcloud_validator.hpp similarity index 79% rename from perception/detected_object_validation/include/detected_object_validation/obstacle_pointcloud_based_validator/obstacle_pointcloud_based_validator.hpp rename to perception/detected_object_validation/src/obstacle_pointcloud/obstacle_pointcloud_validator.hpp index a16bb63fd0c87..19b42ecf9055b 100644 --- a/perception/detected_object_validation/include/detected_object_validation/obstacle_pointcloud_based_validator/obstacle_pointcloud_based_validator.hpp +++ b/perception/detected_object_validation/src/obstacle_pointcloud/obstacle_pointcloud_validator.hpp @@ -13,17 +13,17 @@ // limitations under the License. // NOLINTNEXTLINE(whitespace/line_length) -#ifndef DETECTED_OBJECT_VALIDATION__OBSTACLE_POINTCLOUD_BASED_VALIDATOR__OBSTACLE_POINTCLOUD_BASED_VALIDATOR_HPP_ +#ifndef OBSTACLE_POINTCLOUD__OBSTACLE_POINTCLOUD_VALIDATOR_HPP_ // NOLINTNEXTLINE(whitespace/line_length) -#define DETECTED_OBJECT_VALIDATION__OBSTACLE_POINTCLOUD_BASED_VALIDATOR__OBSTACLE_POINTCLOUD_BASED_VALIDATOR_HPP_ +#define OBSTACLE_POINTCLOUD__OBSTACLE_POINTCLOUD_VALIDATOR_HPP_ -#include "detected_object_validation/obstacle_pointcloud_based_validator/debugger.hpp" +#include "autoware/universe_utils/ros/debug_publisher.hpp" +#include "autoware/universe_utils/ros/published_time_publisher.hpp" +#include "debugger.hpp" -#include -#include #include -#include +#include "autoware_perception_msgs/msg/detected_objects.hpp" #include #include @@ -42,7 +42,10 @@ #include #include #include -namespace obstacle_pointcloud_based_validator + +namespace autoware::detected_object_validation +{ +namespace obstacle_pointcloud { struct PointsNumThresholdParam @@ -91,14 +94,17 @@ class Validator2D : public Validator pcl::PointCloud::Ptr convertToXYZ( const pcl::PointCloud::Ptr & pointcloud_xy); - inline pcl::PointCloud::Ptr getDebugNeighborPointCloud() + inline pcl::PointCloud::Ptr getDebugNeighborPointCloud() override { return convertToXYZ(neighbor_pointcloud_); } - bool setKdtreeInputCloud(const sensor_msgs::msg::PointCloud2::ConstSharedPtr & input_cloud); - bool validate_object(const autoware_perception_msgs::msg::DetectedObject & transformed_object); - std::optional getMaxRadius(const autoware_perception_msgs::msg::DetectedObject & object); + bool setKdtreeInputCloud( + const sensor_msgs::msg::PointCloud2::ConstSharedPtr & input_cloud) override; + bool validate_object( + const autoware_perception_msgs::msg::DetectedObject & transformed_object) override; + std::optional getMaxRadius( + const autoware_perception_msgs::msg::DetectedObject & object) override; std::optional getPointCloudWithinObject( const autoware_perception_msgs::msg::DetectedObject & object, const pcl::PointCloud::Ptr neighbor_pointcloud); @@ -112,13 +118,16 @@ class Validator3D : public Validator public: explicit Validator3D(PointsNumThresholdParam & points_num_threshold_param); - inline pcl::PointCloud::Ptr getDebugNeighborPointCloud() + inline pcl::PointCloud::Ptr getDebugNeighborPointCloud() override { return neighbor_pointcloud_; } - bool setKdtreeInputCloud(const sensor_msgs::msg::PointCloud2::ConstSharedPtr & input_cloud); - bool validate_object(const autoware_perception_msgs::msg::DetectedObject & transformed_object); - std::optional getMaxRadius(const autoware_perception_msgs::msg::DetectedObject & object); + bool setKdtreeInputCloud( + const sensor_msgs::msg::PointCloud2::ConstSharedPtr & input_cloud) override; + bool validate_object( + const autoware_perception_msgs::msg::DetectedObject & transformed_object) override; + std::optional getMaxRadius( + const autoware_perception_msgs::msg::DetectedObject & object) override; std::optional getPointCloudWithinObject( const autoware_perception_msgs::msg::DetectedObject & object, const pcl::PointCloud::Ptr neighbor_pointcloud); @@ -154,7 +163,9 @@ class ObstaclePointCloudBasedValidator : public rclcpp::Node const autoware_perception_msgs::msg::DetectedObjects::ConstSharedPtr & input_objects, const sensor_msgs::msg::PointCloud2::ConstSharedPtr & input_obstacle_pointcloud); }; -} // namespace obstacle_pointcloud_based_validator + +} // namespace obstacle_pointcloud +} // namespace autoware::detected_object_validation // NOLINTNEXTLINE(whitespace/line_length) -#endif // DETECTED_OBJECT_VALIDATION__OBSTACLE_POINTCLOUD_BASED_VALIDATOR__OBSTACLE_POINTCLOUD_BASED_VALIDATOR_HPP_ +#endif // OBSTACLE_POINTCLOUD__OBSTACLE_POINTCLOUD_VALIDATOR_HPP_ diff --git a/perception/detected_object_validation/src/occupancy_grid_based_validator.cpp b/perception/detected_object_validation/src/occupancy_grid_map/occupancy_grid_map_validator.cpp similarity index 92% rename from perception/detected_object_validation/src/occupancy_grid_based_validator.cpp rename to perception/detected_object_validation/src/occupancy_grid_map/occupancy_grid_map_validator.cpp index b8682a6e56b3b..ce900f30f4255 100644 --- a/perception/detected_object_validation/src/occupancy_grid_based_validator.cpp +++ b/perception/detected_object_validation/src/occupancy_grid_map/occupancy_grid_map_validator.cpp @@ -12,11 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "detected_object_validation/occupancy_grid_based_validator/occupancy_grid_based_validator.hpp" +#define EIGEN_MPL2_ONLY + +#include "occupancy_grid_map_validator.hpp" -#include -#include -#include +#include "autoware/universe_utils/geometry/boost_polygon_utils.hpp" +#include "object_recognition_utils/object_classification.hpp" +#include "object_recognition_utils/object_recognition_utils.hpp" #include @@ -26,11 +28,12 @@ #include #endif -#define EIGEN_MPL2_ONLY #include #include -namespace occupancy_grid_based_validator +namespace autoware::detected_object_validation +{ +namespace occupancy_grid_map { using Shape = autoware_perception_msgs::msg::Shape; using Polygon2d = autoware::universe_utils::Polygon2d; @@ -173,7 +176,9 @@ void OccupancyGridBasedValidator::showDebugImage( cv::waitKey(2); } -} // namespace occupancy_grid_based_validator +} // namespace occupancy_grid_map +} // namespace autoware::detected_object_validation #include -RCLCPP_COMPONENTS_REGISTER_NODE(occupancy_grid_based_validator::OccupancyGridBasedValidator) +RCLCPP_COMPONENTS_REGISTER_NODE( + autoware::detected_object_validation::occupancy_grid_map::OccupancyGridBasedValidator) diff --git a/perception/detected_object_validation/include/detected_object_validation/occupancy_grid_based_validator/occupancy_grid_based_validator.hpp b/perception/detected_object_validation/src/occupancy_grid_map/occupancy_grid_map_validator.hpp similarity index 83% rename from perception/detected_object_validation/include/detected_object_validation/occupancy_grid_based_validator/occupancy_grid_based_validator.hpp rename to perception/detected_object_validation/src/occupancy_grid_map/occupancy_grid_map_validator.hpp index beb8faf5db1a3..52b6f79e5e20a 100644 --- a/perception/detected_object_validation/include/detected_object_validation/occupancy_grid_based_validator/occupancy_grid_based_validator.hpp +++ b/perception/detected_object_validation/src/occupancy_grid_map/occupancy_grid_map_validator.hpp @@ -12,16 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef DETECTED_OBJECT_VALIDATION__OCCUPANCY_GRID_BASED_VALIDATOR__OCCUPANCY_GRID_BASED_VALIDATOR_HPP_ -#define DETECTED_OBJECT_VALIDATION__OCCUPANCY_GRID_BASED_VALIDATOR__OCCUPANCY_GRID_BASED_VALIDATOR_HPP_ +#ifndef OCCUPANCY_GRID_MAP__OCCUPANCY_GRID_MAP_VALIDATOR_HPP_ +#define OCCUPANCY_GRID_MAP__OCCUPANCY_GRID_MAP_VALIDATOR_HPP_ + +#include "autoware/universe_utils/ros/published_time_publisher.hpp" -#include #include #include #include #include -#include +#include "autoware_perception_msgs/msg/detected_objects.hpp" #include #include @@ -30,7 +31,9 @@ #include #include -namespace occupancy_grid_based_validator +namespace autoware::detected_object_validation +{ +namespace occupancy_grid_map { class OccupancyGridBasedValidator : public rclcpp::Node { @@ -68,6 +71,8 @@ class OccupancyGridBasedValidator : public rclcpp::Node const nav_msgs::msg::OccupancyGrid & ros_occ_grid, const autoware_perception_msgs::msg::DetectedObjects & objects, const cv::Mat & occ_grid); }; -} // namespace occupancy_grid_based_validator -#endif // DETECTED_OBJECT_VALIDATION__OCCUPANCY_GRID_BASED_VALIDATOR__OCCUPANCY_GRID_BASED_VALIDATOR_HPP_ +} // namespace occupancy_grid_map +} // namespace autoware::detected_object_validation + +#endif // OCCUPANCY_GRID_MAP__OCCUPANCY_GRID_MAP_VALIDATOR_HPP_ diff --git a/perception/detected_object_validation/src/object_position_filter.cpp b/perception/detected_object_validation/src/position_filter/position_filter.cpp similarity index 91% rename from perception/detected_object_validation/src/object_position_filter.cpp rename to perception/detected_object_validation/src/position_filter/position_filter.cpp index dccff8a6ccc67..ac0bab404c476 100644 --- a/perception/detected_object_validation/src/object_position_filter.cpp +++ b/perception/detected_object_validation/src/position_filter/position_filter.cpp @@ -12,9 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "detected_object_validation/detected_object_filter/object_position_filter.hpp" +#include "position_filter.hpp" -namespace object_position_filter +namespace autoware::detected_object_validation +{ +namespace position_filter { ObjectPositionFilterNode::ObjectPositionFilterNode(const rclcpp::NodeOptions & node_options) : Node("object_position_filter_node", node_options), @@ -78,7 +80,9 @@ bool ObjectPositionFilterNode::isObjectInBounds( position.y > lower_bound_y_ && position.y < upper_bound_y_; } -} // namespace object_position_filter +} // namespace position_filter +} // namespace autoware::detected_object_validation #include -RCLCPP_COMPONENTS_REGISTER_NODE(object_position_filter::ObjectPositionFilterNode) +RCLCPP_COMPONENTS_REGISTER_NODE( + autoware::detected_object_validation::position_filter::ObjectPositionFilterNode) diff --git a/perception/detected_object_validation/include/detected_object_validation/detected_object_filter/object_position_filter.hpp b/perception/detected_object_validation/src/position_filter/position_filter.hpp similarity index 71% rename from perception/detected_object_validation/include/detected_object_validation/detected_object_filter/object_position_filter.hpp rename to perception/detected_object_validation/src/position_filter/position_filter.hpp index ea70d62fd952d..30a5d7fc9dfb1 100644 --- a/perception/detected_object_validation/include/detected_object_validation/detected_object_filter/object_position_filter.hpp +++ b/perception/detected_object_validation/src/position_filter/position_filter.hpp @@ -12,17 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef DETECTED_OBJECT_VALIDATION__DETECTED_OBJECT_FILTER__OBJECT_POSITION_FILTER_HPP_ -#define DETECTED_OBJECT_VALIDATION__DETECTED_OBJECT_FILTER__OBJECT_POSITION_FILTER_HPP_ +#ifndef POSITION_FILTER__POSITION_FILTER_HPP_ +#define POSITION_FILTER__POSITION_FILTER_HPP_ -#include "detected_object_validation/utils/utils.hpp" +#include "autoware/detected_object_validation/utils/utils.hpp" +#include "autoware/universe_utils/geometry/geometry.hpp" +#include "autoware/universe_utils/ros/published_time_publisher.hpp" -#include -#include #include -#include -#include +#include "autoware_map_msgs/msg/lanelet_map_bin.hpp" +#include "autoware_perception_msgs/msg/detected_objects.hpp" #include #include @@ -30,7 +30,9 @@ #include #include -namespace object_position_filter +namespace autoware::detected_object_validation +{ +namespace position_filter { class ObjectPositionFilterNode : public rclcpp::Node @@ -57,6 +59,7 @@ class ObjectPositionFilterNode : public rclcpp::Node std::unique_ptr published_time_publisher_; }; -} // namespace object_position_filter +} // namespace position_filter +} // namespace autoware::detected_object_validation -#endif // DETECTED_OBJECT_VALIDATION__DETECTED_OBJECT_FILTER__OBJECT_POSITION_FILTER_HPP_ +#endif // POSITION_FILTER__POSITION_FILTER_HPP_ diff --git a/perception/detected_object_validation/test/object_position_filter/test_object_position_filter.cpp b/perception/detected_object_validation/test/object_position_filter/test_object_position_filter.cpp index 03cebf91418ce..5bd174d5a9e17 100644 --- a/perception/detected_object_validation/test/object_position_filter/test_object_position_filter.cpp +++ b/perception/detected_object_validation/test/object_position_filter/test_object_position_filter.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "detected_object_validation/detected_object_filter/object_position_filter.hpp" +#include "../../src/position_filter/position_filter.hpp" #include #include @@ -21,10 +21,10 @@ #include +using autoware::detected_object_validation::position_filter::ObjectPositionFilterNode; using autoware_perception_msgs::msg::DetectedObject; using autoware_perception_msgs::msg::DetectedObjects; using autoware_perception_msgs::msg::ObjectClassification; -using object_position_filter::ObjectPositionFilterNode; std::shared_ptr generateTestManager() { diff --git a/perception/detected_object_validation/test/test_utils.cpp b/perception/detected_object_validation/test/test_utils.cpp index f7077dadb1ef2..7865f928f23a8 100644 --- a/perception/detected_object_validation/test/test_utils.cpp +++ b/perception/detected_object_validation/test/test_utils.cpp @@ -12,17 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "detected_object_validation/utils/utils.hpp" +#include "autoware/detected_object_validation/utils/utils.hpp" -#include +#include "autoware_perception_msgs/msg/object_classification.hpp" #include +using autoware::detected_object_validation::utils::FilterTargetLabel; using AutowareLabel = autoware_perception_msgs::msg::ObjectClassification; -utils::FilterTargetLabel createFilterTargetAll() +FilterTargetLabel createFilterTargetAll() { - utils::FilterTargetLabel filter; + FilterTargetLabel filter; filter.UNKNOWN = true; filter.CAR = true; filter.TRUCK = true; @@ -34,9 +35,9 @@ utils::FilterTargetLabel createFilterTargetAll() return filter; } -utils::FilterTargetLabel createFilterTargetVehicle() +FilterTargetLabel createFilterTargetVehicle() { - utils::FilterTargetLabel filter; + FilterTargetLabel filter; filter.UNKNOWN = false; filter.CAR = true; filter.TRUCK = true; diff --git a/perception/raindrop_cluster_filter/src/low_intensity_cluster_filter_node.hpp b/perception/raindrop_cluster_filter/src/low_intensity_cluster_filter_node.hpp index 8e21306218ab2..61e23860cd195 100644 --- a/perception/raindrop_cluster_filter/src/low_intensity_cluster_filter_node.hpp +++ b/perception/raindrop_cluster_filter/src/low_intensity_cluster_filter_node.hpp @@ -15,9 +15,9 @@ #ifndef LOW_INTENSITY_CLUSTER_FILTER_NODE_HPP_ #define LOW_INTENSITY_CLUSTER_FILTER_NODE_HPP_ +#include "autoware/detected_object_validation/utils/utils.hpp" #include "autoware/universe_utils/ros/debug_publisher.hpp" #include "autoware/universe_utils/system/stop_watch.hpp" -#include "detected_object_validation/utils/utils.hpp" #include #include @@ -64,7 +64,7 @@ class LowIntensityClusterFilter : public rclcpp::Node // Eigen::Vector4f max_boundary_transformed_; bool is_validation_range_transformed_ = false; const std::string base_link_frame_id_ = "base_link"; - utils::FilterTargetLabel filter_target_; + autoware::detected_object_validation::utils::FilterTargetLabel filter_target_; // debugger std::unique_ptr> stop_watch_ptr_{