19 #ifndef EUCLIDEAN_CLUSTER_NODES__EUCLIDEAN_CLUSTER_NODE_HPP_
20 #define EUCLIDEAN_CLUSTER_NODES__EUCLIDEAN_CLUSTER_NODE_HPP_
22 #include <tf2_ros/transform_listener.h>
23 #include <tf2_ros/buffer.h>
24 #include <rclcpp/rclcpp.hpp>
25 #include <autoware_auto_perception_msgs/msg/point_clusters.hpp>
26 #include <geometry_msgs/msg/transform_stamped.hpp>
28 #include <autoware_auto_perception_msgs/msg/bounding_box_array.hpp>
29 #include <autoware_auto_perception_msgs/msg/detected_objects.hpp>
31 #include <visualization_msgs/msg/marker_array.hpp>
41 namespace segmentation
44 namespace euclidean_cluster_nodes
65 const rclcpp::NodeOptions & node_options);
68 enum class DetectedObjectsShape : uint8_t { POLYGON_PRISM = 1
u, BOUNDING_BOX = 2
u, };
70 void EUCLIDEAN_CLUSTER_NODES_LOCAL handle(
const PointCloud2::SharedPtr msg_ptr);
72 void EUCLIDEAN_CLUSTER_NODES_LOCAL insert_plain(
const PointCloud2 & cloud);
74 void EUCLIDEAN_CLUSTER_NODES_LOCAL insert_voxel(
const PointCloud2 & cloud);
76 void EUCLIDEAN_CLUSTER_NODES_LOCAL insert(
const PointCloud2 & cloud);
78 void EUCLIDEAN_CLUSTER_NODES_LOCAL publish_clusters(
80 const std_msgs::msg::Header & header);
82 void EUCLIDEAN_CLUSTER_NODES_LOCAL handle_clusters(
84 const std_msgs::msg::Header & header);
86 DetectedObjectsShape get_detected_object_type_from_string(
87 const std::string & detected_object_type_string)
89 if (detected_object_type_string ==
"polygon") {
90 return DetectedObjectsShape::POLYGON_PRISM;
91 }
else if (detected_object_type_string ==
"bounding_box") {
92 return DetectedObjectsShape::BOUNDING_BOX;
94 throw std::invalid_argument{
"Unknown detected object type"};
99 const rclcpp::Subscription<PointCloud2>::SharedPtr m_cloud_sub_ptr;
100 const rclcpp::Publisher<Clusters>::SharedPtr m_cluster_pub_ptr;
101 const rclcpp::Publisher<BoundingBoxArray>::SharedPtr m_box_pub_ptr;
102 const rclcpp::Publisher<MarkerArray>::SharedPtr m_marker_pub_ptr;
103 rclcpp::Publisher<DetectedObjects>::SharedPtr m_detected_objects_pub_ptr;
104 std::shared_ptr<tf2_ros::Buffer> tf_buffer_;
105 std::shared_ptr<tf2_ros::TransformListener> tf_listener_;
110 std::unique_ptr<VoxelAlgorithm> m_voxel_ptr;
111 DetectedObjectsShape detected_objects_shape_type;
114 const bool8_t m_filter_output_by_size;
120 #endif // EUCLIDEAN_CLUSTER_NODES__EUCLIDEAN_CLUSTER_NODE_HPP_