diff --git a/perception/detection_by_tracker/CMakeLists.txt b/perception/detection_by_tracker/CMakeLists.txt index 3813f1ba4707..112187551d92 100644 --- a/perception/detection_by_tracker/CMakeLists.txt +++ b/perception/detection_by_tracker/CMakeLists.txt @@ -26,22 +26,22 @@ include_directories( # Generate exe file set(DETECTION_BY_TRACKER_SRC - src/detection_by_tracker_core.cpp - src/utils.cpp + src/detection_by_tracker_node.cpp + src/utils/utils.cpp ) -ament_auto_add_library(detection_by_tracker_node SHARED +ament_auto_add_library(${PROJECT_NAME} SHARED ${DETECTION_BY_TRACKER_SRC} ) -target_link_libraries(detection_by_tracker_node +target_link_libraries(${PROJECT_NAME} Eigen3::Eigen ${PCL_LIBRARIES} ) -rclcpp_components_register_node(detection_by_tracker_node - PLUGIN "DetectionByTracker" - EXECUTABLE detection_by_tracker +rclcpp_components_register_node(${PROJECT_NAME} + PLUGIN "autoware::detection_by_tracker::DetectionByTracker" + EXECUTABLE detection_by_tracker_node ) ament_auto_package( diff --git a/perception/detection_by_tracker/launch/detection_by_tracker.launch.xml b/perception/detection_by_tracker/launch/detection_by_tracker.launch.xml index 95e7cbf16b38..3fba5cb58f8f 100644 --- a/perception/detection_by_tracker/launch/detection_by_tracker.launch.xml +++ b/perception/detection_by_tracker/launch/detection_by_tracker.launch.xml @@ -4,7 +4,7 @@ - + diff --git a/perception/detection_by_tracker/package.xml b/perception/detection_by_tracker/package.xml index 52d4d3fcdd7a..50bd876ce060 100644 --- a/perception/detection_by_tracker/package.xml +++ b/perception/detection_by_tracker/package.xml @@ -16,9 +16,7 @@ autoware_universe_utils eigen euclidean_cluster - libpcl-all-dev object_recognition_utils - pcl_conversions rclcpp rclcpp_components shape_estimation diff --git a/perception/detection_by_tracker/include/detection_by_tracker/debugger.hpp b/perception/detection_by_tracker/src/debugger/debugger.hpp similarity index 85% rename from perception/detection_by_tracker/include/detection_by_tracker/debugger.hpp rename to perception/detection_by_tracker/src/debugger/debugger.hpp index 0169082a2253..242056c3ca31 100644 --- a/perception/detection_by_tracker/include/detection_by_tracker/debugger.hpp +++ b/perception/detection_by_tracker/src/debugger/debugger.hpp @@ -12,22 +12,23 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef DETECTION_BY_TRACKER__DEBUGGER_HPP_ -#define DETECTION_BY_TRACKER__DEBUGGER_HPP_ +#ifndef DEBUGGER__DEBUGGER_HPP_ +#define DEBUGGER__DEBUGGER_HPP_ + +#include "autoware/universe_utils/ros/debug_publisher.hpp" +#include "autoware/universe_utils/system/stop_watch.hpp" +#include "euclidean_cluster/euclidean_cluster.hpp" +#include "euclidean_cluster/utils.hpp" +#include "euclidean_cluster/voxel_grid_based_euclidean_cluster.hpp" +#include "shape_estimation/shape_estimator.hpp" -#include -#include -#include -#include -#include #include -#include -#include -#include +#include "autoware_perception_msgs/msg/detected_objects.hpp" +#include "autoware_perception_msgs/msg/tracked_objects.hpp" +#include "tier4_perception_msgs/msg/detected_objects_with_feature.hpp" #include #include -#include #include #include @@ -46,6 +47,8 @@ #include #include +namespace autoware::detection_by_tracker +{ class Debugger { public: @@ -117,5 +120,6 @@ class Debugger return objects; } }; +} // namespace autoware::detection_by_tracker -#endif // DETECTION_BY_TRACKER__DEBUGGER_HPP_ +#endif // DEBUGGER__DEBUGGER_HPP_ diff --git a/perception/detection_by_tracker/src/detection_by_tracker_core.cpp b/perception/detection_by_tracker/src/detection_by_tracker_node.cpp similarity index 98% rename from perception/detection_by_tracker/src/detection_by_tracker_core.cpp rename to perception/detection_by_tracker/src/detection_by_tracker_node.cpp index 4e502b359120..c41d6002d926 100644 --- a/perception/detection_by_tracker/src/detection_by_tracker_core.cpp +++ b/perception/detection_by_tracker/src/detection_by_tracker_node.cpp @@ -12,12 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "detection_by_tracker/detection_by_tracker_core.hpp" +#define EIGEN_MPL2_ONLY + +#include "detection_by_tracker_node.hpp" +#include "autoware/universe_utils/geometry/geometry.hpp" +#include "autoware/universe_utils/math/unit_conversion.hpp" #include "object_recognition_utils/object_recognition_utils.hpp" -#include -#include +#include +#include #include #include @@ -25,10 +29,6 @@ #include #include -#define EIGEN_MPL2_ONLY -#include -#include - using Label = autoware_perception_msgs::msg::ObjectClassification; namespace { @@ -80,6 +80,9 @@ boost::optional getReferenceShapeSizeInfo( } } // namespace +namespace autoware::detection_by_tracker +{ + void TrackerHandler::onTrackedObjects( const autoware_perception_msgs::msg::TrackedObjects::ConstSharedPtr msg) { @@ -466,5 +469,7 @@ void DetectionByTracker::mergeOverSegmentedObjects( } } +} // namespace autoware::detection_by_tracker + #include -RCLCPP_COMPONENTS_REGISTER_NODE(DetectionByTracker) +RCLCPP_COMPONENTS_REGISTER_NODE(autoware::detection_by_tracker::DetectionByTracker) diff --git a/perception/detection_by_tracker/include/detection_by_tracker/detection_by_tracker_core.hpp b/perception/detection_by_tracker/src/detection_by_tracker_node.hpp similarity index 81% rename from perception/detection_by_tracker/include/detection_by_tracker/detection_by_tracker_core.hpp rename to perception/detection_by_tracker/src/detection_by_tracker_node.hpp index d6d030aadb00..4e58d53fa71a 100644 --- a/perception/detection_by_tracker/include/detection_by_tracker/detection_by_tracker_core.hpp +++ b/perception/detection_by_tracker/src/detection_by_tracker_node.hpp @@ -12,24 +12,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef DETECTION_BY_TRACKER__DETECTION_BY_TRACKER_CORE_HPP_ -#define DETECTION_BY_TRACKER__DETECTION_BY_TRACKER_CORE_HPP_ +#ifndef DETECTION_BY_TRACKER_NODE_HPP_ +#define DETECTION_BY_TRACKER_NODE_HPP_ -#include "detection_by_tracker/debugger.hpp" -#include "detection_by_tracker/utils.hpp" +#include "autoware/universe_utils/ros/published_time_publisher.hpp" +#include "debugger/debugger.hpp" +#include "euclidean_cluster/euclidean_cluster.hpp" +#include "euclidean_cluster/utils.hpp" +#include "euclidean_cluster/voxel_grid_based_euclidean_cluster.hpp" +#include "shape_estimation/shape_estimator.hpp" +#include "utils/utils.hpp" -#include -#include -#include -#include #include -#include -#include -#include +#include "autoware_perception_msgs/msg/detected_objects.hpp" +#include "autoware_perception_msgs/msg/tracked_objects.hpp" +#include "tier4_perception_msgs/msg/detected_objects_with_feature.hpp" #include #include -#include #include #include @@ -48,6 +48,10 @@ #include #include #include + +namespace autoware::detection_by_tracker +{ + class TrackerHandler { private: @@ -82,7 +86,7 @@ class DetectionByTracker : public rclcpp::Node std::map max_search_distance_for_merger_; std::map max_search_distance_for_divider_; - detection_by_tracker::utils::TrackerIgnoreLabel tracker_ignore_; + utils::TrackerIgnoreLabel tracker_ignore_; std::unique_ptr published_time_publisher_; @@ -109,4 +113,6 @@ class DetectionByTracker : public rclcpp::Node tier4_perception_msgs::msg::DetectedObjectsWithFeature & out_objects); }; -#endif // DETECTION_BY_TRACKER__DETECTION_BY_TRACKER_CORE_HPP_ +} // namespace autoware::detection_by_tracker + +#endif // DETECTION_BY_TRACKER_NODE_HPP_ diff --git a/perception/detection_by_tracker/src/utils.cpp b/perception/detection_by_tracker/src/utils/utils.cpp similarity index 91% rename from perception/detection_by_tracker/src/utils.cpp rename to perception/detection_by_tracker/src/utils/utils.cpp index 51c6e5724543..b269d703be7d 100644 --- a/perception/detection_by_tracker/src/utils.cpp +++ b/perception/detection_by_tracker/src/utils/utils.cpp @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "detection_by_tracker/utils.hpp" +#include "utils.hpp" #include -namespace detection_by_tracker +namespace autoware::detection_by_tracker { namespace utils { @@ -30,4 +30,4 @@ bool TrackerIgnoreLabel::isIgnore(const uint8_t label) const (label == Label::BICYCLE && BICYCLE) || (label == Label::PEDESTRIAN && PEDESTRIAN); } } // namespace utils -} // namespace detection_by_tracker +} // namespace autoware::detection_by_tracker diff --git a/perception/detection_by_tracker/include/detection_by_tracker/utils.hpp b/perception/detection_by_tracker/src/utils/utils.hpp similarity index 82% rename from perception/detection_by_tracker/include/detection_by_tracker/utils.hpp rename to perception/detection_by_tracker/src/utils/utils.hpp index ed783b0343a1..b7041124fa93 100644 --- a/perception/detection_by_tracker/include/detection_by_tracker/utils.hpp +++ b/perception/detection_by_tracker/src/utils/utils.hpp @@ -12,12 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef DETECTION_BY_TRACKER__UTILS_HPP_ -#define DETECTION_BY_TRACKER__UTILS_HPP_ +#ifndef UTILS__UTILS_HPP_ +#define UTILS__UTILS_HPP_ #include -namespace detection_by_tracker +namespace autoware::detection_by_tracker { namespace utils { @@ -34,6 +34,6 @@ struct TrackerIgnoreLabel bool isIgnore(const uint8_t label) const; }; // struct TrackerIgnoreLabel } // namespace utils -} // namespace detection_by_tracker +} // namespace autoware::detection_by_tracker -#endif // DETECTION_BY_TRACKER__UTILS_HPP_ +#endif // UTILS__UTILS_HPP_