|
| 1 | +// Copyright 2024 TIER IV, Inc. |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +#ifndef RAINDROP_CLUSTER_FILTER__LOW_INTENSITY_CLUSTER_FILTER__LOW_INTENSITY_CLUSTER_FILTER_HPP_ |
| 16 | +#define RAINDROP_CLUSTER_FILTER__LOW_INTENSITY_CLUSTER_FILTER__LOW_INTENSITY_CLUSTER_FILTER_HPP_ |
| 17 | + |
| 18 | +#include "detected_object_validation/utils/utils.hpp" |
| 19 | + |
| 20 | +#include <rclcpp/rclcpp.hpp> |
| 21 | +#include <tier4_autoware_utils/ros/debug_publisher.hpp> |
| 22 | +#include <tier4_autoware_utils/system/stop_watch.hpp> |
| 23 | + |
| 24 | +#include <tier4_perception_msgs/msg/detected_objects_with_feature.hpp> |
| 25 | + |
| 26 | +#include <tf2_ros/buffer.h> |
| 27 | +#include <tf2_ros/transform_listener.h> |
| 28 | +// #include <tf2_eigen/tf2_eigen.hpp> |
| 29 | +#include <Eigen/Eigen> |
| 30 | + |
| 31 | +#include <memory> |
| 32 | +#include <string> |
| 33 | + |
| 34 | +namespace low_intensity_cluster_filter |
| 35 | +{ |
| 36 | + |
| 37 | +class LowIntensityClusterFilter : public rclcpp::Node |
| 38 | +{ |
| 39 | +public: |
| 40 | + explicit LowIntensityClusterFilter(const rclcpp::NodeOptions & node_options); |
| 41 | + |
| 42 | +private: |
| 43 | + void objectCallback( |
| 44 | + const tier4_perception_msgs::msg::DetectedObjectsWithFeature::ConstSharedPtr input_msg); |
| 45 | + bool isValidatedCluster(const sensor_msgs::msg::PointCloud2 & cluster); |
| 46 | + |
| 47 | + rclcpp::Publisher<tier4_perception_msgs::msg::DetectedObjectsWithFeature>::SharedPtr object_pub_; |
| 48 | + rclcpp::Subscription<tier4_perception_msgs::msg::DetectedObjectsWithFeature>::SharedPtr |
| 49 | + object_sub_; |
| 50 | + |
| 51 | + tf2_ros::Buffer tf_buffer_; |
| 52 | + tf2_ros::TransformListener tf_listener_; |
| 53 | + double intensity_threshold_; |
| 54 | + double existence_probability_threshold_; |
| 55 | + double max_x_; |
| 56 | + double min_x_; |
| 57 | + double max_y_; |
| 58 | + double min_y_; |
| 59 | + |
| 60 | + double max_x_transformed_; |
| 61 | + double min_x_transformed_; |
| 62 | + double max_y_transformed_; |
| 63 | + double min_y_transformed_; |
| 64 | + // Eigen::Vector4f min_boundary_transformed_; |
| 65 | + // Eigen::Vector4f max_boundary_transformed_; |
| 66 | + bool is_validation_range_transformed_ = false; |
| 67 | + const std::string base_link_frame_id_ = "base_link"; |
| 68 | + utils::FilterTargetLabel filter_target_; |
| 69 | + |
| 70 | + // debugger |
| 71 | + std::unique_ptr<tier4_autoware_utils::StopWatch<std::chrono::milliseconds>> stop_watch_ptr_{ |
| 72 | + nullptr}; |
| 73 | + std::unique_ptr<tier4_autoware_utils::DebugPublisher> debug_publisher_ptr_{nullptr}; |
| 74 | +}; |
| 75 | + |
| 76 | +} // namespace low_intensity_cluster_filter |
| 77 | + |
| 78 | +#endif // RAINDROP_CLUSTER_FILTER__LOW_INTENSITY_CLUSTER_FILTER__LOW_INTENSITY_CLUSTER_FILTER_HPP_ |
0 commit comments